135 lines
3.8 KiB
CMake
135 lines
3.8 KiB
CMake
#
|
|
# JoeyDev
|
|
# Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
|
|
#
|
|
# This software is provided 'as-is', without any express or implied
|
|
# warranty. In no event will the authors be held liable for any damages
|
|
# arising from the use of this software.
|
|
#
|
|
# Permission is granted to anyone to use this software for any purpose,
|
|
# including commercial applications, and to alter it and redistribute it
|
|
# freely, subject to the following restrictions:
|
|
#
|
|
# 1. The origin of this software must not be misrepresented; you must not
|
|
# claim that you wrote the original software. If you use this software
|
|
# in a product, an acknowledgment in the product documentation would be
|
|
# appreciated but is not required.
|
|
# 2. Altered source versions must be plainly marked as such, and must not be
|
|
# misrepresented as being the original software.
|
|
# 3. This notice may not be removed or altered from any source distribution.
|
|
#
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.22)
|
|
include(FindPkgConfig)
|
|
|
|
|
|
project(joeydev LANGUAGES C VERSION 1.0)
|
|
# There are also version numbers in:
|
|
# com.kangaroopunch.JoeyDev.appdata.xml
|
|
# com.kangaroopunch.JoeyDev.desktop
|
|
|
|
|
|
# Default to ON for developing the app. buildFlatpak.sh turns this off for us.
|
|
option(DEBUG_MODE "Enable debugging output and memory tracing?" ON)
|
|
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
|
|
set(SOURCE_FILES
|
|
thirdparty-installed/memwatch/memwatch.c
|
|
thirdparty-installed/cwalk-master/src/cwalk.c
|
|
ui/generated/resources.c
|
|
src/main.c
|
|
src/utils.c
|
|
src/joeydev.c
|
|
src/vector.c
|
|
src/array.c
|
|
src/draw.c
|
|
src/image.c
|
|
src/vecparse.c
|
|
src/color.c
|
|
src/palette.c
|
|
src/project.c
|
|
src/ssh.c
|
|
src/http.c
|
|
src/editor.c
|
|
src/compiler.c
|
|
src/messages.c
|
|
)
|
|
|
|
configure_file(include/config.h.in config.h)
|
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
|
|
|
|
# Perform pre-build operations.
|
|
add_custom_target(GENERATE_UI_HEADERS
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tools/prebuild.sh "${CMAKE_SOURCE_DIR}"
|
|
BYPRODUCTS
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/memwatch/memwatch.c
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/cwalk-master/src/cwalk.c
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/scintilla.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/liblexilla.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgpg-error.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgcrypt.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libssh2.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libz.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libtcc.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/tcc/libtcc1.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libsigsegv.a
|
|
)
|
|
add_dependencies(${CMAKE_PROJECT_NAME} GENERATE_UI_HEADERS)
|
|
|
|
|
|
# Find dependencies.
|
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
|
|
|
|
# Compile Options.
|
|
include_directories(
|
|
${GTK3_INCLUDE_DIRS}
|
|
${PROJECT_BINARY_DIR}
|
|
include
|
|
ui/generated
|
|
thirdparty-installed/include
|
|
)
|
|
|
|
add_definitions(
|
|
${GTK3_CFLAGS}
|
|
-Wall
|
|
-Wno-unknown-pragmas
|
|
)
|
|
|
|
if(DEBUG_MODE)
|
|
add_definitions(-O0)
|
|
else()
|
|
add_definitions(-O2)
|
|
endif()
|
|
|
|
|
|
target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC
|
|
${GTK3_LIBRARY_DIRS}
|
|
)
|
|
|
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
-rdynamic
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/scintilla.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/liblexilla.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libssh2.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgcrypt.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libgpg-error.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libcurl.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libz.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libtcc.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/tcc/libtcc1.a
|
|
${CMAKE_SOURCE_DIR}/thirdparty-installed/lib/libsigsegv.a
|
|
${GTK3_LIBRARIES}
|
|
-ldl
|
|
-pthread
|
|
-lm
|
|
-lstdc++
|
|
)
|
|
|
|
|
|
install(TARGETS ${CMAKE_PROJECT_NAME})
|