module: Re-implement using library constructors/destructors (#2018)
By using constructors/destructors we unify the case of static linking with that of dynamic linking, and we reuse the build flag FEATURE_INIT_FINI. Using constructors/destructors also allows us to cover the case where library constructor/destructor functionality is unavailable, because we can expose the module registration/unregistration functions as global symbols, to be called explicitly from within the application. Fixes https://github.com/jerryscript-project/jerryscript/issues/1952 JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
This commit is contained in:
committed by
Zoltan Herczeg
parent
8d916a44f1
commit
81952f3cd0
@@ -19,6 +19,10 @@ project (${JERRY_EXT_NAME} C)
|
||||
# Include directories
|
||||
set(INCLUDE_EXT "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
if(FEATURE_INIT_FINI)
|
||||
set(DEFINES_EXT ${DEFINES_EXT} ENABLE_INIT_FINI)
|
||||
endif()
|
||||
|
||||
# Source directories
|
||||
file(GLOB SOURCE_EXT_ARG arg/*.c)
|
||||
file(GLOB SOURCE_EXT_MODULE module/*.c)
|
||||
@@ -32,7 +36,7 @@ set(SOURCE_EXT
|
||||
add_library(${JERRY_EXT_NAME} STATIC ${SOURCE_EXT})
|
||||
|
||||
target_include_directories(${JERRY_EXT_NAME} PUBLIC ${INCLUDE_EXT})
|
||||
|
||||
target_compile_definitions(${JERRY_EXT_NAME} PUBLIC ${DEFINES_EXT})
|
||||
target_link_libraries(${JERRY_EXT_NAME} jerry-core)
|
||||
|
||||
install(TARGETS ${JERRY_EXT_NAME} DESTINATION lib)
|
||||
|
||||
Reference in New Issue
Block a user