forked from SteffenBauer/PocketPuzzles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (64 loc) · 2.04 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.21)
# Do not pollute the source
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message( FATAL_ERROR [=[
In-source builds not allowed!
Please make a new directory, like (called a build directory)
and run cmake from there.
You may need to remove CMakeCache.txt and CMakeFiles directory.
Example:
rm -rf CMakeCache.txt CMakeFiles ; mkdir -p build ; cd build ; cmake .. ; cmake --build .
]=] )
endif()
# Where to build the targets
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
# Include the SDK
include("${CMAKE_TOOLCHAIN_FILE}")
# Where to find pbres
string(REGEX REPLACE "[^/]+$" "pbres" PBRES "${CMAKE_C_COMPILER}")
# Add the standard link directories
link_directories("${PB_LINK_DIRECTORIES}")
# Add the standard include directories
include_directories("${PB_INCLUDE_DIRECTORIES}")
include_directories("${FREETYPE_INCLUDE_DIRS}")
# set the project name
project(SGTPuzzles)
# Get today's date into ${TODAY}
execute_process(
COMMAND date +%Y-%m-%d
OUTPUT_VARIABLE TODAY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get git description into ${GIT_VERSION}
execute_process(
COMMAND git describe --always --tags
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Add the puzzle's include directories
include_directories(include include/frontend)
# Get all sources
# Note: According to cmake's description this is not
# a recommended way to add source files
aux_source_directory(games gameSrcs)
aux_source_directory(utils utilSrcs)
aux_source_directory(frontend frontendSrcs)
# Generate the icons.c
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/auxsrc/icons.c
COMMAND mkdir -p "${CMAKE_BINARY_DIR}/auxsrc"
COMMAND ${PBRES} -c ${CMAKE_BINARY_DIR}/auxsrc/icons.c -4 "${CMAKE_SOURCE_DIR}/icons/*/*.bmp"
)
add_executable(SGTPuzzles.app
${CMAKE_BINARY_DIR}/auxsrc/icons.c
${gameSrcs}
${utilSrcs}
${frontendSrcs}
)
target_link_libraries(SGTPuzzles.app inkview freetype m)
target_compile_definitions(SGTPuzzles.app
PUBLIC
VERSION="${TODAY}-${GIT_VERSION}"
COMBINED
)