forked from fritzo/jenn3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (59 loc) · 1.75 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
cmake_minimum_required(VERSION 3.11)
project(jenn3d)
set(CMAKE_CXX_STANDARD 17)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if (CMAKE_BUILD_TYPE MATCHES Release)
message(STATUS "Release build")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -fomit-frame-pointer -funroll-loops -pipe -s")
elseif (CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Debug build")
add_compile_definitions(DEBUG_LEVEL=2)
endif ()
add_executable(
${PROJECT_NAME}
main.C main.h
definitions.C definitions.h
linalg.C linalg.h
todd_coxeter.C todd_coxeter.h
go_game.C go_game.h
drawing.C drawing.h
trail.C trail.h
animation.C animation.h
projection.C projection.h
menus.C menus.h
polytopes.C polytopes.h
aligned_alloc.C aligned_alloc.h
aligned_vect.h
glut_wasm.h
)
if (EMSCRIPTEN)
message(STATUS "WebAssembly build enabled")
set_target_properties(
${PROJECT_NAME}
PROPERTIES SUFFIX ".js"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/web
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/web
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/web
LINK_FLAGS "\
--bind \
-s WASM=1 \
-s LEGACY_GL_EMULATION=1 \
-s ENVIRONMENT=web \
-s MAX_WEBGL_VERSION=2 \
"
)
else ()
message(STATUS "WebAssembly build not enabled")
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(PNG)
target_link_libraries(${PROJECT_NAME} OpenGL::GL GLUT::GLUT)
if (PNG_FOUND)
target_link_libraries(${PROJECT_NAME} PNG::PNG)
add_compile_definitions(CAPTURE=4)
else ()
message(STATUS "libpng library not found")
endif ()
endif ()