joeydev/CMakeLists.txt
2022-12-20 18:13:47 -06:00

116 lines
2.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/memwatch/memwatch.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
)
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/scintilla/bin/scintilla.a
${CMAKE_SOURCE_DIR}/thirdparty/lexilla/bin/liblexilla.a
${CMAKE_SOURCE_DIR}/thirdparty/libssh2-1.10.0/src/libssh2.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/libssh2-1.10.0/include
thirdparty/scintilla/include
thirdparty/lexilla/include
thirdparty/memwatch
)
add_definitions(
${GTK3_CFLAGS}
-Wall
-Wno-unknown-pragmas
-O2
)
target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC
${GTK3_LIBRARY_DIRS}
)
target_link_libraries(${CMAKE_PROJECT_NAME}
-rdynamic
${CMAKE_SOURCE_DIR}/thirdparty/scintilla/bin/scintilla.a
${CMAKE_SOURCE_DIR}/thirdparty/lexilla/bin/liblexilla.a
${CMAKE_SOURCE_DIR}/thirdparty/libssh2-1.10.0/src/libssh2.a
${GTK3_LIBRARIES}
# -lgpg-error
# -lssl
# -lcrypto
# -ldl
# -pthread
# -lz
-lm
-lstdc++
)
install(TARGETS ${CMAKE_PROJECT_NAME})