summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-21 22:12:42 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-23 18:23:40 +0100
commit6c87f62b90b1edd12087b7bdce78883b5d52c5e9 (patch)
tree31862c522d83b734e51145e85932c6ab0efc393b
parent23dddf8e1ce0d0ff14f15e2be0da8c9893f5e360 (diff)
build: make eina working
This brings in the checks for all the headers and function that are required in eina. With this commit only a few other checks are missing. This is NOT tested on windows or mac os i can just verify that it runs here on a arch linux system.
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/config/common.cmake20
-rw-r--r--cmake/config/eina.cmake2
-rw-r--r--cmake/helpers/CommonHeaderChecks.cmake80
-rw-r--r--src/lib/efl/config.h.cmake18
5 files changed, 114 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 756297dbb7..6604e12880 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,5 +45,5 @@ configure_file(
45configure_file( 45configure_file(
46 ${PROJECT_SOURCE_DIR}/src/lib/efl/Efl_Config.h.cmake 46 ${PROJECT_SOURCE_DIR}/src/lib/efl/Efl_Config.h.cmake
47 ${PROJECT_BINARY_DIR}/src/lib/efl/Efl_Config.h) 47 ${PROJECT_BINARY_DIR}/src/lib/efl/Efl_Config.h)
48 48EFL_HEADER_CHECKS_FINALIZE(${PROJECT_BINARY_DIR}/src/lib/efl/config_headers.h)
49EFL_FINALIZE() 49EFL_FINALIZE()
diff --git a/cmake/config/common.cmake b/cmake/config/common.cmake
index 5a89bc162e..270463d7b0 100644
--- a/cmake/config/common.cmake
+++ b/cmake/config/common.cmake
@@ -7,8 +7,6 @@ find_package(Threads REQUIRED)
7 7
8pkg_check_modules(CHECK check) 8pkg_check_modules(CHECK check)
9 9
10CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H)
11
12set(VMAJ ${PROJECT_VERSION_MAJOR}) 10set(VMAJ ${PROJECT_VERSION_MAJOR})
13set(VMIN ${PROJECT_VERSION_MINOR}) 11set(VMIN ${PROJECT_VERSION_MINOR})
14set(VMIC ${PROJECT_VERSION_PATCH}) 12set(VMIC ${PROJECT_VERSION_PATCH})
@@ -17,6 +15,13 @@ set(EFL_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
17set(EFL_VERSION_MINOR ${PROJECT_VERSION_MINOR}) 15set(EFL_VERSION_MINOR ${PROJECT_VERSION_MINOR})
18set(MODULE_ARCH "v-${VMAJ}.${VMIN}") 16set(MODULE_ARCH "v-${VMAJ}.${VMIN}")
19 17
18#change when on windows
19if (WIN32)
20 set(SHARED_LIB_SUFFIX ".dll")
21else()
22 set(SHARED_LIB_SUFFIX ".so")
23endif()
24
20EFL_OPTION(BUILD_PROFILE "How to build EFL" dev CHOICE release;dev;debug) 25EFL_OPTION(BUILD_PROFILE "How to build EFL" dev CHOICE release;dev;debug)
21EFL_OPTION(EFL_NOLEGACY_API_SUPPORT "Whenever to disable non-Eo (Legacy) APIs" ON) 26EFL_OPTION(EFL_NOLEGACY_API_SUPPORT "Whenever to disable non-Eo (Legacy) APIs" ON)
22EFL_OPTION(EFL_EO_API_SUPPORT "Whenever to enable new Eo APIs" ON) 27EFL_OPTION(EFL_EO_API_SUPPORT "Whenever to enable new Eo APIs" ON)
@@ -24,5 +29,16 @@ if(NOT EFL_EO_API_SUPPORT)
24 EFL_OPTION_SET_MESSAGE(EFL_EO_API_SUPPORT "Risky!") 29 EFL_OPTION_SET_MESSAGE(EFL_EO_API_SUPPORT "Risky!")
25endif() 30endif()
26 31
32
33#define all our header / function checks
34include(./CommonHeaderChecks)
35
36
27#this is needed to build efl 37#this is needed to build efl
28set(EFL_BETA_API_SUPPORT 1) 38set(EFL_BETA_API_SUPPORT 1)
39
40#if there are thread init support from cmake then efl has threads
41
42if (CMAKE_THREAD_LIBS_INIT)
43 set(EFL_HAVE_THREADS 1)
44endif() \ No newline at end of file
diff --git a/cmake/config/eina.cmake b/cmake/config/eina.cmake
index 6865f3b210..6a8f7d0d08 100644
--- a/cmake/config/eina.cmake
+++ b/cmake/config/eina.cmake
@@ -60,8 +60,6 @@ CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h EINA_HAVE_BSWAP16)
60CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h EINA_HAVE_BSWAP32) 60CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h EINA_HAVE_BSWAP32)
61CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h EINA_HAVE_BSWAP64) 61CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h EINA_HAVE_BSWAP64)
62 62
63CHECK_SYMBOL_EXISTS(clock_gettime time.h HAVE_CLOCK_GETTIME)
64
65if(ENABLE_VALGRIND) 63if(ENABLE_VALGRIND)
66 pkg_check_modules(VG REQUIRED valgrind) 64 pkg_check_modules(VG REQUIRED valgrind)
67 SET_GLOBAL(NVALGRIND OFF) 65 SET_GLOBAL(NVALGRIND OFF)
diff --git a/cmake/helpers/CommonHeaderChecks.cmake b/cmake/helpers/CommonHeaderChecks.cmake
new file mode 100644
index 0000000000..aab83f73f9
--- /dev/null
+++ b/cmake/helpers/CommonHeaderChecks.cmake
@@ -0,0 +1,80 @@
1unset(HEADER_FILE_CONTENT CACHE)
2
3macro(HEADER_CHECK header var)
4 CHECK_INCLUDE_FILE(${header} ${var})
5 if (${${var}})
6 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#define ${var} 1\n" CACHE INTERNAL "")
7 else()
8 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#undef ${var}\n" CACHE INTERNAL "")
9 endif()
10endmacro()
11
12macro(FUNC_CHECK func header var)
13 CHECK_SYMBOL_EXISTS(${func} ${header} ${var})
14 if (${${var}} )
15 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#define ${var} 1\n" CACHE INTERNAL "")
16 else()
17 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#undef ${var}\n" CACHE INTERNAL "")
18 endif()
19endmacro()
20
21macro(TYPE_CHECK func header var)
22 set(CMAKE_EXTRA_INCLUDE_FILES ${header})
23 CHECK_TYPE_SIZE(${func} ${var})
24 unset(CMAKE_EXTRA_INCLUDE_FILES)
25 if (${${var}} GREATER 0)
26 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#define ${var} 1\n" CACHE INTERNAL "")
27 else()
28 set(HEADER_FILE_CONTENT "${HEADER_FILE_CONTENT}#undef ${var}\n" CACHE INTERNAL "")
29 endif()
30endmacro()
31
32
33FUNC_CHECK(geteuid unistd.h HAVE_GETEUID)
34FUNC_CHECK(getuid unistd.h HAVE_GETUID)
35FUNC_CHECK(getpagesize unistd.h HAVE_GETPAGESIZE)
36FUNC_CHECK(strlcpy bsd/string.h HAVE_STRLCPY)
37FUNC_CHECK(mmap sys/mman.h HAVE_MMAP)
38FUNC_CHECK(fchmod sys/stat.h HAVE_FCHMOD)
39FUNC_CHECK(clock_gettime time.h HAVE_CLOCK_GETTIME)
40FUNC_CHECK(fstatat sys/stat.h HAVE_ATFILE_SOURCE)
41FUNC_CHECK(dirfd "dirent.h;sys/types.h" HAVE_DIRFD)
42FUNC_CHECK(fpathconf "unistd.h" HAVE_FPATHCONF)
43FUNC_CHECK(fpathconf "unistd.h" HAVE_FPATHCONF)
44FUNC_CHECK(listxattr "sys/types.h;sys/xattr.h" HAVE_LISTXATTR)
45FUNC_CHECK(setxattr "sys/types.h;sys/xattr.h" HAVE_SETXATTR)
46FUNC_CHECK(getxattr "sys/types.h;sys/xattr.h" HAVE_GETXATTR)
47
48set(CMAKE_REQUIRED_LIBRARIES "-ldl")
49FUNC_CHECK(dlopen dlfcn.h HAVE_DLOPEN)
50unset(CMAKE_REQUIRED_LIBRARIES)
51
52FUNC_CHECK(mtrace mcheck.h HAVE_MTRACE)
53FUNC_CHECK(strerror_r string.h HAVE_STRERROR_R)
54set(CMAKE_REQUIRED_LIBRARIES "-lrt")
55FUNC_CHECK(shm_open "sys/mman.h;sys/stat.h;fcntl.h" HAVE_SHM_OPEN)
56
57
58set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1")
59FUNC_CHECK(sched_getcpu sched.h HAVE_SCHED_GETCPU)
60FUNC_CHECK(splice fcntl.h HAVE_SPLICE)
61FUNC_CHECK(fcntl fcntl.h HAVE_FCNTL)
62set(CMAKE_REQUIRED_LIBRARIES "-ldl")
63FUNC_CHECK(dladdr dlfcn.h HAVE_DLADDR)
64
65TYPE_CHECK(siginfo_t signal.h HAVE_SIGINFO_T)
66
67HEADER_CHECK(stdlib.h HAVE_STDLIB_H)
68HEADER_CHECK(sys/mman.h HAVE_SYS_MMAN_H)
69HEADER_CHECK(dirent.h HAVE_DIRENT_H)
70HEADER_CHECK(iconv.h HAVE_ICONV_H)
71HEADER_CHECK(sys/auxv.h HAVE_SYS_AUXV_H)
72HEADER_CHECK(asm/hwcap.h HAVE_ASM_HWCAP_H)
73HEADER_CHECK(mcheck.h HAVE_MCHECK_H)
74HEADER_CHECK(sys/types.h HAVE_SYS_TYPES_H)
75HEADER_CHECK(execinfo.h HAVE_EXECINFO_H)
76HEADER_CHECK(libunwind.h HAVE_UNWIND)
77
78function(EFL_HEADER_CHECKS_FINALIZE file)
79 file(WRITE ${file} ${HEADER_FILE_CONTENT})
80endfunction() \ No newline at end of file
diff --git a/src/lib/efl/config.h.cmake b/src/lib/efl/config.h.cmake
index 7b26ea35ca..2331f4ba5a 100644
--- a/src/lib/efl/config.h.cmake
+++ b/src/lib/efl/config.h.cmake
@@ -2,7 +2,8 @@
2#define CONFIG_H 2#define CONFIG_H
3 3
4#define _GNU_SOURCE 4#define _GNU_SOURCE
5#cmakedefine HAVE_SYS_MMAN_H 1 5
6#include "config_headers.h"
6 7
7#define VMAJ @VMAJ@ 8#define VMAJ @VMAJ@
8#define VMIN @VMIN@ 9#define VMIN @VMIN@
@@ -10,13 +11,24 @@
10#define VREV @VREV@ 11#define VREV @VREV@
11 12
12#cmakedefine NVALGRIND 1 13#cmakedefine NVALGRIND 1
13#cmakedefine HAVE_CLOCK_GETTIME 1
14 14
15#cmakedefine EINA_STATIC_BUILD_CHAINED_POOL 1 15#cmakedefine EINA_STATIC_BUILD_CHAINED_POOL 1
16#cmakedefine EINA_STATIC_BUILD_ONE_BIG 1 16#cmakedefine EINA_STATIC_BUILD_ONE_BIG 1
17#cmakedefine EINA_STATIC_BUILD_PASS_THROUGH 1 17#cmakedefine EINA_STATIC_BUILD_PASS_THROUGH 1
18 18
19#define MODULE_ARCH "@MODULE_ARCH@" 19#define MODULE_ARCH "@MODULE_ARCH@"
20#define SHARED_LIB_SUFFIX "bla" 20#define SHARED_LIB_SUFFIX "@SHARED_LIB_SUFFIX@"
21
22#if defined (HAVE_LISTXATTR) && defined (HAVE_SETXATTR) && defined (HAVE_GETXATTR)
23#define HAVE_XATTR
24#endif
25
26//for now statically define that to one
27#define STRERROR_R_CHAR_P 1
28
29#cmakedefine EFL_ALWAYS_INLINE @EFL_ALWAYS_INLINE@
30#cmakedefine EFL_HAVE_OSX_SPINLOCK 1
31#cmakedefine EFL_HAVE_POSIX_THREADS_SPINLOCK 1
32#cmakedefine EFL_HAVE_THREADS 1
21 33
22#endif 34#endif