joeydev/CMakeLists.txt

83 lines
2.2 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)
project(joeydev C)
set(CMAKE_C_STANDARD 99)
set(SOURCE_FILES
src/main.c
src/utils.c
src/joeydev.c
src/vector.c
src/array.c
src/draw.c
src/image.c
src/vecparse.c
)
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}"
)
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(
include
ui/generated
thirdparty/scintilla/include
thirdparty/lexilla/include
)
add_definitions(
-Wall
-O0
${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++
)