# # JoeyDev # Copyright (C) 2018-2023 Scott Duensing # # 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) 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_OUTPUT "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 ) 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 ) add_dependencies(${CMAKE_PROJECT_NAME} GENERATE_UI_HEADERS) # Find dependencies. # GTK+ 3.0 is a PITA. This will be fixed in CMake 3.25 when FindGTK3 finally shows up. execute_process(COMMAND pkg-config --cflags gtk+-3.0 OUTPUT_VARIABLE OUT_TMP_VAR OUTPUT_STRIP_TRAILING_WHITESPACE ) string(STRIP ${OUT_TMP_VAR} GTK3_CFLAGS) execute_process(COMMAND pkg-config --libs gtk+-3.0 OUTPUT_VARIABLE OUT_TMP_VAR OUTPUT_STRIP_TRAILING_WHITESPACE ) string(STRIP ${OUT_TMP_VAR} GTK3_LIBRARIES) # Compile Options. include_directories( ${PROJECT_BINARY_DIR} include ui/generated thirdparty/scintilla/include thirdparty/lexilla/include thirdparty/memwatch ) add_definitions( -Wall -Wno-unknown-pragmas -O2 ${GTK3_CFLAGS} ) target_link_libraries(${CMAKE_PROJECT_NAME} -rdynamic ${CMAKE_SOURCE_DIR}/thirdparty/scintilla/bin/scintilla.a ${CMAKE_SOURCE_DIR}/thirdparty/lexilla/bin/liblexilla.a ${GTK3_LIBRARIES} -lm -lstdc++ ) install(TARGETS ${CMAKE_PROJECT_NAME})