-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt
33 lines (22 loc) · 1.08 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
cmake_minimum_required( VERSION 3.1 )
project( WASM_AR )
set( CMAKE_CXX_STANDARD 11 )
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
set( CMAKE_CXX_FLAGS_RELEASE "-g -Wall -O3" )
set( JS ${CMAKE_SOURCE_DIR}/js )
file( MAKE_DIRECTORY ${JS} )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${JS} )
set( BUILD_WASM opencv/build_wasm )
set( SRC_DIR emscripten )
include_directories( opencv/include )
include_directories( ${BUILD_WASM} )
file( GLOB opencv_include_modules "opencv/modules/*/include" )
include_directories( ${opencv_include_modules} )
file( GLOB opencv_js "${BUILD_WASM}/lib/*.a" )
include_directories( ${SRC_DIR} )
file( GLOB WASMAR_SRCS ${SRC_DIR}/*.cpp )
add_executable( img_tracker_wasm ${SRC_DIR}/img_tracker_wasm.cpp ${WASMAR_SRCS} )
target_link_libraries( img_tracker_wasm ${opencv_js} )
set_target_properties( img_tracker_wasm PROPERTIES LINK_FLAGS "-s EXPORT_NAME='ImageTrackerWASM' -s USE_ZLIB=1 -s MODULARIZE=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS='['_malloc', '_free']' -s EXPORTED_RUNTIME_METHODS='['cwrap', 'getValue']' -s WASM=1" )