tizen beta release
[framework/web/wrt-plugins-common.git] / CMakeLists.txt
1 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 #
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.
14 #
15 cmake_minimum_required(VERSION 2.6)
16
17 IF("${CMAKE_PROJECT_NAME}" STREQUAL "")
18     SET(CMAKE_PROJECT_NAME wrt-plugins-common)
19 ENDIF("${CMAKE_PROJECT_NAME}" STREQUAL "")
20
21 set(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
22
23 project(${CMAKE_PROJECT_NAME})
24
25 ################################################################################
26 # Required platform modules
27
28 include(FindPkgConfig)
29
30 pkg_search_module(dpl REQUIRED dpl-efl>=1.0.0)
31
32 include_directories(
33   ${dpl_INCLUDE_DIRS}
34 )
35
36
37 #
38 # Logs
39 #
40 OPTION(DPL_LOG "DPL logs status" ON)
41
42 IF(DPL_LOG)
43     MESSAGE(STATUS "Logging enabled for DPL")
44     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
45 ELSE(DPL_LOG)
46     MESSAGE(STATUS "Logging disabled for DPL")
47 ENDIF(DPL_LOG)
48
49
50 ###############################################################################
51 # Set build type (Release by default)
52 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
53      SET(CMAKE_BUILD_TYPE Release)
54 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
55
56 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
57
58 ##############################################################################
59 # Compiler flags
60 SET(CMAKE_C_FLAGS_PROFILING    "-O0 -g -pg")
61 SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -std=c++0x -g -pg")
62 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
63 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
64 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
65 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
66 ####
67
68 ADD_DEFINITIONS("-fvisibility=default")         # mark all exported symbols as visible
69 ADD_DEFINITIONS("-DEXPORT_API=")
70 ADD_DEFINITIONS("-Wall")
71 ADD_DEFINITIONS("-Werror")
72 ADD_DEFINITIONS("-Wextra")
73 ADD_DEFINITIONS("-Wno-deprecated")
74
75 #disable default singleton implementation
76 ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION")
77
78 ################################################################################
79 # Miscellaneous variables
80
81 set(CONFIG_FILE_NAME "config.cmake")
82 set(LIBS_COMMONS ${dpl_LDFLAGS} )
83
84 set(DESTINATION_LIB_PREFIX lib)
85 set(DESTINATION_HEADER_PREFIX include/${PROJECT_NAME})
86
87 set(DESTINATION_HEADERS_NON_JS ${DESTINATION_HEADER_PREFIX}/Commons)
88 set(DESTINATION_HEADERS_JS ${DESTINATION_HEADER_PREFIX}/CommonsJavaScript)
89
90 ################################################################################
91 # Target platform
92
93 if (NOT DEFINED PLATFORM)
94   set(PLATFORM "tizen")
95 endif ()
96
97 ################################################################################
98 # Macros used for including plugins from AL.
99
100
101 function(add_subdir NAME)
102   message(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}")
103   add_subdirectory(${NAME})
104 endfunction()
105
106 ################################################################################
107 # Subdirectories
108
109 add_subdirectory(src)
110 add_subdirectory(tests)
111
112 ################################################################################
113 # PKGCONFIG
114
115 set(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfigs)
116
117 macro(configure_and_install_pkg PKG_FILE)
118     CONFIGURE_FILE(${PKGCONFIG_DIR}/${PKG_FILE}.in
119                ${PKGCONFIG_DIR}/${PKG_FILE} @ONLY)
120     INSTALL(FILES ${PKGCONFIG_DIR}/${PKG_FILE} DESTINATION lib/pkgconfig)
121 endmacro(configure_and_install_pkg)
122
123 configure_and_install_pkg(wrt-plugins-commons-javascript.pc)
124 configure_and_install_pkg(wrt-plugins-commons.pc)
125 configure_and_install_pkg(wrt-plugins-filesystem.pc)
126 configure_and_install_pkg(wrt-plugins-camera.pc)
127 configure_and_install_pkg(wrt-plugins-messaging.pc)
128 configure_and_install_pkg(wrt-plugins-calendar.pc)
129 configure_and_install_pkg(wrt-plugins-haptics.pc)
130 configure_and_install_pkg(wrt-plugins-contact.pc)
131 configure_and_install_pkg(wrt-plugins-mmplayer.pc)
132 configure_and_install_pkg(wrt-plugins-widget.pc)
133 configure_and_install_pkg(wrt-plugins-cpu.pc)
134 configure_and_install_pkg(wrt-plugins-accelerometer.pc)
135 configure_and_install_pkg(wrt-plugins-task.pc)
136 configure_and_install_pkg(wrt-plugins-orientation.pc)
137 configure_and_install_pkg(wrt-plugins-radio.pc)
138 configure_and_install_pkg(wrt-plugins-power.pc)
139 configure_and_install_pkg(wrt-plugins-profile.pc)
140 configure_and_install_pkg(wrt-plugins-localstorage.pc)
141 configure_and_install_pkg(wrt-plugins-systeminfo.pc)
142 configure_and_install_pkg(wrt-plugins-widget_interface_dao.pc)
143 configure_and_install_pkg(wrt-plugins-storageevent.pc)
144 configure_and_install_pkg(wrt-plugins-widgetdb.pc)
145 configure_and_install_pkg(wrt-plugins-plugin-manager.pc)
146
147 ################################################################################
148 # Cache
149
150 set(PLATFORM "${PLATFORM}" CACHE STRING "Target platform" FORCE)
151 set(CMAKE_CONFIG_FILE_NAME "${CMAKE_CONFIG_FILE_NAME}" CACHE
152     STRING "CMake configuration file name." FORCE)
153
154
155 ################################################################################
156 # Summary
157
158 message(STATUS "PLATFORM = ${PLATFORM}")