summaryrefslogtreecommitdiff
path: root/cmake/config/common.cmake
blob: 25053f5d2cce00f69d6495159c2a077770253821 (plain) (blame)
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
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(FindPkgConfig)
include(CTest)
find_package(Threads REQUIRED)

pkg_check_modules(CHECK check)

EFL_OPTION(BUILD_PROFILE "How to build EFL" dev CHOICE release;dev;debug)
EFL_OPTION(EFL_NOLEGACY_API_SUPPORT "Whenever to disable non-Eo (Legacy) APIs" ON)
EFL_OPTION(EFL_EO_API_SUPPORT "Whenever to enable new Eo APIs" ON)
if(NOT EFL_EO_API_SUPPORT)
  EFL_OPTION_SET_MESSAGE(EFL_EO_API_SUPPORT "Risky!")
endif()



# BEGIN: HEADER, TYPE and FUNCTION CHECKS
# KEEP EACH BLOCK SORTED

HEADER_CHECK(asm/hwcap.h)
HEADER_CHECK(dirent.h)
HEADER_CHECK(execinfo.h)
HEADER_CHECK(libunwind.h NAME HAVE_UNWIND)
HEADER_CHECK(mcheck.h)
HEADER_CHECK(stdlib.h)
HEADER_CHECK(sys/auxv.h)
HEADER_CHECK(sys/mman.h)
HEADER_CHECK(sys/types.h)

FUNC_CHECK(clock_gettime INCLUDE_FILES time.h)
FUNC_CHECK(dirfd INCLUDE_FILES dirent.h sys/types.h)
FUNC_CHECK(dladdr INCLUDE_FILES dlfcn.h LIBRARIES dl DEFINITIONS "-D_GNU_SOURCE=1")
FUNC_CHECK(dlopen INCLUDE_FILES dlfcn.h LIBRARIES dl)
FUNC_CHECK(fchmod INCLUDE_FILES sys/stat.h)
FUNC_CHECK(fcntl INCLUDE_FILES fcntl.h)
FUNC_CHECK(fpathconf INCLUDE_FILES unistd.h)
FUNC_CHECK(fstatat NAME HAVE_ATFILE_SOURCE INCLUDE_FILES sys/stat.h)
FUNC_CHECK(geteuid INCLUDE_FILES unistd.h)
FUNC_CHECK(getpagesize INCLUDE_FILES unistd.h)
FUNC_CHECK(getuid INCLUDE_FILES unistd.h)
FUNC_CHECK(getxattr INCLUDE_FILES sys/types.h sys/xattr.h)
FUNC_CHECK(iconv INCLUDE_FILES iconv.h)
FUNC_CHECK(listxattr INCLUDE_FILES sys/types.h sys/xattr.h)
FUNC_CHECK(mmap INCLUDE_FILES sys/mman.h)
FUNC_CHECK(mtrace INCLUDE_FILES mcheck.h)
FUNC_CHECK(prctl INCLUDE_FILES sys/prctl.h)
FUNC_CHECK(sched_getcpu INCLUDE_FILES sched.h DEFINITIONS "-D_GNU_SOURCE=1")
FUNC_CHECK(setxattr INCLUDE_FILES sys/types.h sys/xattr.h)
FUNC_CHECK(shm_open INCLUDE_FILES sys/mman.h sys/stat.h fcntl.h LIBRARIES rt)
FUNC_CHECK(splice INCLUDE_FILES fcntl.h DEFINITIONS "-D_GNU_SOURCE=1")
FUNC_CHECK(strerror_r INCLUDE_FILES string.h)
FUNC_CHECK(strlcpy INCLUDE_FILES bsd/string.h)

TYPE_CHECK(siginfo_t INCLUDE_FILES signal.h)

# END: HEADER, TYPE and FUNCTION CHECKS


CHECK_APPEND_DEFINE(EFL_BETA_API_SUPPORT 1)
if(CMAKE_THREAD_LIBS_INIT)
  set(EFL_HAVE_THREADS 1)
endif()
CHECK_APPEND_DEFINE(EFL_HAVE_THREADS "${EFL_HAVE_THREADS}")

CHECK_APPEND_DEFINE(MODULE_ARCH "\"v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}\"")
CHECK_APPEND_DEFINE(SHARED_LIB_SUFFIX "\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
CHECK_APPEND_DEFINE(EXEEXT "\"${CMAKE_EXECUTABLE_SUFFIX}\"")

# TODO: change code and remove:
CHECK_APPEND_DEFINE(VMAJ ${PROJECT_VERSION_MAJOR})
CHECK_APPEND_DEFINE(VMIN ${PROJECT_VERSION_MINOR})
CHECK_APPEND_DEFINE(VMIC ${PROJECT_VERSION_PATCH})
CHECK_APPEND_DEFINE(VREV ${PROJECT_VERSION_TWEAK})