Skip to content

Commit

Permalink
Add versioning information for libraries and executables across multi…
Browse files Browse the repository at this point in the history
…ple platforms
  • Loading branch information
lum1n0us committed Dec 24, 2024
1 parent c38af70 commit 56b0434
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions product-mini/platforms/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)

add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (vmlib)

set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
Expand Down Expand Up @@ -135,6 +137,7 @@ endif()

set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution)
set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib")
set_version_info (iwasm)

add_custom_command (TARGET iwasm POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/"
Expand Down
5 changes: 5 additions & 0 deletions product-mini/platforms/cosmopolitan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
check_pie_supported()
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_version_info (vmlib)

set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")

Expand Down Expand Up @@ -160,6 +161,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)

install (TARGETS iwasm DESTINATION bin)
Expand All @@ -168,6 +171,8 @@ target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN

add_library (libiwasm STATIC ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (libiwasm)

install (TARGETS libiwasm DESTINATION lib)

set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
Expand Down
5 changes: 5 additions & 0 deletions product-mini/platforms/darwin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info (vmlib)

include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

install (TARGETS iwasm DESTINATION bin)

target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
Expand All @@ -131,5 +134,7 @@ install (TARGETS libiwasm DESTINATION lib)

set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)

set_version_info (libiwasm)

target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)

5 changes: 5 additions & 0 deletions product-mini/platforms/freebsd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info (vmlib)

include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

install (TARGETS iwasm DESTINATION bin)

target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)

add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (libiwasm)

install (TARGETS libiwasm DESTINATION lib)

set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
Expand Down
1 change: 1 addition & 0 deletions product-mini/platforms/ios/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ endif()

set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution)
set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib")
set_version_info (iwasm)

add_custom_command (TARGET iwasm POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/"
Expand Down
1 change: 1 addition & 0 deletions product-mini/platforms/linux-sgx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info (vmlib)

add_custom_command (
OUTPUT libvmlib_untrusted.a
Expand Down
1 change: 1 addition & 0 deletions product-mini/platforms/linux-sgx/CMakeLists_minimal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info (vmlib)

add_custom_command (
OUTPUT libvmlib_untrusted.a
Expand Down
2 changes: 2 additions & 0 deletions product-mini/platforms/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ endif ()
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand All @@ -186,6 +187,7 @@ target_link_libraries(iwasm
install (TARGETS iwasm DESTINATION bin)

add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (libiwasm)

install (TARGETS libiwasm DESTINATION lib)
Expand Down
2 changes: 2 additions & 0 deletions product-mini/platforms/riot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ include_directories(SYSTEM ${RIOT_INCLUDES_LIST})
# executable linking is done by RIOT build system

add_library( wamr ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (wamr)
5 changes: 5 additions & 0 deletions product-mini/platforms/vxworks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info (vmlib)

include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

install (TARGETS iwasm DESTINATION bin)

target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix)

add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (libiwasm)

install (TARGETS libiwasm DESTINATION lib)

set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm)
Expand Down
5 changes: 5 additions & 0 deletions product-mini/platforms/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)

include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_version_info(vmlib)

#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
if (NOT MINGW)
Expand Down Expand Up @@ -134,6 +135,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)

add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE})

set_version_info (iwasm)

install (TARGETS iwasm DESTINATION bin)

target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS})
Expand All @@ -144,6 +147,8 @@ endif ()

add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})

set_version_info (libiwasm)

install (TARGETS libiwasm DESTINATION lib)

set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm)
Expand Down
1 change: 1 addition & 0 deletions wamr-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ add_library (aotclib ${IWASM_COMPL_SOURCE})
add_executable (wamrc main.c)
check_pie_supported()
set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_version_info (wamrc)

if (LLVM_LINK_LLVM_DYLIB)
set(WAMRC_LINK_LLVM_LIBS LLVM)
Expand Down

0 comments on commit 56b0434

Please sign in to comment.