Fixed problem with running tests
[platform/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 SET(CMAKE_PROJECT_NAME wrt-plugins-common)
18 set(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
19 project(${CMAKE_PROJECT_NAME})
20 STRING(REGEX MATCH "([^.]*)" CMAKE_PROJECT_API_VERSION "${CMAKE_PROJECT_VERSION}")
21
22 ################################################################################
23 # Required platform modules
24
25 include(FindPkgConfig)
26
27 pkg_search_module(dpl REQUIRED dpl-efl>=0.2.21)
28
29 include_directories(
30   ${dpl_INCLUDE_DIRS}
31 )
32
33
34
35 ##############################################################################
36 # Build type
37 IF(NOT CMAKE_BUILD_TYPE)
38     SET(CMAKE_BUILD_TYPE "Release")
39 ENDIF(NOT CMAKE_BUILD_TYPE)
40
41 # Compiler flags
42 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
43 SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++0x")
44 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
45 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
46 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
47 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
48 SET(CMAKE_CXX_FLAGS_CCOV       "-O0 -std=c++0x -g --coverage")
49 ####
50
51 OPTION(DPL_LOG "DPL logs status" ON)
52 IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
53     MESSAGE(STATUS "Logging enabled for DPL")
54     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
55 ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
56     MESSAGE(STATUS "Logging disabled for DPL")
57 ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
58
59 ADD_DEFINITIONS("-fPIC")
60 ADD_DEFINITIONS("-fvisibility=default")         # mark all exported symbols as visible
61 ADD_DEFINITIONS("-fPIC")                        # If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding
62 ADD_DEFINITIONS("-DEXPORT_API=")
63 ADD_DEFINITIONS("-Wall")
64 #ADD_DEFINITIONS("-Werror")
65 ADD_DEFINITIONS("-Wextra")
66 ADD_DEFINITIONS("-Wno-deprecated")
67 #ADD_DEFINITIONS("-DDEVPKG")
68
69 ##############################################################################
70 # CMake flags
71 IF (DEVPKG)
72     SET(DEVPKG "ON")
73 ENDIF(DEVPKG)
74
75 ################################################################################
76 # Miscellaneous variables
77
78 set(CONFIG_FILE_NAME "config.cmake")
79 set(LIBS_COMMONS ${dpl_LDFLAGS} )
80
81 set(DESTINATION_LIB_PREFIX lib)
82 set(DESTINATION_HEADER_PREFIX include/${PROJECT_NAME})
83
84 set(DESTINATION_HEADERS_NON_JS ${DESTINATION_HEADER_PREFIX}/Commons)
85 set(DESTINATION_HEADERS_JS ${DESTINATION_HEADER_PREFIX}/CommonsJavaScript)
86 set(DESTINATION_HEADERS_JS_OVERLAY ${DESTINATION_HEADER_PREFIX}/js-overlay)
87 set(DESTINATION_HEADERS_WRT_POPUP_RUNNER ${DESTINATION_HEADER_PREFIX}/popup-runner)
88
89 ################################################################################
90 # Target platform
91
92 if (NOT DEFINED PLATFORM)
93   set(PLATFORM "tizen")
94 endif ()
95
96 ################################################################################
97 # Schema of plugin's configuration file
98
99 set(COMMON_CONFIG_DTD ${CMAKE_CURRENT_SOURCE_DIR}/config.dtd)
100 set(COMMON_CONFIG_DTD_DST /usr/etc/wrt-plugins)
101 INSTALL(FILES ${COMMON_CONFIG_DTD} DESTINATION ${COMMON_CONFIG_DTD_DST})
102
103 ################################################################################
104 # Macros used for including plugins from AL.
105
106
107 function(add_subdir NAME)
108   message(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}")
109   add_subdirectory(${NAME})
110 endfunction()
111
112 ################################################################################
113 # Subdirectories
114
115 add_subdirectory(src)
116
117 ################################################################################
118 # PKGCONFIG
119
120 set(PKGCONFIG_DIR ${PROJECT_SOURCE_DIR}/pkgconfigs)
121
122 macro(configure_and_install_pkg PKG_FILE)
123     CONFIGURE_FILE(${PKGCONFIG_DIR}/${PKG_FILE}.in
124                ${PKGCONFIG_DIR}/${PKG_FILE} @ONLY)
125     INSTALL(FILES ${PKGCONFIG_DIR}/${PKG_FILE} DESTINATION lib/pkgconfig)
126 endmacro(configure_and_install_pkg)
127
128 configure_and_install_pkg(wrt-plugins-commons-javascript.pc)
129 configure_and_install_pkg(wrt-plugins-commons.pc)
130 configure_and_install_pkg(wrt-plugins-filesystem.pc)
131 configure_and_install_pkg(wrt-plugins-widget-interface-dao.pc)
132 configure_and_install_pkg(wrt-plugins-widgetdb.pc)
133 configure_and_install_pkg(wrt-plugins-plugin-manager.pc)
134 configure_and_install_pkg(wrt-plugin-loading.pc)
135 configure_and_install_pkg(wrt-plugin-js-overlay.pc)
136 configure_and_install_pkg(wrt-popup-runner.pc)
137 configure_and_install_pkg(wrt-plugins-api-support.pc)
138
139 ################################################################################
140 # Cache
141
142 set(PLATFORM "${PLATFORM}" CACHE STRING "Target platform" FORCE)
143 set(CMAKE_CONFIG_FILE_NAME "${CMAKE_CONFIG_FILE_NAME}" CACHE
144     STRING "CMake configuration file name." FORCE)
145
146
147 ################################################################################
148 # Summary
149
150 message(STATUS "PLATFORM = ${PLATFORM}")