-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (39 loc) · 1.99 KB
/
CMakeLists.txt
File metadata and controls
58 lines (39 loc) · 1.99 KB
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
cmake_minimum_required(VERSION 3.16)
project("game")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
file(GLOB src "source/*.cpp" "source/*.h")
add_executable(game ${src} "source/image.h" "source/utils.cpp" "source/image.cpp" "source/pixel.h" "source/pixel.cpp" "source/display.h" "source/display.cpp" "source/light.cpp" "source/light.h" "source/utils.h" source/color.h source/color.cpp)
set_property(TARGET game PROPERTY CXX_STANDARD 20)
target_include_directories(game PRIVATE source)
add_library(gmtl INTERFACE)
target_include_directories(gmtl INTERFACE extern/gmtl/)
add_subdirectory(extern)
get_property(has_sfml GLOBAL PROPERTY sfml_found)
if (${has_sfml})
message("sfml found setting has_sfml")
target_compile_definitions(game PRIVATE HAS_SFML=1)
target_link_libraries(game sfml-alias-target)
else ()
message("no sfml found")
endif ()
target_link_libraries(game gmtl)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
if (EMSCRIPTEN)
IF (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo OR CMAKE_BUILD_TYPE MATCHES Release)
target_compile_options(game PRIVATE -O3 -ffast-math -fno-exceptions)
target_link_options(game PRIVATE -O3)
ELSE ()
target_compile_options(game PRIVATE -gsource-map -g3)
target_link_options(game PRIVATE -gsource-map -g3 -sASSERTIONS=1)
message("compiling for debug")
endif ()
target_compile_options(game PRIVATE -fno-rtti -pthread)
target_link_options(game PRIVATE --preload-file /home/henry/renderer/head.obj@/head.obj -pthread -sPTHREAD_POOL_SIZE=5)
target_link_options(game PRIVATE -sNO_EXIT_RUNTIME=1)
target_link_options(game PRIVATE -sEXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap','UTF8ToString'])
target_link_options(game PRIVATE --source-map-base=http://localhost:4000/cmake-build-emscripten/)
target_link_options(game PRIVATE -sTOTAL_MEMORY=50MB)
set(CMAKE_EXECUTABLE_SUFFIX ".js")
set_target_properties (game PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/ui)
endif ()