forked from enlightenment/efl
EflMacros: automatically provide ON;OFF;STATIC option and defines.
Automatically create one option to enable, disable or make it statically linked into the code, with a define to reflect build type.
This commit is contained in:
parent
308c8c4ef7
commit
8df6ac453d
|
@ -19,17 +19,16 @@ 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(EINA_DEBUG_THREADS "debugging of eina threads" ${EINA_DEBUG_THREADS})
|
||||||
EFL_OPTION(ENABLE_VALGRIND "valgrind support" ${ENABLE_VALGRIND})
|
EFL_OPTION(ENABLE_VALGRIND "valgrind support" ${ENABLE_VALGRIND})
|
||||||
|
|
||||||
EFL_OPTION(EINA_BUILD_CHAINED "Build Eina's chained mempool" "ON" CHOICE ON;OFF;STATIC)
|
SET_GLOBAL(EINA_MODULE_TYPE_MP_PASS_THROUGH_DEFAULT "STATIC")
|
||||||
EFL_OPTION(EINA_BUILD_ONE_BIG "Build Eina's one-big mempool" "ON" CHOICE ON;OFF;STATIC)
|
|
||||||
EFL_OPTION(EINA_BUILD_PASS_THROUGH "Build Eina's pass-through mempool" "STATIC" CHOICE ON;OFF;STATIC)
|
|
||||||
|
|
||||||
if(EINA_BUILD_CHAINED STREQUAL "STATIC")
|
# TODO: change code to avoid these
|
||||||
|
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
|
||||||
SET_GLOBAL(EINA_STATIC_BUILD_CHAINED_POOL 1)
|
SET_GLOBAL(EINA_STATIC_BUILD_CHAINED_POOL 1)
|
||||||
endif()
|
endif()
|
||||||
if(EINA_BUILD_ONE_BIG STREQUAL "STATIC")
|
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
|
||||||
SET_GLOBAL(EINA_STATIC_BUILD_ONE_BIG 1)
|
SET_GLOBAL(EINA_STATIC_BUILD_ONE_BIG 1)
|
||||||
endif()
|
endif()
|
||||||
if(EINA_BUILD_PASS_THROUGH STREQUAL "STATIC")
|
if(EINA_MODULE_TYPE_MP_PASS_THROUGH STREQUAL "STATIC")
|
||||||
SET_GLOBAL(EINA_STATIC_BUILD_PASS_THROUGH 1)
|
SET_GLOBAL(EINA_STATIC_BUILD_PASS_THROUGH 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -778,11 +778,21 @@ function(EFL_MODULE _modname)
|
||||||
set(_modoutdir lib/${EFL_LIB_CURRENT}/modules/${EFL_MODULE_SCOPE}/${_modname}/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
set(_modoutdir lib/${EFL_LIB_CURRENT}/modules/${EFL_MODULE_SCOPE}/${_modname}/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||||
set(_modbindir ${EFL_MODULES_BINARY_DIR}/${EFL_MODULE_SCOPE}/${_modname})
|
set(_modbindir ${EFL_MODULES_BINARY_DIR}/${EFL_MODULE_SCOPE}/${_modname})
|
||||||
set(_modtarget ${EFL_LIB_CURRENT}-module-${EFL_MODULE_SCOPE}-${_modname})
|
set(_modtarget ${EFL_LIB_CURRENT}-module-${EFL_MODULE_SCOPE}-${_modname})
|
||||||
|
string(TOUPPER "${EFL_LIB_CURRENT}_MODULE_TYPE_${EFL_MODULE_SCOPE}_${_modname}" _modoptionname)
|
||||||
|
if(NOT ${_modoptionname}_DEFAULT)
|
||||||
|
set(${_modoptionname}_DEFAULT "ON")
|
||||||
|
endif()
|
||||||
|
EFL_OPTION(${_modoptionname} "Build ${EFL_LIB_CURRENT} module ${EFL_MODULE_SCOPE}/${_modname}" ${${_modoptionname}_DEFAULT} CHOICE ON;OFF;STATIC)
|
||||||
else()
|
else()
|
||||||
set(_modsrcdir ${EFL_MODULES_SOURCE_DIR}/${_modname})
|
set(_modsrcdir ${EFL_MODULES_SOURCE_DIR}/${_modname})
|
||||||
set(_modoutdir lib/${EFL_LIB_CURRENT}/modules/${_modname}/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
set(_modoutdir lib/${EFL_LIB_CURRENT}/modules/${_modname}/v-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||||
set(_modbindir ${EFL_MODULES_BINARY_DIR}/${_modname})
|
set(_modbindir ${EFL_MODULES_BINARY_DIR}/${_modname})
|
||||||
set(_modtarget ${EFL_LIB_CURRENT}-module-${_modname})
|
set(_modtarget ${EFL_LIB_CURRENT}-module-${_modname})
|
||||||
|
string(TOUPPER "${EFL_LIB_CURRENT}_MODULE_TYPE_${_modname}" _modoptionname)
|
||||||
|
if(NOT ${_modoptionname}_DEFAULT)
|
||||||
|
set(${_modoptionname}_DEFAULT "ON")
|
||||||
|
endif()
|
||||||
|
EFL_OPTION(${_modoptionname} "Build ${EFL_LIB_CURRENT} module ${_modname}" ${${_modoptionname}_DEFAULT} CHOICE ON;OFF;STATIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SOURCES)
|
set(SOURCES)
|
||||||
|
@ -791,7 +801,7 @@ function(EFL_MODULE _modname)
|
||||||
set(INCLUDE_DIRECTORIES)
|
set(INCLUDE_DIRECTORIES)
|
||||||
set(SYSTEM_INCLUDE_DIRECTORIES)
|
set(SYSTEM_INCLUDE_DIRECTORIES)
|
||||||
set(DEFINITIONS)
|
set(DEFINITIONS)
|
||||||
set(MODULE_TYPE "ON")
|
set(MODULE_TYPE "${${_modoptionname}}")
|
||||||
set(INSTALL_DIR ${_modoutdir})
|
set(INSTALL_DIR ${_modoutdir})
|
||||||
|
|
||||||
_EFL_INCLUDE_OR_DETECT("Module ${_modtarget}" ${_modsrcdir})
|
_EFL_INCLUDE_OR_DETECT("Module ${_modtarget}" ${_modsrcdir})
|
||||||
|
@ -838,6 +848,7 @@ function(EFL_MODULE _modname)
|
||||||
|
|
||||||
if("${MODULE_TYPE}" STREQUAL "STATIC")
|
if("${MODULE_TYPE}" STREQUAL "STATIC")
|
||||||
target_link_libraries(${EFL_LIB_CURRENT} LINK_PRIVATE ${_modtarget})
|
target_link_libraries(${EFL_LIB_CURRENT} LINK_PRIVATE ${_modtarget})
|
||||||
|
target_compile_definitions(${EFL_LIB_CURRENT} PRIVATE "-D${_modoptionname}_STATIC=1")
|
||||||
target_include_directories(${_modtarget} PRIVATE
|
target_include_directories(${_modtarget} PRIVATE
|
||||||
${EFL_LIB_SOURCE_DIR}
|
${EFL_LIB_SOURCE_DIR}
|
||||||
${EFL_LIB_BINARY_DIR})
|
${EFL_LIB_BINARY_DIR})
|
||||||
|
@ -847,6 +858,7 @@ function(EFL_MODULE _modname)
|
||||||
LIST_APPEND_GLOBAL(${EFL_LIB_CURRENT}_STATIC_MODULES ${_modtarget})
|
LIST_APPEND_GLOBAL(${EFL_LIB_CURRENT}_STATIC_MODULES ${_modtarget})
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${_modtarget} LINK_PRIVATE ${EFL_LIB_CURRENT})
|
target_link_libraries(${_modtarget} LINK_PRIVATE ${EFL_LIB_CURRENT})
|
||||||
|
target_compile_definitions(${EFL_LIB_CURRENT} PRIVATE "-D${_modoptionname}_DYNAMIC=1")
|
||||||
LIST_APPEND_GLOBAL(${EFL_LIB_CURRENT}_MODULES ${_modtarget})
|
LIST_APPEND_GLOBAL(${EFL_LIB_CURRENT}_MODULES ${_modtarget})
|
||||||
if(INSTALL_DIR)
|
if(INSTALL_DIR)
|
||||||
install(TARGETS ${_modtarget} LIBRARY DESTINATION "${INSTALL_DIR}")
|
install(TARGETS ${_modtarget} LIBRARY DESTINATION "${INSTALL_DIR}")
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
set(MODULE_TYPE ${EINA_BUILD_CHAINED})
|
|
||||||
set(SOURCES eina_chained_mempool.c)
|
|
|
@ -1,2 +0,0 @@
|
||||||
set(MODULE_TYPE ${EINA_BUILD_ONE_BIG})
|
|
||||||
set(SOURCES eina_one_big.c)
|
|
|
@ -1,2 +0,0 @@
|
||||||
set(MODULE_TYPE ${EINA_BUILD_PASS_THROUGH})
|
|
||||||
set(SOURCES eina_pass_through.c)
|
|
Loading…
Reference in New Issue