1 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 # @file CMakeLists.txt
17 # @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
22 # Check minimum CMake version
23 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
29 OPTION(DPL_LOG "DPL logs status" OFF)
31 MESSAGE(STATUS "Logging enabled for DPL")
32 ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
34 MESSAGE(STATUS "Logging disabled for DPL")
37 ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION")
38 STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
39 ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
42 SET(CMAKE_BUILD_TYPE "Release")
43 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
44 SET(CMAKE_CXX_FLAGS "-O2 -g -fPIC -D_FORTIFY_SOURCE=0")
47 MESSAGE(STATUS "========================================")
48 MESSAGE(STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR})
49 MESSAGE(STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR})
50 MESSAGE(STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR})
51 MESSAGE(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
52 MESSAGE(STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR})
53 MESSAGE(STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR})
54 MESSAGE(STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH})
55 MESSAGE(STATUS "LIBRARY_OUTPUT_PATH: " ${LIBRARY_OUTPUT_PATH})
56 MESSAGE(STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH})
57 MESSAGE(STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND})
58 MESSAGE(STATUS "CMAKE_ROOT: " ${CMAKE_ROOT})
59 MESSAGE(STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE})
60 MESSAGE(STATUS "CMAKE_CURRENT_LIST_LINE: " ${CMAKE_CURRENT_LIST_LINE})
61 MESSAGE(STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH})
62 MESSAGE(STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH})
63 MESSAGE(STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM})
64 MESSAGE(STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
65 MESSAGE(STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION})
66 MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
67 MESSAGE(STATUS "UNIX: " ${UNIX})
68 MESSAGE(STATUS "WIN32: " ${WIN32})
69 MESSAGE(STATUS "APPLE: " ${APPLE})
70 MESSAGE(STATUS "MINGW: " ${MINGW})
71 MESSAGE(STATUS "CYGWIN: " ${CYGWIN})
72 MESSAGE(STATUS "BORLAND: " ${BORLAND})
73 MESSAGE(STATUS "MSVC: " ${MSVC})
74 MESSAGE(STATUS "MSVC_IDE: " ${MSVC_IDE})
75 MESSAGE(STATUS "MSVC60: " ${MSVC60})
76 MESSAGE(STATUS "MSVC70: " ${MSVC70})
77 MESSAGE(STATUS "MSVC71: " ${MSVC71})
78 MESSAGE(STATUS "MSVC80: " ${MSVC80})
79 MESSAGE(STATUS "CMAKE_COMPILER_2005: " ${CMAKE_COMPILER_2005})
80 MESSAGE(STATUS "CMAKE_SKIP_RULE_DEPENDENCY: " ${CMAKE_SKIP_RULE_DEPENDENCY})
81 MESSAGE(STATUS "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: " ${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY})
82 MESSAGE(STATUS "CMAKE_SKIP_RPATH: " ${CMAKE_SKIP_RPATH})
83 MESSAGE(STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE})
84 MESSAGE(STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION})
85 MESSAGE(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
86 MESSAGE(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
87 MESSAGE(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
88 MESSAGE(STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS})
89 MESSAGE(STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER})
90 MESSAGE(STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER})
91 MESSAGE(STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC})
92 MESSAGE(STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX})
93 MESSAGE(STATUS "CMAKE_AR: " ${CMAKE_AR})
94 MESSAGE(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB})
95 MESSAGE(STATUS "========================================")
97 # Build 3rd party libraries first
98 ADD_SUBDIRECTORY(3rdparty)
101 ADD_DEFINITIONS("-fvisibility=default") # mark all exported symbols as visible
104 #ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
107 ADD_DEFINITIONS("-Wall") # Generate all warnings
108 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
109 ADD_DEFINITIONS("-pedantic") # Accept only pedantic code
110 #ADD_DEFINITIONS("-Weffc++") # Accept only effective C++ code
111 ADD_DEFINITIONS("-Wwrite-strings") # Do not accept writing to contant string memory
112 ADD_DEFINITIONS("-Winit-self") # Do not accept initializing variable with itself
113 ADD_DEFINITIONS("-Wcast-align") # Do not accept misaligning with casting
114 ADD_DEFINITIONS("-Wcast-qual") # Do not accept removing qualifiers with casting
115 #ADD_DEFINITIONS("-Wold-style-cast") # Do not accept old style casting
116 ADD_DEFINITIONS("-Wpointer-arith") # Warn about void pointer arthimetic
117 ADD_DEFINITIONS("-Wstrict-aliasing") # Ensure strict aliasing
118 ADD_DEFINITIONS("-Wuninitialized") # Do not accept uninitialized variables
119 ADD_DEFINITIONS("-Wmissing-declarations") # Warn about global and non-accesible functions
120 ADD_DEFINITIONS("-Woverloaded-virtual") # Warn about incidental overiding non-virtual base methods
121 ADD_DEFINITIONS("-Wnon-virtual-dtor") # Warn about non-virtual destructor
122 ADD_DEFINITIONS("-Wctor-dtor-privacy") # Warn about useless and non-constructible classes
123 ADD_DEFINITIONS("-Wlong-long") # Do not allow using long long
124 #ADD_DEFINITIONS("-Wunreachable-code") # Warn about unreachable code
125 ADD_DEFINITIONS("-Wfloat-equal") # Do not accept comparing floating points with equal operator
126 ADD_DEFINITIONS("-Wabi") # Warn about possible ABI problems
127 ADD_DEFINITIONS("-Wswitch-enum") # Check switch enumeration
128 ADD_DEFINITIONS("-Wformat=2") # Check printf formatting
129 ADD_DEFINITIONS("-Wundef") # Warn if an undefined identifier is evaluated in an @if directive.
130 ADD_DEFINITIONS("-Wshadow") # Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed
131 ADD_DEFINITIONS("-Wconversion") # Warn for implicit conversions that may alter a value
132 ADD_DEFINITIONS("-Wlogical-op") # Warn about suspicious uses of logical operators in expressions
133 #ADD_DEFINITIONS("-Waggregate-return") # Warn if any functions that return structures or unions are defined or called.
134 ADD_DEFINITIONS("-Wmissing-field-initializers") # Warn if a structure's initializer has some fields missing.
135 ADD_DEFINITIONS("-Wredundant-decls") # Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing.
136 #ADD_DEFINITIONS("-Wmissing-include-dirs") # Warn if a user-supplied include directory does not exist.
137 ADD_DEFINITIONS("-Wswitch-default") # Warn whenever a switch statement does not have a default case.
138 ADD_DEFINITIONS("-Wsync-nand") # Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used. These functions changed semantics in GCC 4.4.
139 ADD_DEFINITIONS("-Wunused") # All the above -Wunused options combined.
140 ADD_DEFINITIONS("-Wstrict-overflow=5") # Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.
141 #ADD_DEFINITIONS("-Wunsafe-loop-optimizations") # Warn if the loop cannot be optimized because the compiler could not assume anything on the bounds of the loop indices. With -funsafe-loop-optimizations warn if the compiler made such assumptions.
142 #ADD_DEFINITIONS("-Wmissing-format-attribute") # Warn about function pointers which might be candidates for format attributes.
143 #ADD_DEFINITIONS("-Wpadded") # Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure.
144 #ADD_DEFINITIONS("-Winline") # Warn if a function can not be inlined and it was declared as inline.
145 ADD_DEFINITIONS("-Wdisabled-optimization") # Warn if a requested optimization pass is disabled.
146 ADD_DEFINITIONS("-std=c++0x")
151 # Define all core library headers and sources. As detail files
152 # are usually templated and though recompiled in each file, we
153 # have to compile full source for each target.
156 # Set DPL 3rd party include directory
157 SET(DPL_3RDPARTY_INCLUDE_DIR
158 ${PROJECT_SOURCE_DIR}/3rdparty)
160 # Set names of binaries being created
161 SET(TARGET_DPL_EFL "lib${PROJECT_NAME}-efl")
162 SET(TARGET_DPL_DBUS_EFL "lib${PROJECT_NAME}-dbus-efl")
163 SET(TARGET_DPL_DB_EFL "lib${PROJECT_NAME}-db-efl")
164 SET(TARGET_DPL_EVENT_EFL "lib${PROJECT_NAME}-event-efl")
165 SET(TARGET_DPL_SOCKET_EFL "lib${PROJECT_NAME}-socket-efl")
166 SET(TARGET_DPL_RPC_EFL "lib${PROJECT_NAME}-rpc-efl")
167 SET(TARGET_DPL_TEST_ENGINE_EFL "lib${PROJECT_NAME}-test-efl")
168 SET(TARGET_DPL_LOG_EFL "lib${PROJECT_NAME}-log-efl")
169 SET(TARGET_DPL_POPUP "lib${PROJECT_NAME}-popup-efl")
170 SET(TARGET_WRT_DAO_RW_LIB "dpl-wrt-dao-rw")
171 SET(TARGET_WRT_DAO_RO_LIB "dpl-wrt-dao-ro")
172 SET(TARGET_AUTO_SAVE_DAO_LIB "wrt-commons-auto-save-dao")
173 SET(TARGET_AUTO_SAVE_DAO_RW_LIB "wrt-commons-auto-save-dao-rw")
174 SET(TARGET_AUTO_SAVE_DAO_RO_LIB "wrt-commons-auto-save-dao-ro")
175 SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl")
177 macro(configure_and_install_pkg PKG_FILE)
178 CONFIGURE_FILE(${PKG_FILE}.in ${PKG_FILE} @ONLY)
179 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PKG_FILE} DESTINATION lib/pkgconfig)
180 endmacro(configure_and_install_pkg)
182 ADD_SUBDIRECTORY(modules)
184 ADD_SUBDIRECTORY(build)
185 ADD_SUBDIRECTORY(etc)