diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..12dd0a87dd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.7) +project(eflgeneric) + +ADD_DEFINITIONS("-DHAVE_CONFIG_H") + +add_subdirectory(src) + +CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H) + +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 19) +set(PROJECT_VERSION_PATCH 99) +set(PROJECT_VERSION_TWEAK 00) + +set(VMAJ ${PROJECT_VERSION_MAJOR}) +set(VMIN ${PROJECT_VERSION_MINOR}) +set(VMIC ${PROJECT_VERSION_PATCH}) +set(VREV ${PROJECT_VERSION_TWEAK}) +configure_file(config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000000..ca8a2bd974 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,16 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#define _GNU_SOURCE +#cmakedefine HAVE_SYS_MMAN_H 1 + +#cmakedefine VMAJ @VMAJ@ +#cmakedefine VMIN @VMIN@ +#cmakedefine VMIC @VMIC@ +#cmakedefine VREV @VREV@ + +#define PACKAGE_LIB_DIR "bla" +#define MODULE_ARCH "bla" +#define SHARED_LIB_SUFFIX "bla" + +#endif \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000..3125acd562 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,2 @@ +include(CMakeLists_Eina.txt) +add_subdirectory(lib/efl/) \ No newline at end of file diff --git a/src/CMakeLists_Eina.txt b/src/CMakeLists_Eina.txt new file mode 100644 index 0000000000..f763d675b9 --- /dev/null +++ b/src/CMakeLists_Eina.txt @@ -0,0 +1,11 @@ +INCLUDE (FindPkgConfig) + +set(EINA_STATIC_BUILD_CHAINED_POOL 1) +set(EINA_STATIC_BUILD_ONE_BIG 1) +set(EINA_STATIC_BUILD_PASS_THROUGH 1) + +pkg_check_modules(VG REQUIRED valgrind) + +add_subdirectory(lib/eina) +add_subdirectory(modules/eina) +add_subdirectory(tests/eina) \ No newline at end of file diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000000..288b6c7b1c --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(eina) \ No newline at end of file diff --git a/src/lib/efl/CMakeLists-Config.txt b/src/lib/efl/CMakeLists-Config.txt new file mode 100644 index 0000000000..5518815552 --- /dev/null +++ b/src/lib/efl/CMakeLists-Config.txt @@ -0,0 +1,9 @@ +#TODO ask for api mode +set(EFL_NOLEGACY_API_SUPPORT 1) +set(EFL_EO_API_SUPPORT 1) + +set(EFL_VERSION_MAJOR 1) +set(EFL_VERSION_MINOR 19) +set(EFL_BUILD_ID 120) + +configure_file(Efl_Config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/Efl_Config.h) \ No newline at end of file diff --git a/src/lib/efl/CMakeLists.txt b/src/lib/efl/CMakeLists.txt new file mode 100644 index 0000000000..3dfdde666f --- /dev/null +++ b/src/lib/efl/CMakeLists.txt @@ -0,0 +1 @@ +include(CMakeLists-Config.txt) \ No newline at end of file diff --git a/src/lib/efl/Efl_Config.h.cmake b/src/lib/efl/Efl_Config.h.cmake new file mode 100644 index 0000000000..f068588125 --- /dev/null +++ b/src/lib/efl/Efl_Config.h.cmake @@ -0,0 +1,19 @@ +#ifndef EFL_CONFIG_H +#define EFL_CONFIG_H + +/* Add -DEFL_API_OVERRIDE ot your CFLAGS to override the default + * installed api set and then fter that -DEFL_NOLEGACY_API_SUPPORT + * and/or -DEFL_EO_API_SUPPORT as desired + */ +#ifndef EFL_API_OVERRIDE +#cmakedefine EFL_API_LEGACY_DEF +#cmakedefine EFL_EO_API_SUPPORT +/* You can't disable Eo API anymore as EFL use it everywhere internally + and we don't want to expose it publicly just yet, so keep it hidden + and require an explicit request to get it. */ +#endif + +#cmakedefine EFL_VERSION_MAJOR @EFL_VERSION_MAJOR@ +#cmakedefine EFL_VERSION_MINOR @EFL_VERSION_MINOR@ +#cmakedefine EFL_BUILD_ID "@EFL_BUILD_ID@" +#endif diff --git a/src/lib/eina/CMakeLists.txt b/src/lib/eina/CMakeLists.txt new file mode 100644 index 0000000000..56b6f6733d --- /dev/null +++ b/src/lib/eina/CMakeLists.txt @@ -0,0 +1,214 @@ +INCLUDE (CheckSymbolExists) +INCLUDE (CheckIncludeFile) +INCLUDE (CheckTypeSize) +INCLUDE (FindPkgConfig) +find_package(Threads REQUIRED) + +#Configure depending on the profile +set(EINA_SAFETY_CHECKS 1) +if ("${BUILD_PROFILE}" STREQUAL "dev") + set(EINA_STRINGSHARE_USAGE ON) + set(CHECK_VALGRIND ON) +elseif ("${BUILD_PROFILE}" STREQUAL "debug") + set(EINA_DEBUG_MALLOC ON) + set(EINA_COW_MAGIC_ON ON) + set(EINA_DEFAULT_MEMPOOL ON) + set(EINA_DEBUG_MALLOC ON) + set(EINA_DEBUG_THREADS ON) + set(VALGRIND ON) +elseif ("${BUILD_PROFILE}" STREQUAL "release") + set(EINA_LOG_LEVEL_MAXIMUM 3) +endif ("${BUILD_PROFILE}" STREQUAL "dev") + +#options of that submodule +option(EINA_MAGIC_DEBUG "magic debug of eina structure" ON) +option(EINA_DEBUG_THREADS "debugging of eina threads" ${EINA_DEBUG_THREADS}) +option(VALGRIND "valgrind support" ${VALGRIND}) + +#check for symbols in pthread +#TODO Make the definitions depending on the platform +set(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}") +set(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(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) + +#TODO really check if we wanted to have valgrind support or not +pkg_check_modules(VG REQUIRED valgrind) + +#Check if there is the alloca header + +configure_file(eina_config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/eina_config.h) + +include_directories( + ${PROJECT_SOURCE_DIR}/ + ${VG_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/lib/efl + ${PROJECT_SOURCE_DIR}/src/lib/eina +) + +LIST(APPEND eina_source + Eina.h + eina_abi.c + eina_accessor.c + eina_accessor.h + eina_alloca.h + eina_array.c + eina_array.h + eina_benchmark.c + eina_benchmark.h + eina_bezier.c + eina_bezier.h + eina_binbuf.c + eina_binbuf.h + eina_binshare.c + eina_binshare.h + eina_clist.h + eina_config.h + eina_convert.c + eina_convert.h + eina_counter.c + eina_counter.h + eina_cow.c + eina_cow.h + eina_cpu.c + eina_cpu.h + eina_crc.c + eina_crc.h + eina_debug.c + eina_debug.h + eina_debug_bt.c + eina_debug_bt_file.c + eina_debug_chunk.c + eina_debug_monitor.c + eina_debug_proto.c + eina_debug_thread.c + eina_error.c + eina_error.h + eina_evlog.c + eina_evlog.h + eina_file.c + eina_file.h + eina_file_common.c + eina_file_common.h + eina_fp.c + eina_fp.h + eina_freeq.c + eina_freeq.h + eina_hamster.c + eina_hamster.h + eina_hash.c + eina_hash.h + eina_inarray.c + eina_inarray.h + eina_inline_private.h + eina_inlist.c + eina_inlist.h + eina_iterator.c + eina_iterator.h + eina_lalloc.c + eina_lalloc.h + eina_list.c + eina_list.h + eina_lock.c + eina_lock.h + eina_log.c + eina_log.h + eina_magic.c + eina_magic.h + eina_main.c + eina_main.h + eina_matrix.c + eina_matrix.h + eina_matrixsparse.c + eina_matrixsparse.h + eina_mempool.c + eina_mempool.h + eina_mmap.c + eina_mmap.h + eina_module.c + eina_module.h + eina_prefix.c + eina_prefix.h + eina_private.h + eina_quad.c + eina_quad.h + eina_quadtree.c + eina_quadtree.h + eina_quaternion.c + eina_quaternion.h + eina_rbtree.c + eina_rbtree.h + eina_rectangle.c + eina_rectangle.h + eina_refcount.h + eina_safepointer.c + eina_safepointer.h + eina_safety_checks.c + eina_safety_checks.h + eina_sched.c + eina_sched.h + eina_share_common.c + eina_share_common.h + eina_simple_xml_parser.c + eina_simple_xml_parser.h + eina_slice.h + eina_slstr.c + eina_slstr.h + eina_str.c + eina_str.h + eina_strbuf.c + eina_strbuf.h + eina_strbuf_common.c + eina_strbuf_common.h + eina_strbuf_template_c.x + eina_stringshare.c + eina_stringshare.h + eina_thread.c + eina_thread.h + eina_thread_queue.c + eina_thread_queue.h + eina_tiler.c + eina_tiler.h + eina_tmpstr.c + eina_tmpstr.h + eina_trash.h + eina_types.h + eina_unicode.c + eina_unicode.h + eina_ustrbuf.c + eina_ustrbuf.h + eina_ustringshare.c + eina_ustringshare.h + eina_util.c + eina_util.h + eina_value.c + eina_value.h + eina_value_util.c + eina_value_util.h + eina_vector.h + eina_xattr.c + eina_xattr.h +) + +add_library(eina SHARED ${eina_source}) \ No newline at end of file diff --git a/src/lib/eina/eina_config.h.cmake b/src/lib/eina/eina_config.h.cmake new file mode 100644 index 0000000000..a4aac7d99f --- /dev/null +++ b/src/lib/eina/eina_config.h.cmake @@ -0,0 +1,145 @@ +/* EINA - EFL data type library + * Copyright (C) 2008 Cedric Bail + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see . + */ + +#ifndef EINA_CONFIG_H_ +#define EINA_CONFIG_H_ + +#ifdef HAVE_EXOTIC +# include +#endif + +#ifdef EINA_MAGIC_DEBUG +# undef EINA_MAGIC_DEBUG +#endif +#cmakedefine EINA_MAGIC_DEBUG + +#ifndef EINA_DEFAULT_MEMPOOL +# undef EINA_DEFAULT_MEMPOOL +#endif +#cmakedefine EINA_DEFAULT_MEMPOOL + +#ifdef EINA_SAFETY_CHECKS +# undef EINA_SAFETY_CHECKS +#endif +#cmakedefine EINA_SAFETY_CHECKS + +#ifndef EINA_HAVE_THREADS +#define EINA_HAVE_THREADS +#endif + +#ifdef EINA_HAVE_PTHREAD_AFFINITY +# undef EINA_HAVE_PTHREAD_AFFINITY +#endif +#cmakedefine EINA_HAVE_PTHREAD_AFFINITY + +#ifdef EINA_HAVE_PTHREAD_BARRIER +# undef EINA_HAVE_PTHREAD_BARRIER +#endif +#cmakedefine EINA_HAVE_PTHREAD_BARRIER + +#ifdef EINA_HAVE_PTHREAD_SETNAME +# undef EINA_HAVE_PTHREAD_SETNAME +#endif +#cmakedefine EINA_HAVE_PTHREAD_SETNAME + +#ifdef EINA_HAVE_DEBUG_THREADS +# undef EINA_HAVE_DEBUG_THREADS +#endif +#cmakedefine EINA_HAVE_DEBUG_THREADS + +#ifdef EINA_SIZEOF_WCHAR_T +# undef EINA_SIZEOF_WCHAR_T +#endif +#cmakedefine EINA_SIZEOF_WCHAR_T @EINA_SIZEOF_WCHAR_T@ + +#ifdef EINA_SIZEOF_UINTPTR_T +# undef EINA_SIZEOF_UINTPTR_T +#endif +#cmakedefine EINA_SIZEOF_UINTPTR_T @EINA_SIZEOF_UINTPTR_T@ + +#ifdef EINA_CONFIGURE_HAVE_DIRENT_H +# undef EINA_CONFIGURE_HAVE_DIRENT_H +#endif +#cmakedefine EINA_HAVE_DIRENT_H + +#ifdef EINA_CONFIGURE_ENABLE_LOG +# undef EINA_CONFIGURE_ENABLE_LOG +#endif +#cmakedefine EINA_ENABLE_LOG + +#ifdef EINA_HAVE_ALLOCA_H +# undef EINA_HAVE_ALLOCA_H +#endif +#cmakedefine EINA_HAVE_ALLOCA_H + +#ifdef EINA_HAVE_BSWAP16 +# undef EINA_HAVE_BSWAP16 +#endif +#cmakedefine EINA_HAVE_BSWAP16 + +#ifdef EINA_HAVE_BSWAP32 +# undef EINA_HAVE_BSWAP32 +#endif +#cmakedefine EINA_HAVE_BSWAP32 + +#ifdef EINA_HAVE_BSWAP64 +# undef EINA_HAVE_BSWAP64 +#endif +#cmakedefine EINA_HAVE_BSWAP64 + +#ifdef EINA_HAVE_BYTESWAP_H +# undef EINA_HAVE_BYTESWAP_H +#endif +#cmakedefine EINA_HAVE_BYTESWAP_H + +#ifdef EINA_HAVE_POSIX_SPINLOCK +# undef EINA_HAVE_POSIX_SPINLOCK +#endif +#cmakedefine EINA_HAVE_POSIX_SPINLOCK + +#ifndef EINA_HAVE_OSX_SPINLOCK +# undef EINA_HAVE_OSX_SPINLOCK +#endif +@EINA_CONFIGURE_HAVE_OSX_SPINLOCK@ + +#ifndef EINA_HAVE_OSX_SEMAPHORE +# undef EINA_HAVE_OSX_SEMAPHORE +#endif +@EINA_CONFIGURE_HAVE_OSX_SEMAPHORE@ + +#include + +#ifndef __WORDSIZE +# if defined(__OPENBSD__) && (INTPTR_MAX == INT32_MAX) +# define __WORDSIZE 32 +# else +# define __WORDSIZE 64 +# endif +#endif + +/* Do not turn the following #define as meaning EFL64. We are only + interested to know if sizeof (void*) == 64bits or not. Those means + something else. + + defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64) + */ +#if defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(__ppc64__) +# define EFL64 +#endif + +#endif /* EINA_CONFIG_H_ */ diff --git a/src/modules/eina/CMakeLists.txt b/src/modules/eina/CMakeLists.txt new file mode 100644 index 0000000000..493816291e --- /dev/null +++ b/src/modules/eina/CMakeLists.txt @@ -0,0 +1,20 @@ +include_directories( +${PROJECT_SOURCE_DIR}/ +${PROJECT_SOURCE_DIR}/src/lib/eina +${PROJECT_SOURCE_DIR}/src/lib/efl +${VG_INCLUDE_DIRS} +) + +if (EINA_STATIC_BUILD_PASS_THROUGH) + add_library(pass_through MODULE "mp/pass_through/eina_pass_through.c") +endif(EINA_STATIC_BUILD_PASS_THROUGH) + + +if (EINA_STATIC_BUILD_ONE_BIG) + add_library(one_big MODULE mp/one_big/eina_one_big.c) +endif(EINA_STATIC_BUILD_ONE_BIG) + + +if (EINA_STATIC_BUILD_CHAINED_POOL) + add_library(chained_pool MODULE mp/chained_pool/eina_chained_mempool.c) +endif(EINA_STATIC_BUILD_CHAINED_POOL) \ No newline at end of file diff --git a/src/tests/eina/CMakeLists.txt b/src/tests/eina/CMakeLists.txt new file mode 100644 index 0000000000..358f13ed83 --- /dev/null +++ b/src/tests/eina/CMakeLists.txt @@ -0,0 +1,69 @@ +include_directories( + ${PROJECT_SOURCE_DIR}/ + ${PROJECT_SOURCE_DIR}/src/lib/eina/ + ${PROJECT_SOURCE_DIR}/src/lib/efl/ +) + +add_definitions("-DTESTS_BUILD_DIR=\"1\"") +add_definitions("-DPACKAGE_BUILD_DIR=\"1\"") + +list(APPEND eina_test_source + eina_suite.c + eina_suite.h + eina_test_abi.c + eina_test_accessor.c + eina_test_array.c + eina_test_barrier.c + eina_test_benchmark.c + eina_test_bezier.c + eina_test_binbuf.c + eina_test_binshare.c + eina_test_clist.c + eina_test_convert.c + eina_test_counter.c + eina_test_cow.c + eina_test_crc.c + eina_test_error.c + eina_test_file.c + eina_test_fp.c + eina_test_freeq.c + eina_test_hash.c + eina_test_inarray.c + eina_test_inlist.c + eina_test_iterator.c + eina_test_lalloc.c + eina_test_list.c + eina_test_lock.c + eina_test_log.c + eina_test_magic.c + eina_test_main.c + eina_test_matrix.c + eina_test_matrixsparse.c + eina_test_mempool.c + eina_test_module.c + eina_test_module_dummy.c + eina_test_quad.c + eina_test_quadtree.c + eina_test_quaternion.c + eina_test_rbtree.c + eina_test_rectangle.c + eina_test_safepointer.c + eina_test_sched.c + eina_test_simple_xml_parser.c + eina_test_slice.c + eina_test_slstr.c + eina_test_str.c + eina_test_strbuf.c + eina_test_stringshare.c + eina_test_tiler.c + eina_test_tmpstr.c + eina_test_trash.c + eina_test_ustr.c + eina_test_ustringshare.c + eina_test_util.c + eina_test_value.c + eina_test_vector.c + eina_test_xattr.c +) + +add_executable(eina_suite "${eina_test_source}") \ No newline at end of file