summaryrefslogtreecommitdiff
path: root/cmake/config/eina.cmake
blob: a91d76dc3e407a8297eda195d4a7502aca12b280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
SET_GLOBAL(EINA_SAFETY_CHECKS 1)
SET_GLOBAL(EINA_DEBUG_THREADS OFF)
SET_GLOBAL(ENABLE_VALGRIND OFF)
if("${BUILD_PROFILE}" STREQUAL "dev")
  SET_GLOBAL(EINA_STRINGSHARE_USAGE ON)
  SET_GLOBAL(CHECK_VALGRIND ON)
elseif("${BUILD_PROFILE}" STREQUAL "debug")
  SET_GLOBAL(EINA_DEBUG_MALLOC ON)
  SET_GLOBAL(EINA_COW_MAGIC_ON ON)
  SET_GLOBAL(EINA_DEFAULT_MEMPOOL ON)
  SET_GLOBAL(EINA_DEBUG_MALLOC ON)
  SET_GLOBAL(EINA_DEBUG_THREADS ON)
  SET_GLOBAL(ENABLE_VALGRIND ON)
elseif("${BUILD_PROFILE}" STREQUAL "release")
  SET_GLOBAL(EINA_LOG_LEVEL_MAXIMUM 3)
endif()

EFL_OPTION(EINA_MAGIC_DEBUG "magic debug of eina structure" ON)
EFL_OPTION(EINA_DEBUG_THREADS "debugging of eina threads" ${EINA_DEBUG_THREADS})
EFL_OPTION(ENABLE_VALGRIND "valgrind support" ${ENABLE_VALGRIND})

SET_GLOBAL(EINA_MODULE_TYPE_MP_PASS_THROUGH_DEFAULT "STATIC")

# TODO: change code to avoid these
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
  SET_GLOBAL(EINA_STATIC_BUILD_CHAINED_POOL 1)
endif()
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
  SET_GLOBAL(EINA_STATIC_BUILD_ONE_BIG 1)
endif()
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
  SET_GLOBAL(EINA_STATIC_BUILD_PASS_THROUGH 1)
endif()

#check for symbols in pthread
#TODO Make the definitions depending on the platform
SET_GLOBAL(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
SET_GLOBAL(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
CHECK_SYMBOL_EXISTS(pthread_barrier_init pthread.h EINA_HAVE_PTHREAD_BARRIER)
CHECK_SYMBOL_EXISTS(pthread_attr_setaffinity_np pthread.h EINA_HAVE_PTHREAD_AFFINITY)
CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h EINA_HAVE_PTHREAD_SETNAME)
CHECK_SYMBOL_EXISTS(pthread_spin_init pthread.h EINA_HAVE_POSIX_SPINLOCK)

#check for eina header files that are required
CHECK_INCLUDE_FILE(alloca.h EINA_HAVE_ALLOCA_H)
CHECK_INCLUDE_FILE(byteswap.h EINA_HAVE_BYTESWAP_H)
CHECK_INCLUDE_FILE(fnmatch.h EINA_HAVE_FNMATCH_H)
#only enable log when fnmatch is there
if (EINA_HAVE_FNMATCH_H)
  SET_GLOBAL(EINA_ENABLE_LOG 1)
endif (EINA_HAVE_FNMATCH_H)
CHECK_INCLUDE_FILE(dirent.h EINA_HAVE_DIRENT_H)

CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T)
CHECK_TYPE_SIZE("uintptr_t" EINA_SIZEOF_UINTPTR_T)
CHECK_TYPE_SIZE("wchar_t" EINA_SIZEOF_WCHAR_T)

#check for swap16/32/64
CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h EINA_HAVE_BSWAP16)
CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h EINA_HAVE_BSWAP32)
CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h EINA_HAVE_BSWAP64)

CHECK_SYMBOL_EXISTS(clock_gettime time.h HAVE_CLOCK_GETTIME)

if(ENABLE_VALGRIND)
  pkg_check_modules(VG REQUIRED valgrind)
  SET_GLOBAL(NVALGRIND OFF)
else()
  SET_GLOBAL(NVALGRIND ON)
endif()

#Check if there is the alloca header

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/eina/eina_config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/src/lib/eina/eina_config.h)