-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
122 lines (106 loc) · 2.49 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
cmake_minimum_required(VERSION 3.14)
project(
mesh-parameterize
VERSION 0.4.0
LANGUAGES C CXX
)
#
# Global config
#
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
list(
PREPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake"
)
# Show download progress
set(FETCHCONTENT_QUIET FALSE)
#
# Main target
#
set(app_name mesh-parameterize)
add_executable(
${app_name}
"src/assets.cpp"
"src/graphics.c"
"src/graphics.cpp"
"src/impl.cpp"
"src/main.cpp"
"src/scene.cpp"
"src/tasks.cpp"
)
include(deps/dr-app)
include(deps/dr-eigs)
include(deps/happly)
include(deps/stb-image)
target_link_libraries(
${app_name}
PRIVATE
dr::app
dr::eigs
happly::happly
stb::image
)
target_compile_options(
${app_name}
PRIVATE
-Wall -Wextra -Wpedantic -Werror
)
if(EMSCRIPTEN)
# Emscripten compiler options
target_link_options(
${app_name}
PRIVATE
"-sUSE_WEBGL2=1"
"-sALLOW_MEMORY_GROWTH"
"-sFORCE_FILESYSTEM=1"
"-sPTHREAD_POOL_SIZE_STRICT=1"
"-sPTHREAD_POOL_SIZE=1" # Mirrors arg passed to thread_pool_start
"-sALLOW_BLOCKING_ON_MAIN_THREAD=0"
"-sSTACK_SIZE=1mb" # https://groups.google.com/g/emscripten-discuss/c/MgHWuq2oq7Q
"$<$<CONFIG:Debug>:-sASSERTIONS=2>"
"$<$<CONFIG:Debug>:-sSTACK_OVERFLOW_CHECK=2>"
"$<$<CONFIG:Debug>:-sPTHREADS_DEBUG=1>"
"$<$<CONFIG:Debug>:-gsource-map>"
"$<$<CONFIG:Debug>:--threadprofiler>"
)
endif()
#
# Post-build commands
#
include(app-utils)
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(gen_dir "${CMAKE_CURRENT_BINARY_DIR}/gen")
get_default_runtime_output_dir(runtime_output_dir)
set(
glsl_files
"${src_dir}/assets/shaders/matcap_debug.frag.glsl"
"${src_dir}/assets/shaders/matcap_debug.vert.glsl"
# ...
)
set(gen_asset_files)
convert_shaders(gen_asset_files)
# ...
set(
asset_files
"${src_dir}/assets/images/matcap-white-soft.png"
"${src_dir}/assets/models/human-head.ply"
"${src_dir}/assets/models/pig-head.ply"
"${src_dir}/assets/models/camel-head.ply"
"${src_dir}/assets/models/ogre-face.ply"
"${src_dir}/assets/models/vw-bug.ply"
# ...
${gen_asset_files}
)
if(EMSCRIPTEN)
set(
web_files
"${src_dir}/web/index.html"
"${src_dir}/web/coi-serviceworker.js"
# ...
)
copy_web_files()
package_assets()
else()
copy_assets()
endif()