-
Notifications
You must be signed in to change notification settings - Fork 85
/
CMakeLists.txt
56 lines (52 loc) · 1.97 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
file(GLOB data_files "${CMAKE_SOURCE_DIR}/data/*")
add_custom_command(OUTPUT _non_existant_file_so_we_always_run.txt "${CMAKE_SOURCE_DIR}/out/data.zip"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/data"
COMMAND ${CMAKE_COMMAND} -E tar "cvf" "${CMAKE_SOURCE_DIR}/out/data.zip" --format=zip .)
add_custom_target(data_zip
DEPENDS _non_existant_file_so_we_always_run.txt)
if(CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL iOS OR CMAKE_SYSTEM_NAME STREQUAL Emscripten)
if (CMAKE_HOST_WIN32)
add_custom_target(embedded_data_zip_header
DEPENDS data_zip
COMMAND ${CMAKE_SOURCE_DIR}/tools/cembed/win64/cembed.exe ${CMAKE_SOURCE_DIR}/out/data.zip > ${CMAKE_SOURCE_DIR}/src/common/data_zip.h)
elseif(CMAKE_HOST_APPLE)
add_custom_target(embedded_data_zip_header
DEPENDS data_zip
COMMAND ${CMAKE_SOURCE_DIR}/tools/cembed/osx/cembed ${CMAKE_SOURCE_DIR}/out/data.zip > ${CMAKE_SOURCE_DIR}/src/common/data_zip.h)
elseif(CMAKE_HOST_UNIX)
add_custom_target(embedded_data_zip_header
DEPENDS data_zip
COMMAND ${CMAKE_SOURCE_DIR}/tools/cembed/linux/cembed ${CMAKE_SOURCE_DIR}/out/data.zip > ${CMAKE_SOURCE_DIR}/src/common/data_zip.h)
endif()
endif()
add_library(common STATIC
alloc.c
audio.c
base64.c
bvh.c
data.c
debug_console.c
file.c
graphics.c
inputs.c
json.c
level.c
log.c
level.c
map.c
maths.c
script.c
storage.c
string.c
thread.c
vec.c)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
target_compile_options(common PRIVATE /W3)
elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
target_compile_options(common PRIVATE -Wall -Wextra -Wpedantic)
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
target_compile_options(common PRIVATE -x objective-c)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL iOS OR CMAKE_SYSTEM_NAME STREQUAL Emscripten)
add_dependencies(common embedded_data_zip_header)
endif()