Add default Smack manifest for wrt-plugins-common.spec
[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 # Compiler flags
35 SET(CMAKE_BUILD_TYPE Release)
36 SET(CMAKE_C_FLAGS_PROFILING    "-O0 -g -pg")
37 SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -std=c++0x -g -pg")
38 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
39 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
40 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
41 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -std=c++0x -g")
42 ####
43
44 OPTION(DPL_LOG "DPL logs status" ON)
45 IF(DPL_LOG)
46     MESSAGE(STATUS "Logging enabled for DPL")
47     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
48 ELSE(DPL_LOG)
49     MESSAGE(STATUS "Logging disabled for DPL")
50 ENDIF(DPL_LOG)
51
52 ADD_DEFINITIONS("-fvisibility=default")         # mark all exported symbols as visible
53 ADD_DEFINITIONS("-fPIC")                        # If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding
54 ADD_DEFINITIONS("-DEXPORT_API=")
55 ADD_DEFINITIONS("-Wall")
56 #ADD_DEFINITIONS("-Werror")
57 ADD_DEFINITIONS("-Wextra")
58 ADD_DEFINITIONS("-Wno-deprecated")
59 ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION")
60 #ADD_DEFINITIONS("-DW3C_TEST")
61 #ADD_DEFINITIONS("-DDEVPKG")
62
63 ##############################################################################
64 # CMake flags
65 IF (W3C_TEST)
66     SET(W3C_TEST "ON")
67 ENDIF(W3C_TEST)
68 IF (DEVPKG)
69     SET(DEVPKG "ON")
70 ENDIF(DEVPKG)
71
72 ################################################################################
73 # Miscellaneous variables
74
75 set(CONFIG_FILE_NAME "config.cmake")
76 set(LIBS_COMMONS ${dpl_LDFLAGS} )
77
78 set(DESTINATION_LIB_PREFIX lib)
79 set(DESTINATION_HEADER_PREFIX include/${PROJECT_NAME})
80
81 set(DESTINATION_HEADERS_NON_JS ${DESTINATION_HEADER_PREFIX}/Commons)
82 set(DESTINATION_HEADERS_JS ${DESTINATION_HEADER_PREFIX}/CommonsJavaScript)
83
84 ################################################################################
85 # Target platform
86
87 if (NOT DEFINED PLATFORM)
88   set(PLATFORM "tizen")
89 endif ()
90
91 ################################################################################
92 # Schema of plugin's configuration file
93
94 set(COMMON_CONFIG_DTD ${CMAKE_CURRENT_SOURCE_DIR}/config.dtd)
95 set(COMMON_CONFIG_DTD_DST /usr/etc/wrt-plugins)
96 INSTALL(FILES ${COMMON_CONFIG_DTD} DESTINATION ${COMMON_CONFIG_DTD_DST})
97
98 ################################################################################
99 # Macros used for including plugins from AL.
100
101
102 function(add_subdir NAME)
103   message(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/${NAME}")
104   add_subdirectory(${NAME})
105 endfunction()
106
107 ################################################################################
108 # Subdirectories
109
110 add_subdirectory(src)
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-mmplayer.pc)
127 configure_and_install_pkg(wrt-plugins-cpu.pc)
128 configure_and_install_pkg(wrt-plugins-widget-interface-dao.pc)
129 configure_and_install_pkg(wrt-plugins-widgetdb.pc)
130 configure_and_install_pkg(wrt-plugins-plugin-manager.pc)
131
132 ################################################################################
133 # Cache
134
135 set(PLATFORM "${PLATFORM}" CACHE STRING "Target platform" FORCE)
136 set(CMAKE_CONFIG_FILE_NAME "${CMAKE_CONFIG_FILE_NAME}" CACHE
137     STRING "CMake configuration file name." FORCE)
138
139
140 ################################################################################
141 # Summary
142
143 message(STATUS "PLATFORM = ${PLATFORM}")
144 message(STATUS "W3C_TEST = ${W3C_TEST}")