Support for building Node Addon for target
[platform/core/uifw/dali-toolkit.git] / node-addon / build / tizen / CMakeLists.txt
1 # Guide to build for GBS
2 # Build dali-toolkit with gbs, the dali-addon will be built automatically
3 #
4 # To build for Desktop
5 # option 1 (easy):  in node-addon folder type
6 #
7 # $ node-gyp build
8 #
9 # option 2: use cmake
10 # This relies on Node source being downloaded ( don't forget the dot)
11 #
12 # cmake -DDesktopNodePath:String=/home/Downloads/node-v0.12.4 .
13
14
15 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
16 PROJECT(dali_addon)
17 set(configuration "Default")
18 enable_language(ASM)
19 set(builddir "${CMAKE_BINARY_DIR}")
20 set(obj "${builddir}/obj")
21
22 set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
23 set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
24
25 option(GBSBuild "GBSBuild" 0)
26 option(DesktopNodePath "DesktopNodePath" "")
27
28 IF( ${GBSBuild} )
29   set( NODE_HEADERS "/usr/include/node" )
30   set( V8_HEADERS "/usr/include/node" )
31   MESSAGE("Performing a GBS build, ensure Node JS devel RPM is installed")
32   MESSAGE("node.h and v8.h should exist in ${NODE_HEADERS}")
33 ELSE()
34   MESSAGE("Performing Desktop build node path =${DesktopNodePath}")
35   IF( NOT DesktopNodePath )
36     MESSAGE(FATAL_ERROR "\n Node JS Source code path empty, please specify,e.g. \n cmake -DDesktopNodePath:String=~/Downloads/node-v0.12.4/  .")
37   ENDIF( NOT DesktopNodePath )
38   set( NODE_HEADERS "${DesktopNodePath}/src" )
39   set( V8_HEADERS   "${DesktopNodePath}/deps/v8/include" )
40   MESSAGE( "-- Node include header location = ${NODE_HEADERS} ")
41   MESSAGE( "-- V8 include header location = ${V8_HEADERS} ")
42 ENDIF( ${GBSBuild})
43
44 set(TARGET "dali_addon")
45 set(TOOLSET "target")
46 set(PLUGING_SRC_DIR "../../../plugins/dali-script-v8/src")
47 set(NODE_ADDON_SRC "../..")
48 add_library(dali_addon SHARED
49   ${NODE_ADDON_SRC}/dali-addon.cpp
50   ${NODE_ADDON_SRC}/javascript-application-options.cpp
51   ${PLUGING_SRC_DIR}/utils/v8-utils.cpp
52   ${PLUGING_SRC_DIR}/dali-wrapper.cpp
53   ${PLUGING_SRC_DIR}/shared/base-wrapped-object.cpp
54   ${PLUGING_SRC_DIR}/shared/object-template-helper.cpp
55   ${PLUGING_SRC_DIR}/actors/actor-wrapper.cpp
56   ${PLUGING_SRC_DIR}/actors/actor-api.cpp
57   ${PLUGING_SRC_DIR}/actors/layer-api.cpp
58   ${PLUGING_SRC_DIR}/actors/camera-actor-api.cpp
59   ${PLUGING_SRC_DIR}/constants/constants-wrapper.cpp
60   ${PLUGING_SRC_DIR}/animation/animation-api.cpp
61   ${PLUGING_SRC_DIR}/animation/animation-wrapper.cpp
62   ${PLUGING_SRC_DIR}/animation/constrainer-api.cpp
63   ${PLUGING_SRC_DIR}/animation/linear-constrainer-wrapper.cpp
64   ${PLUGING_SRC_DIR}/animation/path-api.cpp
65   ${PLUGING_SRC_DIR}/animation/path-constrainer-wrapper.cpp
66   ${PLUGING_SRC_DIR}/animation/path-wrapper.cpp
67   ${PLUGING_SRC_DIR}/stage/stage-wrapper.cpp
68   ${PLUGING_SRC_DIR}/events/event-object-generator.cpp
69   ${PLUGING_SRC_DIR}/events/pan-gesture-detector-api.cpp
70   ${PLUGING_SRC_DIR}/events/pan-gesture-detector-wrapper.cpp
71   ${PLUGING_SRC_DIR}/stage/stage-api.cpp
72   ${PLUGING_SRC_DIR}/image/image-wrapper.cpp
73   ${PLUGING_SRC_DIR}/image/image-api.cpp
74   ${PLUGING_SRC_DIR}/image/buffer-image-api.cpp
75   ${PLUGING_SRC_DIR}/image/frame-buffer-image-api.cpp
76   ${PLUGING_SRC_DIR}/image/resource-image-api.cpp
77   ${PLUGING_SRC_DIR}/object/handle-wrapper.cpp
78   ${PLUGING_SRC_DIR}/object/property-buffer-api.cpp
79   ${PLUGING_SRC_DIR}/object/property-buffer-wrapper.cpp
80   ${PLUGING_SRC_DIR}/object/property-value-wrapper.cpp
81   ${PLUGING_SRC_DIR}/signals/signal-manager.cpp
82   ${PLUGING_SRC_DIR}/render-tasks/render-task-list-api.cpp
83   ${PLUGING_SRC_DIR}/render-tasks/render-task-list-wrapper.cpp
84   ${PLUGING_SRC_DIR}/render-tasks/render-task-api.cpp
85   ${PLUGING_SRC_DIR}/render-tasks/render-task-wrapper.cpp
86   ${PLUGING_SRC_DIR}/rendering/geometry-api.cpp
87   ${PLUGING_SRC_DIR}/rendering/geometry-wrapper.cpp
88   ${PLUGING_SRC_DIR}/rendering/material-api.cpp
89   ${PLUGING_SRC_DIR}/rendering/material-wrapper.cpp
90   ${PLUGING_SRC_DIR}/rendering/renderer-api.cpp
91   ${PLUGING_SRC_DIR}/rendering/renderer-wrapper.cpp
92   ${PLUGING_SRC_DIR}/rendering/sampler-api.cpp
93   ${PLUGING_SRC_DIR}/rendering/sampler-wrapper.cpp
94   ${PLUGING_SRC_DIR}/rendering/shader-api.cpp
95   ${PLUGING_SRC_DIR}/rendering/shader-wrapper.cpp
96   ${PLUGING_SRC_DIR}/toolkit/builder/builder-api.cpp
97   ${PLUGING_SRC_DIR}/toolkit/builder/builder-wrapper.cpp
98   ${PLUGING_SRC_DIR}/toolkit/focus-manager/keyboard-focus-manager-api.cpp
99   ${PLUGING_SRC_DIR}/toolkit/focus-manager/keyboard-focus-manager-wrapper.cpp
100   ${PLUGING_SRC_DIR}/signals/dali-any-javascript-converter.cpp
101   ${PLUGING_SRC_DIR}/garbage-collector/garbage-collector.cpp
102   ${PLUGING_SRC_DIR}/module-loader/module.cpp
103   ${PLUGING_SRC_DIR}/module-loader/module-loader.cpp
104 )
105 set_target_properties(dali_addon PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${builddir}/lib.${TOOLSET}")
106 set_target_properties(dali_addon PROPERTIES PREFIX "")
107 set_target_properties(dali_addon PROPERTIES LIBRARY_OUTPUT_NAME "dali")
108 set_target_properties(dali_addon PROPERTIES SUFFIX ".node")
109 set_source_files_properties(${builddir}/lib.${TOOLSET}/dali.node PROPERTIES GENERATED "TRUE")
110 set_target_properties(dali_addon PROPERTIES EXCLUDE_FROM_ALL "FALSE")
111
112
113 SET(PKG_LIST dali
114              dali-toolkit)
115
116 INCLUDE(FindPkgConfig)
117 pkg_check_modules(REQUIRED_PKGS REQUIRED ${PKG_LIST})
118
119 # This is just pulling out dali / dali-toolkit header locations from pkg-config
120 FOREACH(flag ${REQUIRED_PKGS_CFLAGS})
121         SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}")
122 ENDFOREACH(flag)
123
124 # Set the include paths to include dali, dali-core, node, v8 and headers for dali-addon
125 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${REQUIRED_CFLAGS} -I${PLUGING_SRC_DIR}/utils -I${PLUGING_SRC_DIR}  -I${NODE_HEADERS} -I ${V8_HEADERS}")
126
127 set_target_properties(dali_addon PROPERTIES COMPILE_FLAGS "-fPIC -frtti -fexceptions")
128
129 # This sets up the linker flags for dali-core/ adaptor and toolkit
130 # we don't need any flags for node / v8 as we're running inside node and v8 is statically linked to it
131 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS})
132
133 # ${CMAKE_INSTALL_PREFIX}
134 #################################### install #####################################
135 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX} )
136
137 unset(TOOLSET)
138 unset(TARGET)