-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
73 lines (49 loc) · 1.38 KB
/
CMakeLists.txt
File metadata and controls
73 lines (49 loc) · 1.38 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.14)
project(project)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
file(GLOB shaders CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/src/*.glsl"
)
set(fths "C:\\file_to_header_string\\out\\fths")
foreach(shader ${shaders})
get_filename_component(shader_name ${shader} NAME_WE)
set(header_name ${CMAKE_BINARY_DIR}/${shader_name}.h)
add_custom_target(prebuild_${shader_name} ALL
COMMAND ${fths} ${shader}
)
list(APPEND sources ${header_name})
endforeach()
set(OUT "${CMAKE_SOURCE_DIR}/out")
add_compile_options(-fdeclspec)
add_library(includes INTERFACE)
target_include_directories(includes INTERFACE
${CMAKE_SOURCE_DIR}/src/
${CMAKE_BINARY_DIR}#?
)
file(GLOB_RECURSE sources
"${CMAKE_SOURCE_DIR}/src/*.cpp"
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUT})
add_executable(main ${sources})
set_target_properties(main PROPERTIES SUFFIX ".html")
target_link_libraries(main PRIVATE
includes
)
file(COPY "${CMAKE_SOURCE_DIR}/src/shell.html" DESTINATION "${CMAKE_BINARY_DIR}")
target_link_options(main PRIVATE
--shell-file shell.html
-Wno-deprecated-declarations
-Wno-unused-variable
-Wno-unused-function
-sWASM=1
-sEXPORT_ALL=1
-sERROR_ON_UNDEFINED_SYMBOLS=0
-sUSE_SDL=2
-sUSE_SDL_TTF=2
-sUSE_WEBGL2=1
-sMIN_WEBGL_VERSION=2
-sMAX_WEBGL_VERSION=2
-sFULL_ES3
-fPIC
)