summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-19 17:54:12 -0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-23 18:23:40 +0100
commitdee24c3821ffbc14721dbfb041ac6cc010b9269b (patch)
tree5c5f76c74b665d4a3c7905d6f7519e480ebeaa0f
parent88283204c16c745e3aec11bff2409bd5cc903121 (diff)
CMake: rework to use some helper macros.
This tries to defines some macros to create a cleaner build system.
-rw-r--r--.gitignore3
-rw-r--r--CMakeLists.txt51
-rw-r--r--cmake/config/common.cmake30
-rw-r--r--cmake/config/eina.cmake64
-rw-r--r--cmake/helpers/EflMacros.cmake253
-rw-r--r--src/lib/efl/.gitignore1
-rw-r--r--src/lib/efl/config.h.cmake (renamed from config.h.cmake)5
-rw-r--r--src/lib/eina/CMakeLists.txt360
-rw-r--r--src/tests/eina/CMakeLists.txt129
9 files changed, 606 insertions, 290 deletions
diff --git a/.gitignore b/.gitignore
index ac86fdc280..25bf616533 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,6 @@ Session.vim
81#wayland generated protocol - some legacy headers will be ignored 81#wayland generated protocol - some legacy headers will be ignored
82*-protocol.h 82*-protocol.h
83*-protocol.c 83*-protocol.c
84
85/build
86
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12dd0a87dd..f68a8117cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,19 +1,44 @@
1cmake_minimum_required(VERSION 3.7) 1cmake_minimum_required(VERSION 3.7)
2project(eflgeneric) 2project(efl VERSION 1.19.99.1)
3if (NOT EFL_BUILD_ID)
4 set(EFL_BUILD_ID 120)
5endif()
3 6
4ADD_DEFINITIONS("-DHAVE_CONFIG_H") 7if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
8 message(FATAL_ERROR "In-source builds not allowed. Use: mkdir -p build && cmake -H. -Bbuild")
9endif()
5 10
6add_subdirectory(src) 11set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Path to store built libraries")
12set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Path to store built executables")
7 13
8CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H) 14set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Absolute path to library installation directory")
15set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Absolute path to executable installation directory")
16set(HEADER_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Absolute path to install headers by the library")
9 17
10set(PROJECT_VERSION_MAJOR 1) 18add_definitions(
11set(PROJECT_VERSION_MINOR 19) 19 "-DHAVE_CONFIG_H"
12set(PROJECT_VERSION_PATCH 99) 20 "-DLIB_INSTALL_DIR=\"${LIB_INSTALL_DIR}\""
13set(PROJECT_VERSION_TWEAK 00) 21 "-DEXEC_INSTALL_DIR=\"${EXEC_INSTALL_DIR}\""
22 )
23include_directories(
24 ${PROJECT_SOURCE_DIR}/src/lib/efl
25 ${PROJECT_BINARY_DIR}/src/lib/efl
26 )
14 27
15set(VMAJ ${PROJECT_VERSION_MAJOR}) 28set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/helpers")
16set(VMIN ${PROJECT_VERSION_MINOR}) 29include(EflMacros)
17set(VMIC ${PROJECT_VERSION_PATCH}) 30
18set(VREV ${PROJECT_VERSION_TWEAK}) 31include(${CMAKE_SOURCE_DIR}/cmake/config/common.cmake)
19configure_file(config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h) 32
33EFL_LIB(eina)
34
35EFL_OPTIONS_SUMMARY()
36
37configure_file(
38 ${PROJECT_SOURCE_DIR}/src/lib/efl/config.h.cmake
39 ${PROJECT_BINARY_DIR}/src/lib/efl/config.h)
40configure_file(
41 ${PROJECT_SOURCE_DIR}/src/lib/efl/Efl_Config.h.cmake
42 ${PROJECT_BINARY_DIR}/src/lib/efl/Efl_Config.h)
43
44EFL_FINALIZE()
diff --git a/cmake/config/common.cmake b/cmake/config/common.cmake
new file mode 100644
index 0000000000..f41166201d
--- /dev/null
+++ b/cmake/config/common.cmake
@@ -0,0 +1,30 @@
1include(CheckSymbolExists)
2include(CheckIncludeFile)
3include(CheckTypeSize)
4include(FindPkgConfig)
5include(CTest)
6find_package(Threads REQUIRED)
7
8pkg_check_modules(CHECK check)
9
10CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H)
11
12set(VMAJ ${PROJECT_VERSION_MAJOR})
13set(VMIN ${PROJECT_VERSION_MINOR})
14set(VMIC ${PROJECT_VERSION_PATCH})
15set(VREV ${PROJECT_VERSION_TWEAK})
16set(EFL_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
17set(EFL_VERSION_MINOR ${PROJECT_VERSION_MINOR})
18
19set(BUILD_ALL_PROFILES release dev debug)
20EFL_OPTION(BUILD_PROFILE "How to build EFL (one of: ${BUILD_ALL_PROFILES})" "release" STRING)
21list(FIND BUILD_ALL_PROFILES ${BUILD_PROFILE} RET)
22if (${RET} EQUAL -1)
23 message(FATAL_ERROR "Unknown BUILD_PROFILE=${BUILD_PROFILE}")
24endif()
25
26EFL_OPTION(EFL_NOLEGACY_API_SUPPORT "Whenever to disable non-Eo (Legacy) APIs" ON)
27EFL_OPTION(EFL_EO_API_SUPPORT "Whenever to enable new Eo APIs" ON)
28if(NOT EFL_EO_API_SUPPORT)
29 EFL_OPTION_SET_MESSAGE(EFL_EO_API_SUPPORT "Risky!")
30endif()
diff --git a/cmake/config/eina.cmake b/cmake/config/eina.cmake
new file mode 100644
index 0000000000..361488030f
--- /dev/null
+++ b/cmake/config/eina.cmake
@@ -0,0 +1,64 @@
1set(EINA_SAFETY_CHECKS 1)
2set(EINA_DEBUG_THREADS OFF)
3set(VALGRIND OFF)
4if("${BUILD_PROFILE}" STREQUAL "dev")
5 set(EINA_STRINGSHARE_USAGE ON)
6 set(CHECK_VALGRIND ON)
7elseif("${BUILD_PROFILE}" STREQUAL "debug")
8 set(EINA_DEBUG_MALLOC ON)
9 set(EINA_COW_MAGIC_ON ON)
10 set(EINA_DEFAULT_MEMPOOL ON)
11 set(EINA_DEBUG_MALLOC ON)
12 set(EINA_DEBUG_THREADS ON)
13 set(VALGRIND ON)
14elseif("${BUILD_PROFILE}" STREQUAL "release")
15 set(EINA_LOG_LEVEL_MAXIMUM 3)
16endif()
17
18EFL_OPTION(EINA_MAGIC_DEBUG "magic debug of eina structure" ON)
19EFL_OPTION(EINA_DEBUG_THREADS "debugging of eina threads" ${EINA_DEBUG_THREADS})
20EFL_OPTION(VALGRIND "valgrind support" ${VALGRIND})
21
22
23#check for symbols in pthread
24#TODO Make the definitions depending on the platform
25set(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
26set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
27CHECK_SYMBOL_EXISTS(pthread_barrier_init pthread.h EINA_HAVE_PTHREAD_BARRIER)
28CHECK_SYMBOL_EXISTS(pthread_attr_setaffinity_np pthread.h EINA_HAVE_PTHREAD_AFFINITY)
29CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h EINA_HAVE_PTHREAD_SETNAME)
30CHECK_SYMBOL_EXISTS(pthread_spin_init pthread.h EINA_HAVE_POSIX_SPINLOCK)
31
32#check for eina header files that are required
33CHECK_INCLUDE_FILE(alloca.h EINA_HAVE_ALLOCA_H)
34CHECK_INCLUDE_FILE(byteswap.h EINA_HAVE_BYTESWAP_H)
35CHECK_INCLUDE_FILE(fnmatch.h EINA_HAVE_FNMATCH_H)
36#only enable log when fnmatch is there
37if (EINA_HAVE_FNMATCH_H)
38 set(EINA_ENABLE_LOG 1)
39endif (EINA_HAVE_FNMATCH_H)
40CHECK_INCLUDE_FILE(dirent.h EINA_HAVE_DIRENT_H)
41
42CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T)
43CHECK_TYPE_SIZE("uintptr_t" EINA_SIZEOF_UINTPTR_T)
44CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T)
45
46#check for swap16/32/64
47CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h EINA_HAVE_BSWAP16)
48CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h EINA_HAVE_BSWAP32)
49CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h EINA_HAVE_BSWAP64)
50
51CHECK_SYMBOL_EXISTS(clock_gettime time.h HAVE_CLOCK_GETTIME)
52
53if(VALGRIND)
54 pkg_check_modules(VG REQUIRED valgrind)
55 set(NVALGRIND OFF)
56else()
57 set(NVALGRIND ON)
58endif()
59
60#Check if there is the alloca header
61
62configure_file(
63 ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/eina/eina_config.h.cmake
64 ${CMAKE_CURRENT_BINARY_DIR}/src/lib/eina/eina_config.h)
diff --git a/cmake/helpers/EflMacros.cmake b/cmake/helpers/EflMacros.cmake
new file mode 100644
index 0000000000..cb5d3e5a90
--- /dev/null
+++ b/cmake/helpers/EflMacros.cmake
@@ -0,0 +1,253 @@
1# EFL_OPTION(Name Help Default)
2#
3# Declare an option() that will be automatically printed by
4# EFL_OPTIONS_SUMMARY()
5#
6# To extend the EFL_OPTIONS_SUMMARY() message, use
7# EFL_OPTION_SET_MESSAGE(Name Message)
8macro(EFL_OPTION _name _help _defval)
9 set(_type ${ARGN})
10 if(NOT _type)
11 set(_type BOOL)
12 endif()
13 list(APPEND EFL_ALL_OPTIONS ${_name})
14 set(EFL_OPTION_DEFAULT_${_name} "${_defval}")
15 set(EFL_OPTION_TYPE_${_name} "${_type}")
16 set(${_name} ${_defval} CACHE ${_type} "${_help}")
17 option(${_name} "${_help}" ${_defval})
18 unset(_type)
19endmacro()
20
21# EFL_OPTION_SET_MESSAGE(Name Message)
22#
23# Extends the summary line output by EFL_OPTIONS_SUMMARY()
24# with more details.
25macro(EFL_OPTION_SET_MESSAGE _name _message)
26 set(EFL_OPTION_MESSAGE_${_name} "${_message}")
27endmacro()
28
29# EFL_OPTIONS_SUMMARY()
30# Shows the summary of options, their values and related messages.
31function(EFL_OPTIONS_SUMMARY)
32 message(STATUS "EFL Options Summary:")
33 message(STATUS " CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
34 message(STATUS " CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
35 message(STATUS " BUILD_PROFILE=${BUILD_PROFILE}")
36 foreach(_o ${EFL_ALL_OPTIONS})
37 set(_v ${${_o}})
38 set(_d ${EFL_OPTION_DEFAULT_${_o}})
39 if("${_v}" STREQUAL "${_d}")
40 set(_i "default")
41 else()
42 set(_i "default: ${_d}")
43 endif()
44 if(EFL_OPTION_MESSAGE_${_o})
45 set(_m " [${EFL_OPTION_MESSAGE_${_o}}]")
46 endif()
47 message(STATUS " ${_o}=${_v} (${_i})${_m}")
48 endforeach()
49endfunction()
50
51set(EFL_ALL_LIBS)
52set(EFL_ALL_TESTS)
53
54macro(EFL_FINALIZE)
55 add_custom_target(all-libs DEPENDS ${EFL_ALL_LIBS})
56 add_custom_target(all-tests DEPENDS ${EFL_ALL_TESTS})
57endmacro()
58
59# EFL_LIB(Name)
60#
61# adds a library ${Name} automatically setting:
62# - target_include_directories to ${Name}_INCLUDE_DIRECTORIES
63# - target_include_directories(SYSTEM) to ${Name}_SYSTEM_INCLUDE_DIRECTORIES
64# - OUTPUT_NAME to ${Name}_OUTPUT_NAME
65# - SOURCES to ${Name}_SOURCES
66# - HEADER to ${Name}_HEADERS (to be installed)
67# - VERSION to ${Name}_VERSION (defaults to project version)
68# - SOVERSION to ${Name}_SOURCES (defaults to project major version)
69# - OBJECT_DEPENDS to ${Name}_DEPENDENCIES
70# - target_link_libraries() to ${Name}_LIBRARIES
71# - target_compile_definitions() to ${Name}_DEFINITIONS
72# - compile tests in ${Name}_TESTS using EFL_TEST()
73#
74macro(EFL_LIB _target)
75 string(TOLOWER ${_target} _target_lc)
76 set(EFL_LIB_CURRENT ${_target})
77 set(EFL_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/${_target_lc})
78 set(EFL_LIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/lib/${_target_lc})
79 set(EFL_BIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/bin/${_target_lc})
80 set(EFL_BIN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/bin/${_target_lc})
81 set(EFL_MODULES_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/${_target_lc})
82 set(EFL_MODULES_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/modules/${_target_lc})
83 set(EFL_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/tests/${_target_lc})
84 set(EFL_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/tests/${_target_lc})
85
86 set(${_target}_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
87 set(${_target}_SOVERSION ${PROJECT_VERSION_MAJOR})
88 set(${_target}_LIBRARY_TYPE SHARED)
89
90 include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/${_target_lc}.cmake OPTIONAL)
91 include(${EFL_LIB_SOURCE_DIR}/CMakeLists.txt OPTIONAL)
92 include(${EFL_BIN_SOURCE_DIR}/CMakeLists.txt OPTIONAL)
93 include(${EFL_MODULES_SOURCE_DIR}/CMakeLists.txt OPTIONAL)
94 include(${EFL_TESTS_SOURCE_DIR}/CMakeLists.txt OPTIONAL)
95
96 set(_headers "")
97 foreach(f ${${_target}_HEADERS})
98 if(EXISTS "${EFL_LIB_SOURCE_DIR}/${f}")
99 list(APPEND _headers "${EFL_LIB_SOURCE_DIR}/${f}")
100 else()
101 list(APPEND _headers "${EFL_LIB_BINARY_DIR}/${f}")
102 endif()
103 endforeach()
104
105 set(_sources "")
106 foreach(f ${${_target}_SOURCES})
107 if(EXISTS "${EFL_LIB_SOURCE_DIR}/${f}")
108 list(APPEND _sources "${EFL_LIB_SOURCE_DIR}/${f}")
109 else()
110 list(APPEND _sources "${EFL_LIB_BINARY_DIR}/${f}")
111 endif()
112 endforeach()
113
114 set(_deps "")
115 foreach(f ${${_target}_DEPENDENCIES})
116 if(EXISTS "${EFL_LIB_SOURCE_DIR}/${f}")
117 list(APPEND _deps "${EFL_LIB_SOURCE_DIR}/${f}")
118 else()
119 list(APPEND _deps "${EFL_LIB_BINARY_DIR}/${f}")
120 endif()
121 endforeach()
122
123 add_library(${_target} ${${_target}_LIBRARY_TYPE} ${_sources} ${_headers})
124 set_target_properties(${_target} PROPERTIES
125 FRAMEWORK TRUE
126 PUBLIC_HEADER "${_headers}"
127 OBJECT_DEPENDS "${_deps}")
128
129 if(${_target}_LIBRARIES)
130 target_link_libraries(${_target} ${${_target}_LIBRARIES})
131 endif()
132
133 target_include_directories(${_target} PUBLIC
134 ${${_target}_INCLUDE_DIRECTORIES}
135 ${EFL_LIB_SOURCE_DIR}
136 )
137 if(${_target}_SYSTEM_INCLUDE_DIRECTORIES)
138 target_include_directories(${_target} SYSTEM PUBLIC ${${_target}_SYSTEM_INCLUDE_DIRECTORIES})
139 endif()
140
141 if(${_target}_DEFINITIONS)
142 target_compile_definitions(${_target} PRIVATE ${${_target}_DEFINITIONS})
143 endif()
144
145 if(${_target}_OUTPUT_NAME)
146 set_target_properties(${_target} PROPERTIES OUTPUT_NAME ${${_target}_OUTPUT_NAME})
147 endif()
148
149 if(${_target}_VERSION AND ${_target}_SOVERSION)
150 set_target_properties(${_target} PROPERTIES
151 VERSION ${${_target}_VERSION}
152 SOVERSION ${${_target}_SOVERSION})
153 endif()
154
155 install(TARGETS ${_target}
156 PUBLIC_HEADER DESTINATION include/${_target}-${PROJECT_VERSION_MAJOR}
157 RUNTIME DESTINATION bin
158 ARCHIVE DESTINATION lib
159 LIBRARY DESTINATION lib)
160
161 foreach(t ${${_target}_TESTS})
162 EFL_TEST(${t})
163 endforeach()
164 add_custom_target(${_target}-tests DEPENDS ${${_target}_TESTS})
165 add_custom_target(${_target}-modules DEPENDS ${${_target}_MODULES})
166 list(APPEND EFL_ALL_LIBS ${_target})
167 list(APPEND EFL_ALL_TESTS ${_target}-tests)
168
169 unset(_sources)
170 unset(_headers)
171 unset(_deps)
172 unset(EFL_LIB_CURRENT)
173 unset(EFL_LIB_SOURCE_DIR)
174 unset(EFL_LIB_BINARY_DIR)
175 unset(EFL_BIN_SOURCE_DIR)
176 unset(EFL_BIN_BINARY_DIR)
177 unset(EFL_MODULES_SOURCE_DIR)
178 unset(EFL_MODULES_BINARY_DIR)
179 unset(EFL_TESTS_SOURCE_DIR)
180 unset(EFL_TESTS_BINARY_DIR)
181endmacro()
182
183
184# EFL_TEST(Name)
185#
186# Adds a test for ${EFL_LIB_CURRENT} using
187# ${EFL_TESTS_SOURCE_DIR} and ${EFL_TESTS_BINARY_DIR}
188#
189# Settings:
190# - include_directories to ${Name}_INCLUDE_DIRECTORIES
191# - include_directories(SYSTEM) to ${Name}_SYSTEM_INCLUDE_DIRECTORIES
192# - OUTPUT_NAME to ${Name}_OUTPUT_NAME
193# - SOURCES to ${Name}_SOURCES
194# - target_link_libraries() to ${Name}_LIBRARIES (${EFL_LIB_CURRENT}
195# is automatic)
196# - target_compile_definitions() to ${Name}_DEFINITIONS
197#
198# NOTE: it's meant to be called by files included by EFL_LIB() or similar,
199# otherwise you need to prepare the environment yourself.
200function(EFL_TEST _testname)
201 if(NOT CHECK_FOUND)
202 message(STATUS "${EFL_LIB_CURRENT} test ${_testname} ignored since no 'check' library was found.")
203 return()
204 endif()
205 set(_sources "")
206 foreach(f ${${_testname}_SOURCES})
207 if(EXISTS "${EFL_TESTS_SOURCE_DIR}/${f}")
208 list(APPEND _sources "${EFL_TESTS_SOURCE_DIR}/${f}")
209 else()
210 list(APPEND _sources "${EFL_TESTS_BINARY_DIR}/${f}")
211 endif()
212 endforeach()
213 add_executable(${_testname} EXCLUDE_FROM_ALL ${_sources})
214
215 set(_deps "")
216 foreach(f ${${_testname}_DEPENDENCIES})
217 if(EXISTS "${EFL_TESTS_SOURCE_DIR}/${f}")
218 list(APPEND _deps "${EFL_TESTS_SOURCE_DIR}/${f}")
219 else()
220 list(APPEND _deps "${EFL_TESTS_BINARY_DIR}/${f}")
221 endif()
222 endforeach()
223 # TODO: depend on modules!
224 set_target_properties(${_testname} PROPERTIES OBJECT_DEPENDS "${_deps}")
225 message(STATUS "${_testname} ${_deps}")
226
227 target_include_directories(${_testname} SYSTEM PUBLIC
228 ${EFL_TESTS_SOURCE_DIR}
229 ${EFL_TESTS_BINARY_DIR}
230 ${CHECK_INCLUDE_DIRS})
231 target_link_libraries(${_testname}
232 ${EFL_LIB_CURRENT}
233 ${${_testname}_LIBRARIES}
234 ${CHECK_LIBRARIES})
235
236 target_compile_definitions(${_testname} PRIVATE
237 "-DTESTS_SRC_DIR=\"${EFL_TESTS_SOURCE_DIR}\""
238 "-DTESTS_BUILD_DIR=\"${EFL_TESTS_BINARY_DIR}\""
239 "-DTESTS_WD=\"${PROJECT_BINARY_DIR}\""
240 "-DPACKAGE_BUILD_DIR=\"1\""
241 ${${_testname}_DEFINITIONS}
242 )
243
244 if(${_testname}_OUTPUT_NAME)
245 set_target_properties(${_testname} PROPERTIES OUTPUT_NAME ${${_testname}_OUTPUT_NAME})
246 endif()
247
248 set_target_properties(${_testname} PROPERTIES
249 LIBRARY_OUTPUT_DIRECTORY "${EFL_TESTS_BINARY_DIR}"
250 RUNTIME_OUTPUT_DIRECTORY "${EFL_TESTS_BINARY_DIR}")
251
252 add_test(NAME ${_testname} COMMAND ${_testname})
253endfunction()
diff --git a/src/lib/efl/.gitignore b/src/lib/efl/.gitignore
index e69de29bb2..18e58a752a 100644
--- a/src/lib/efl/.gitignore
+++ b/src/lib/efl/.gitignore
@@ -0,0 +1 @@
/config.h
diff --git a/config.h.cmake b/src/lib/efl/config.h.cmake
index ca8a2bd974..4cd524ab1c 100644
--- a/config.h.cmake
+++ b/src/lib/efl/config.h.cmake
@@ -9,8 +9,11 @@
9#cmakedefine VMIC @VMIC@ 9#cmakedefine VMIC @VMIC@
10#cmakedefine VREV @VREV@ 10#cmakedefine VREV @VREV@
11 11
12#cmakedefine NVALGRIND 1
13#cmakedefine HAVE_CLOCK_GETTIME 1
14
12#define PACKAGE_LIB_DIR "bla" 15#define PACKAGE_LIB_DIR "bla"
13#define MODULE_ARCH "bla" 16#define MODULE_ARCH "bla"
14#define SHARED_LIB_SUFFIX "bla" 17#define SHARED_LIB_SUFFIX "bla"
15 18
16#endif \ No newline at end of file 19#endif
diff --git a/src/lib/eina/CMakeLists.txt b/src/lib/eina/CMakeLists.txt
index 56b6f6733d..8e08a49f27 100644
--- a/src/lib/eina/CMakeLists.txt
+++ b/src/lib/eina/CMakeLists.txt
@@ -1,214 +1,154 @@
1INCLUDE (CheckSymbolExists)
2INCLUDE (CheckIncludeFile)
3INCLUDE (CheckTypeSize)
4INCLUDE (FindPkgConfig)
5find_package(Threads REQUIRED)
6 1
7#Configure depending on the profile 2set(eina_INCLUDE_DIRECTORIES ${VG_INCLUDE_DIRS})
8set(EINA_SAFETY_CHECKS 1)
9if ("${BUILD_PROFILE}" STREQUAL "dev")
10 set(EINA_STRINGSHARE_USAGE ON)
11 set(CHECK_VALGRIND ON)
12elseif ("${BUILD_PROFILE}" STREQUAL "debug")
13 set(EINA_DEBUG_MALLOC ON)
14 set(EINA_COW_MAGIC_ON ON)
15 set(EINA_DEFAULT_MEMPOOL ON)
16 set(EINA_DEBUG_MALLOC ON)
17 set(EINA_DEBUG_THREADS ON)
18 set(VALGRIND ON)
19elseif ("${BUILD_PROFILE}" STREQUAL "release")
20 set(EINA_LOG_LEVEL_MAXIMUM 3)
21endif ("${BUILD_PROFILE}" STREQUAL "dev")
22 3
23#options of that submodule 4set(eina_LIBRARIES
24option(EINA_MAGIC_DEBUG "magic debug of eina structure" ON) 5 ${VG_LIBRARIES}
25option(EINA_DEBUG_THREADS "debugging of eina threads" ${EINA_DEBUG_THREADS}) 6 pthread)
26option(VALGRIND "valgrind support" ${VALGRIND})
27 7
28#check for symbols in pthread 8set(eina_HEADERS
29#TODO Make the definitions depending on the platform 9 Eina.h
30set(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}") 10 eina_accessor.h
31set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1") 11 eina_alloca.h
32CHECK_SYMBOL_EXISTS(pthread_barrier_init pthread.h EINA_HAVE_PTHREAD_BARRIER) 12 eina_array.h
33CHECK_SYMBOL_EXISTS(pthread_attr_setaffinity_np pthread.h EINA_HAVE_PTHREAD_AFFINITY) 13 eina_benchmark.h
34CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h EINA_HAVE_PTHREAD_SETNAME) 14 eina_bezier.h
35CHECK_SYMBOL_EXISTS(pthread_spin_init pthread.h EINA_HAVE_POSIX_SPINLOCK) 15 eina_binbuf.h
16 eina_binshare.h
17 eina_clist.h
18 eina_config.h
19 eina_convert.h
20 eina_counter.h
21 eina_cow.h
22 eina_cpu.h
23 eina_crc.h
24 eina_debug.h
25 eina_error.h
26 eina_evlog.h
27 eina_file.h
28 eina_file_common.h
29 eina_fp.h
30 eina_freeq.h
31 eina_hamster.h
32 eina_hash.h
33 eina_inarray.h
34 eina_inline_private.h
35 eina_inlist.h
36 eina_iterator.h
37 eina_lalloc.h
38 eina_list.h
39 eina_lock.h
40 eina_log.h
41 eina_magic.h
42 eina_main.h
43 eina_matrix.h
44 eina_matrixsparse.h
45 eina_mempool.h
46 eina_mmap.h
47 eina_module.h
48 eina_prefix.h
49 eina_private.h
50 eina_quad.h
51 eina_quadtree.h
52 eina_quaternion.h
53 eina_rbtree.h
54 eina_rectangle.h
55 eina_refcount.h
56 eina_safepointer.h
57 eina_safety_checks.h
58 eina_sched.h
59 eina_share_common.h
60 eina_simple_xml_parser.h
61 eina_slice.h
62 eina_slstr.h
63 eina_str.h
64 eina_strbuf.h
65 eina_strbuf_common.h
66 eina_strbuf_template_c.x
67 eina_stringshare.h
68 eina_thread.h
69 eina_thread_queue.h
70 eina_tiler.h
71 eina_tmpstr.h
72 eina_trash.h
73 eina_types.h
74 eina_unicode.h
75 eina_ustrbuf.h
76 eina_ustringshare.h
77 eina_util.h
78 eina_value.h
79 eina_value_util.h
80 eina_vector.h
81 eina_xattr.h
82 )
36 83
37#check for eina header files that are required 84LIST(APPEND eina_SOURCES
38CHECK_INCLUDE_FILE(alloca.h EINA_HAVE_ALLOCA_H) 85 eina_abi.c
39CHECK_INCLUDE_FILE(byteswap.h EINA_HAVE_BYTESWAP_H) 86 eina_accessor.c
40CHECK_INCLUDE_FILE(fnmatch.h EINA_HAVE_FNMATCH_H) 87 eina_array.c
41#only enable log when fnmatch is there 88 eina_benchmark.c
42if (EINA_HAVE_FNMATCH_H) 89 eina_bezier.c
43 set(EINA_ENABLE_LOG 1) 90 eina_binbuf.c
44endif (EINA_HAVE_FNMATCH_H) 91 eina_binshare.c
45CHECK_INCLUDE_FILE(dirent.h EINA_HAVE_DIRENT_H) 92 eina_convert.c
46 93 eina_counter.c
47CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T) 94 eina_cow.c
48CHECK_TYPE_SIZE("uintptr_t" EINA_SIZEOF_UINTPTR_T) 95 eina_cpu.c
49CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T) 96 eina_crc.c
50 97 eina_debug.c
51#check for swap16/32/64 98 eina_debug_bt.c
52CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h EINA_HAVE_BSWAP16) 99 eina_debug_bt_file.c
53CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h EINA_HAVE_BSWAP32) 100 eina_debug_chunk.c
54CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h EINA_HAVE_BSWAP64) 101 eina_debug_monitor.c
55 102 eina_debug_proto.c
56#TODO really check if we wanted to have valgrind support or not 103 eina_debug_thread.c
57pkg_check_modules(VG REQUIRED valgrind) 104 eina_error.c
58 105 eina_evlog.c
59#Check if there is the alloca header 106 eina_file.c
60 107 eina_file_common.c
61configure_file(eina_config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/eina_config.h) 108 eina_fp.c
62 109 eina_freeq.c
63include_directories( 110 eina_hamster.c
64 ${PROJECT_SOURCE_DIR}/ 111 eina_hash.c
65 ${VG_INCLUDE_DIRS} 112 eina_inarray.c
66 ${PROJECT_SOURCE_DIR}/src/lib/efl 113 eina_inlist.c
67 ${PROJECT_SOURCE_DIR}/src/lib/eina 114 eina_iterator.c
68) 115 eina_lalloc.c
69 116 eina_list.c
70LIST(APPEND eina_source 117 eina_lock.c
71 Eina.h 118 eina_log.c
72 eina_abi.c 119 eina_magic.c
73 eina_accessor.c 120 eina_main.c
74 eina_accessor.h 121 eina_matrix.c
75 eina_alloca.h 122 eina_matrixsparse.c
76 eina_array.c 123 eina_mempool.c
77 eina_array.h 124 eina_mmap.c
78 eina_benchmark.c 125 eina_module.c
79 eina_benchmark.h 126 eina_prefix.c
80 eina_bezier.c 127 eina_quad.c
81 eina_bezier.h 128 eina_quadtree.c
82 eina_binbuf.c 129 eina_quaternion.c
83 eina_binbuf.h 130 eina_rbtree.c
84 eina_binshare.c 131 eina_rectangle.c
85 eina_binshare.h 132 eina_safepointer.c
86 eina_clist.h 133 eina_safety_checks.c
87 eina_config.h 134 eina_sched.c
88 eina_convert.c 135 eina_share_common.c
89 eina_convert.h 136 eina_simple_xml_parser.c
90 eina_counter.c 137 eina_slstr.c
91 eina_counter.h 138 eina_str.c
92 eina_cow.c 139 eina_strbuf.c
93 eina_cow.h 140 eina_strbuf_common.c
94 eina_cpu.c 141 eina_strbuf_template_c.x
95 eina_cpu.h 142 eina_stringshare.c
96 eina_crc.c 143 eina_thread.c
97 eina_crc.h 144 eina_thread_queue.c
98 eina_debug.c 145 eina_tiler.c
99 eina_debug.h 146 eina_tmpstr.c
100 eina_debug_bt.c 147 eina_unicode.c
101 eina_debug_bt_file.c 148 eina_ustrbuf.c
102 eina_debug_chunk.c 149 eina_ustringshare.c
103 eina_debug_monitor.c 150 eina_util.c
104 eina_debug_proto.c 151 eina_value.c
105 eina_debug_thread.c 152 eina_value_util.c
106 eina_error.c 153 eina_xattr.c
107 eina_error.h 154 )
108 eina_evlog.c
109 eina_evlog.h
110 eina_file.c
111 eina_file.h
112 eina_file_common.c
113 eina_file_common.h
114 eina_fp.c
115 eina_fp.h
116 eina_freeq.c
117 eina_freeq.h
118 eina_hamster.c
119 eina_hamster.h
120 eina_hash.c
121 eina_hash.h
122 eina_inarray.c
123 eina_inarray.h
124 eina_inline_private.h
125 eina_inlist.c
126 eina_inlist.h
127 eina_iterator.c
128 eina_iterator.h
129 eina_lalloc.c
130 eina_lalloc.h
131 eina_list.c
132 eina_list.h
133 eina_lock.c
134 eina_lock.h
135 eina_log.c
136 eina_log.h
137 eina_magic.c
138 eina_magic.h
139 eina_main.c
140 eina_main.h
141 eina_matrix.c
142 eina_matrix.h
143 eina_matrixsparse.c
144 eina_matrixsparse.h
145 eina_mempool.c
146 eina_mempool.h
147 eina_mmap.c
148 eina_mmap.h
149 eina_module.c
150 eina_module.h
151 eina_prefix.c
152 eina_prefix.h
153 eina_private.h
154 eina_quad.c
155 eina_quad.h
156 eina_quadtree.c
157 eina_quadtree.h
158 eina_quaternion.c
159 eina_quaternion.h
160 eina_rbtree.c
161 eina_rbtree.h
162 eina_rectangle.c
163 eina_rectangle.h
164 eina_refcount.h
165 eina_safepointer.c
166 eina_safepointer.h
167 eina_safety_checks.c
168 eina_safety_checks.h
169 eina_sched.c
170 eina_sched.h
171 eina_share_common.c
172 eina_share_common.h
173 eina_simple_xml_parser.c
174 eina_simple_xml_parser.h
175 eina_slice.h
176 eina_slstr.c
177 eina_slstr.h
178 eina_str.c
179 eina_str.h
180 eina_strbuf.c
181 eina_strbuf.h
182 eina_strbuf_common.c
183 eina_strbuf_common.h
184 eina_strbuf_template_c.x
185 eina_stringshare.c
186 eina_stringshare.h
187 eina_thread.c
188 eina_thread.h
189 eina_thread_queue.c
190 eina_thread_queue.h
191 eina_tiler.c
192 eina_tiler.h
193 eina_tmpstr.c
194 eina_tmpstr.h
195 eina_trash.h
196 eina_types.h
197 eina_unicode.c
198 eina_unicode.h
199 eina_ustrbuf.c
200 eina_ustrbuf.h
201 eina_ustringshare.c
202 eina_ustringshare.h
203 eina_util.c
204 eina_util.h
205 eina_value.c
206 eina_value.h
207 eina_value_util.c
208 eina_value_util.h
209 eina_vector.h
210 eina_xattr.c
211 eina_xattr.h
212)
213
214add_library(eina SHARED ${eina_source}) \ No newline at end of file
diff --git a/src/tests/eina/CMakeLists.txt b/src/tests/eina/CMakeLists.txt
index 358f13ed83..434db48670 100644
--- a/src/tests/eina/CMakeLists.txt
+++ b/src/tests/eina/CMakeLists.txt
@@ -1,69 +1,66 @@
1include_directories( 1set(eina_TESTS eina_suite)
2 ${PROJECT_SOURCE_DIR}/
3 ${PROJECT_SOURCE_DIR}/src/lib/eina/
4 ${PROJECT_SOURCE_DIR}/src/lib/efl/
5)
6 2
7add_definitions("-DTESTS_BUILD_DIR=\"1\"") 3set(eina_suite_LIBRARIES m)
8add_definitions("-DPACKAGE_BUILD_DIR=\"1\"")
9 4
10list(APPEND eina_test_source 5set(eina_suite_SOURCES
11 eina_suite.c 6 eina_suite.c
12 eina_suite.h 7 eina_suite.h
13 eina_test_abi.c 8 eina_suite.x
14 eina_test_accessor.c 9 eina_test_abi.c
15 eina_test_array.c 10 eina_test_accessor.c
16 eina_test_barrier.c 11 eina_test_array.c
17 eina_test_benchmark.c 12 eina_test_barrier.c
18 eina_test_bezier.c 13 eina_test_benchmark.c
19 eina_test_binbuf.c 14 eina_test_bezier.c
20 eina_test_binshare.c 15 eina_test_binbuf.c
21 eina_test_clist.c 16 eina_test_binshare.c
22 eina_test_convert.c 17 eina_test_clist.c
23 eina_test_counter.c 18 eina_test_convert.c
24 eina_test_cow.c 19 eina_test_counter.c
25 eina_test_crc.c 20 eina_test_cow.c
26 eina_test_error.c 21 eina_test_crc.c
27 eina_test_file.c 22 eina_test_error.c
28 eina_test_fp.c 23 eina_test_file.c
29 eina_test_freeq.c 24 eina_test_fp.c
30 eina_test_hash.c 25 eina_test_freeq.c
31 eina_test_inarray.c 26 eina_test_hash.c
32 eina_test_inlist.c 27 eina_test_inarray.c
33 eina_test_iterator.c 28 eina_test_inlist.c
34 eina_test_lalloc.c 29 eina_test_iterator.c
35 eina_test_list.c 30 eina_test_lalloc.c
36 eina_test_lock.c 31 eina_test_list.c
37 eina_test_log.c 32 eina_test_lock.c
38 eina_test_magic.c 33 eina_test_log.c
39 eina_test_main.c 34 eina_test_magic.c
40 eina_test_matrix.c 35 eina_test_main.c
41 eina_test_matrixsparse.c 36 eina_test_matrix.c
42 eina_test_mempool.c 37 eina_test_matrixsparse.c
43 eina_test_module.c 38 eina_test_mempool.c
44 eina_test_module_dummy.c 39 eina_test_module.c
45 eina_test_quad.c 40 eina_test_module_dummy.c
46 eina_test_quadtree.c 41 eina_test_quad.c
47 eina_test_quaternion.c 42 eina_test_quadtree.c
48 eina_test_rbtree.c 43 eina_test_quaternion.c
49 eina_test_rectangle.c 44 eina_test_rbtree.c
50 eina_test_safepointer.c 45 eina_test_rectangle.c
51 eina_test_sched.c 46 eina_test_safepointer.c
52 eina_test_simple_xml_parser.c 47 eina_test_sched.c
53 eina_test_slice.c 48 eina_test_simple_xml_parser.c
54 eina_test_slstr.c 49 eina_test_slice.c
55 eina_test_str.c 50 eina_test_slstr.c
56 eina_test_strbuf.c 51 eina_test_str.c
57 eina_test_stringshare.c 52 eina_test_strbuf.c
58 eina_test_tiler.c 53 eina_test_tiler.c
59 eina_test_tmpstr.c 54 eina_test_tmpstr.c
60 eina_test_trash.c 55 eina_test_trash.c
61 eina_test_ustr.c 56 eina_test_ustr.c
62 eina_test_ustringshare.c 57 eina_test_ustringshare.c
63 eina_test_util.c 58 eina_test_value.c
64 eina_test_value.c 59 eina_test_vector.c
65 eina_test_vector.c 60 eina_test_xattr.c
66 eina_test_xattr.c 61 )
67)
68 62
69add_executable(eina_suite "${eina_test_source}") \ No newline at end of file 63set(eina_suite_DEPENDS
64 eina_test_stringshare.c
65 eina_test_util.c
66 )