mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 06:55:07 +00:00
Add versioning support and update CMake configuration
This commit is contained in:
parent
67cd5043d3
commit
e64685f43c
|
@ -174,6 +174,7 @@ if (WAMR_BUILD_STATIC)
|
|||
target_link_libraries(iwasm_static PRIVATE ntdll)
|
||||
endif()
|
||||
|
||||
set_version_info (iwasm_static)
|
||||
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
|
||||
endif ()
|
||||
|
||||
|
@ -196,6 +197,7 @@ if (WAMR_BUILD_SHARED)
|
|||
target_link_libraries(iwasm_shared PRIVATE ntdll)
|
||||
endif()
|
||||
|
||||
set_version_info (iwasm_shared)
|
||||
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
|
||||
endif ()
|
||||
|
||||
|
@ -204,4 +206,5 @@ install (FILES
|
|||
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
|
||||
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
|
||||
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
|
||||
${WAMR_ROOT_DIR}/core/version.h
|
||||
DESTINATION include)
|
||||
|
|
|
@ -131,6 +131,9 @@ else ()
|
|||
unset (LLVM_AVAILABLE_LIBS)
|
||||
endif ()
|
||||
|
||||
# Version
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/version.cmake)
|
||||
|
||||
# Sanitizers
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SANITIZER)
|
||||
|
|
25
build-scripts/version.cmake
Normal file
25
build-scripts/version.cmake
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# BE AWARE: This file depends on ${WAMR_ROOT_DIR}
|
||||
|
||||
set(WAMR_VERSION_MAJOR 2)
|
||||
set(WAMR_VERSION_MINOR 2)
|
||||
set(WAMR_VERSION_PATCH 0)
|
||||
|
||||
message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}")
|
||||
|
||||
# Configure the version header file
|
||||
configure_file(
|
||||
${WAMR_ROOT_DIR}/core/version.h.in
|
||||
${WAMR_ROOT_DIR}/core/version.h
|
||||
)
|
||||
|
||||
# Set the library version and SOVERSION
|
||||
function(set_version_info target)
|
||||
set_target_properties(${target}
|
||||
PROPERTIES
|
||||
VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}
|
||||
SOVERSION ${WAMR_VERSION_MAJOR}
|
||||
)
|
||||
endfunction()
|
|
@ -3,9 +3,20 @@
|
|||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
/*
|
||||
* version.h.in is a template file. version.h is a generated file.
|
||||
* Please do not edit both files directly.
|
||||
*
|
||||
* Any changes to the version should be done in the version.cmake file.
|
||||
*/
|
||||
|
||||
#ifndef _WAMR_VERSION_H_
|
||||
#define _WAMR_VERSION_H_
|
||||
|
||||
/* clang-format off */
|
||||
#define WAMR_VERSION_MAJOR 2
|
||||
#define WAMR_VERSION_MINOR 2
|
||||
#define WAMR_VERSION_PATCH 0
|
||||
/* clang-format on */
|
||||
|
||||
#endif
|
||||
|
|
22
core/version.h.in
Normal file
22
core/version.h.in
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
/*
|
||||
* version.h.in is a template file. version.h is a generated file.
|
||||
* Please do not edit both files directly.
|
||||
*
|
||||
* Any changes to the version should be done in the version.cmake file.
|
||||
*/
|
||||
|
||||
#ifndef _WAMR_VERSION_H_
|
||||
#define _WAMR_VERSION_H_
|
||||
|
||||
/* clang-format off */
|
||||
#define WAMR_VERSION_MAJOR @WAMR_VERSION_MAJOR@
|
||||
#define WAMR_VERSION_MINOR @WAMR_VERSION_MINOR@
|
||||
#define WAMR_VERSION_PATCH @WAMR_VERSION_PATCH@
|
||||
/* clang-format on */
|
||||
|
||||
#endif
|
|
@ -142,6 +142,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")
|
||||
|
||||
|
@ -169,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)
|
||||
|
||||
|
@ -184,6 +186,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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user