Fixed not to sleep thread before it's terminated
[platform/core/uifw/dali-adaptor.git] / build / emscripten / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 if( ${EMSCRIPTEN} )
4   message("EMSCRIPTEN BUILD")
5   set(CMAKE_C_COMPILER "emcc")
6   set(CMAKE_CXX_COMPILER "em++")
7 else( ${EMSCRIPTEN} )
8   message( FATAL_ERROR "Native Build not supported via cmake." )
9 endif( ${EMSCRIPTEN} )
10
11 if(NOT DEFINED ENV{DESKTOP_PREFIX})
12   message( FATAL_ERROR "DESKTOP_PREFIX is required to build adaptor against dali-core. Please make sure you have sourced your setenv script (created by dali_env)." )
13 endif()
14
15 project(dali-emscripten CXX)
16
17 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
18
19 set(SRCS
20   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/actor-wrapper.cpp
21   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/animation-wrapper.cpp
22   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/dali-wrapper.cpp
23   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/emscripten-utils.cpp
24   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/handle-wrapper.cpp
25   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/image-wrapper.cpp
26   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/property-buffer-wrapper.cpp
27   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/property-value-wrapper.cpp
28   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/render-task-wrapper.cpp
29   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/shader-effect-wrapper.cpp
30   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/type-info-wrapper.cpp
31   ${CMAKE_SOURCE_DIR}/../../adaptors/base/separate-update-render/frame-time.cpp
32   ${CMAKE_SOURCE_DIR}/../../adaptors/base/time-service.cpp
33   ${CMAKE_SOURCE_DIR}/../../adaptors/common/gl/egl-image-extensions.cpp
34   ${CMAKE_SOURCE_DIR}/../../adaptors/common/gl/gl-extensions.cpp
35   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/egl-implementation-emscripten.cpp
36   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/main.cpp
37   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/sdl-application.cpp
38   ${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/sdl-gl-sync-abstraction.cpp
39   ${CMAKE_SOURCE_DIR}/../../platform-abstractions/emscripten/emscripten-callbacks.cpp
40   ${CMAKE_SOURCE_DIR}/../../platform-abstractions/emscripten/emscripten-platform-abstraction.cpp
41 )
42
43 include_directories(${CMAKE_SOURCE_DIR}/../../)
44 include_directories(${CMAKE_SOURCE_DIR}/../../adaptors/)
45 include_directories(${CMAKE_SOURCE_DIR}/../../adaptors/common)
46 include_directories(${CMAKE_SOURCE_DIR}/../../adaptors/tizen)
47 include_directories(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten)
48 include_directories(${CMAKE_SOURCE_DIR}/../../platform-abstractions/slp)
49
50 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/all.html all.html COPYONLY)
51 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-page.html dali-page.html COPYONLY)
52 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-tests.css dali-tests.css COPYONLY)
53 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-tests.html dali-tests.html COPYONLY)
54 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/geometry.js geometry.js COPYONLY)
55 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/properties.js properties.js COPYONLY)
56 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/signals.js signals.js COPYONLY)
57 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/math.js math.js COPYONLY)
58 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/animation.js animation.js COPYONLY)
59 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/utilities.js utilities.js COPYONLY)
60 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/shaders.js shaders.js COPYONLY)
61 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/views.js views.js COPYONLY)
62
63 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/qunit/qunit-1.21.0.css qunit-1.21.0.css COPYONLY)
64 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/qunit/qunit-1.21.0.js qunit-1.21.0.js COPYONLY)
65
66 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/dali-wrapper.js dali-wrapper.js COPYONLY)
67
68 set(VENDOR "samsung")
69 set(PACKAGE ${PROJECT_NAME})
70 set(DESKTOP_PREFIX $ENV{DESKTOP_PREFIX})
71 set(CPP_DEFINES -DDALI_GLES_VERSION=2)
72
73 set(EMSCRIPTEN_ENV_DIR ${DESKTOP_PREFIX}/share/emscripten)
74
75 set(DEBUG_FLAGS "-Wall -g -O2")
76 set(RELEASE_FLAGS "-Wall -g -O2")
77
78 if( ${EMSCRIPTEN} )
79  set(DEBUG_FLAGS "${DEBUG_FLAGS} -std=c++11 -DBOOST_ERROR_CODE_HEADER_ONLY")
80  set(RELEASE_FLAGS "${RELEASE_FLAGS} -std=c++11 -DBOOST_ERROR_CODE_HEADER_ONLY")
81 endif( ${EMSCRIPTEN} )
82
83
84 include(FindPkgConfig)
85
86 pkg_check_modules(pkgs REQUIRED
87   dali-core
88   # sdl from emscripten
89   )
90
91 if( ${EMSCRIPTEN} )
92
93 pkg_check_modules(pkgs REQUIRED
94   dali-core
95   # sdl from emscripten
96   )
97
98 else( ${EMSCRIPTEN} )
99
100 find_library(SDL VERSION "1.2" REQUIRED HINTS $DESKTOP_PREFIX/lib)
101 find_library(SDL REQUIRED)
102 find_library(SDL_image REQUIRED)
103
104 find_library(jpeg REQUIRED)
105 find_library(ft2build REQUIRED)
106 find_library(turbojpeg REQUIRED)
107
108 pkg_check_modules(pkgs REQUIRED
109   dali-core
110   # sdl from emscripten
111   sdl
112   egl
113   )
114
115 include_directories(/usr/local/include/SDL/)
116 set(LIBS ${LIBS} -lSDL -lSDL_image -lEGL -lGLESv2)
117
118 endif( ${EMSCRIPTEN} )
119
120 # non pkg config
121 include_directories(${DESKTOP_PREFIX}/include/)
122
123 add_definitions( ${CPP_DEFINES} ) # see configure_file() for *.in to *.h style
124
125 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
126 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
127
128 add_executable(${PROJECT_NAME} ${SRCS})
129
130 target_link_libraries(${PROJECT_NAME} ${pkgs_LDFLAGS} ${LIBS}) # "-lm"
131
132 # Copy dali-wrapper.js to dali-env
133 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/dali-wrapper.js ${EMSCRIPTEN_ENV_DIR}/dali-wrapper.js COPYONLY)
134
135 # tests
136 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/all.html ${EMSCRIPTEN_ENV_DIR}/all.html COPYONLY)
137 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-page.html ${EMSCRIPTEN_ENV_DIR}/dali-page.html COPYONLY)
138 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-tests.css ${EMSCRIPTEN_ENV_DIR}/dali-tests.css COPYONLY)
139 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/dali-tests.html ${EMSCRIPTEN_ENV_DIR}/dali-tests.html COPYONLY)
140 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/geometry.js ${EMSCRIPTEN_ENV_DIR}/geometry.js COPYONLY)
141 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/properties.js ${EMSCRIPTEN_ENV_DIR}/properties.js COPYONLY)
142 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/signals.js ${EMSCRIPTEN_ENV_DIR}/signals.js COPYONLY)
143 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/math.js ${EMSCRIPTEN_ENV_DIR}/math.js COPYONLY)
144 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/animation.js ${EMSCRIPTEN_ENV_DIR}/animation.js COPYONLY)
145 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/utilities.js ${EMSCRIPTEN_ENV_DIR}/utilities.js COPYONLY)
146 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/shaders.js ${EMSCRIPTEN_ENV_DIR}/shaders.js COPYONLY)
147 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/views.js ${EMSCRIPTEN_ENV_DIR}/views.js COPYONLY)
148
149 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/qunit/qunit-1.21.0.css ${EMSCRIPTEN_ENV_DIR}/qunit-1.21.0.css COPYONLY)
150 configure_file(${CMAKE_SOURCE_DIR}/../../adaptors/emscripten/wrappers/tests/qunit/qunit-1.21.0.js ${EMSCRIPTEN_ENV_DIR}/qunit-1.21.0.js COPYONLY)