CMakeLists.txt 1.56 KB
Newer Older
ForkCreativeMedia's avatar
ForkCreativeMedia committed
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
cmake_minimum_required (VERSION 3.1.3) 

if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
  message(FATAL_ERROR "In-source builds not allowed. Please delete CMakeCache.txt and CMakeFiles folder from the source directory.")
endif()

set(PACKAGE_NAME "basic_web_demos")
set(EXPORT_NAME ${PACKAGE_NAME}-targets)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(INCLUDE_INSTALL_DIR "include")
set(LIB_INSTALL_DIR "lib")
set(BIN_INSTALL_DIR "bin")
set(CMAKE_CONFIG_INSTALL_DIR "cmake")

project(${PACKAGE_NAME}) 

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

#Global settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(BUILD_WASM "Build WebAssembly demos" FALSE)

 if(BUILD_WASM)
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
  else()
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=0")
   endif()

if(WIN32)
  option(BUILD_USE_SOLUTION_FOLDERS "Usage of solution folders in visual studio" ON)
  set_property(GLOBAL PROPERTY USE_FOLDERS ${BUILD_USE_SOLUTION_FOLDERS})
endif()

#----------------------------------------------------------------------------------------------------------------------------

add_subdirectory(demos)	

include(CMakePackageConfigHelpers)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION bin/data)

 if(BUILD_WASM)
  install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION bin/data/js FILES_MATCHING PATTERN "*.wasm") 
 endif()