0032315: Configuration, CMake - fix building Draw Harness plugins as static libraries
[occt.git] / src / DRAWEXE / CMakeLists.txt
1 project(DRAWEXE)
2
3 unset (CUSTOM_EXTERNLIB)
4 if (NOT BUILD_SHARED_LIBS)
5   # link specific list of plugins explicitly
6   FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB_STATIC" CUSTOM_EXTERNLIB)
7   if (USE_OPENGL)
8     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGles)
9     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlesTest)
10     list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlesLibs)
11   elseif(USE_GLES2)
12     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGl)
13     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlTest)
14     list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlLibs)
15   else()
16     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGles)
17     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlesTest)
18     list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlesLibs)
19     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGl)
20     list (REMOVE_ITEM CUSTOM_EXTERNLIB TKOpenGlTest)
21     list (REMOVE_ITEM CUSTOM_EXTERNLIB CSF_OpenGlLibs)
22   endif()
23 endif()
24
25 set (EXECUTABLE_PROJECT ON)
26 OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
27 unset (EXECUTABLE_PROJECT)
28 unset (CUSTOM_EXTERNLIB)
29
30 if (EMSCRIPTEN)
31   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
32   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s MAX_WEBGL_VERSION=2")
33   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
34   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind")
35
36   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE=1")
37   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='createDRAWEXE'")
38
39   install(FILES ${PROJECT_NAME}.html      DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
40   install(FILES ../DrawResources/lamp.ico DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
41 endif()