-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
54 lines (50 loc) · 2.81 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
cmake_minimum_required(VERSION 3.1)
project(ARTOOLKITPLUS_EM)
set(CMAKE_CXX_STANDARD 17)
set(COMPRESSION_DEBUG_FLAG " -O0 ")
set(COMPRESSION_RELEASE_FLAG " -Oz ")
set(DEBUG_FLAGS " -g -sASSERTIONS=1 --profiling -s DEMANGLE_SUPPORT=1 ")
set(ES6_BUILD " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -sEXPORT_NAME=ARtoolKitPlus -s MODULARIZE=1 ")
set(ES6_BUILD_SM " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -sEXPORT_NAME=TrackerSingleMarker -s MODULARIZE=1 ")
set(MEMORY_OPTION " -s TOTAL_MEMORY=268435456 -s ALLOW_MEMORY_GROWTH=1 ")
set(FLAGS " -sFORCE_FILESYSTEM -s EXPORTED_RUNTIME_METHODS=['FS'] ")
set(INCLUDES " -I../emscripten/artoolkitplus ")
set(LINK_LIBS " ./emscripten/artoolkitplus/lib/libARToolKitPlus.a ")
set(SINGLE_FILE " -s SINGLE_FILE=1")
if(LINK_LIBS)
message("libARToolKitPlus already commpiled!")
else()
message("compiling libARToolKitPlus!")
add_subdirectory(emscripten/artoolkitplus)
endif()
include_directories(emscripten/artoolkitplus/include)
# different commands for Debug or Release mode.
if(CMAKE_BUILD_TYPE STREQUAL Release)
add_executable(artoolkitplus_em_ES6 emscripten/artoolkitplus_em.cpp )
if(!LINK_LIBS)
add_dependencies(artoolkitplus_em_ES6 ARToolKitPlus)
target_link_libraries(artoolkitplus_em_ES6 ${ARToolKitPlus} )
endif()
set_target_properties(artoolkitplus_em_ES6 PROPERTIES LINK_FLAGS " ${COMPRESSION_RELEASE_FLAG} ${MEMORY_OPTION} ${INCLUDES} ${SRC} ${LINK_LIBS} --bind ${ES6_BUILD} ${SINGLE_FILE} ")
add_executable(trackerSM_ES6 emscripten/trackerSM.cpp)
if(!LINK_LIBS)
add_dependencies(trackerSM_ES6 ARToolKitPlus)
target_link_libraries(trackerSM_ES6 ${ARToolKitPlus} )
endif()
set_target_properties(trackerSM_ES6 PROPERTIES LINK_FLAGS " ${COMPRESSION_RELEASE_FLAG} ${MEMORY_OPTION} ${INCLUDES} ${SRC} ${LINK_LIBS} --bind ${ES6_BUILD_SM} ${SINGLE_FILE} ${FLAGS} ")
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
add_executable(artoolkitplus_em_ES6_debug emscripten/artoolkitplus_em.cpp )
if(!LINK_LIBS)
add_dependencies(artoolkitplus_em_ES6_debug ARToolKitPlus)
target_link_libraries(artoolkitplus_em_ES6_debug ${ARToolKitPlus} )
endif()
set_target_properties(artoolkitplus_em_ES6_debug PROPERTIES LINK_FLAGS " ${COMPRESSION_DEBUG_FLAG} ${MEMORY_OPTION} ${DEBUG_FLAGS} ${INCLUDES} ${SRC} ${LINK_LIBS} --bind ${ES6_BUILD} ${SINGLE_FILE} ")
add_executable(trackerSM_ES6_debug emscripten/trackerSM.cpp )
if(!LINK_LIBS)
add_dependencies(trackerSM_ES6_debug ARToolKitPlus)
target_link_libraries(trackerSM_ES6_debug ${ARToolKitPlus} )
endif()
set_target_properties(trackerSM_ES6_debug PROPERTIES LINK_FLAGS " ${COMPRESSION_DEBUG_FLAG} ${MEMORY_OPTION} ${DEBUG_FLAGS} ${INCLUDES} ${SRC} ${LINK_LIBS} --bind ${ES6_BUILD_SM} ${SINGLE_FILE} ${FLAGS} ")
else()
message("Unsupported build type")
endif()