1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Fix BUILD_SHARED_LIBS issue (#1496)

This commit is contained in:
Marat 2025-01-27 12:34:21 +01:00 committed by GitHub
parent 294db69227
commit c720204199
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 17 deletions

View file

@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
option(BUILD_SHARED_LIBS "Use \"OFF\" for a static build." ON)
if (NOT OPENSSL_FOUND)
find_package(OpenSSL REQUIRED)
endif()
@ -11,11 +9,6 @@ set(EMULATOR_STATIC_SOURCE
tvm-emulator.hpp
)
set(EMULATOR_HEADERS
transaction-emulator.h
emulator-extern.h
)
set(EMULATOR_SOURCE
emulator-extern.cpp
)
@ -29,10 +22,10 @@ include(GenerateExportHeader)
add_library(emulator_static STATIC ${EMULATOR_STATIC_SOURCE})
target_link_libraries(emulator_static PUBLIC ton_crypto smc-envelope)
if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS)
add_library(emulator SHARED ${EMULATOR_SOURCE} ${EMULATOR_HEADERS})
if (USE_EMSCRIPTEN)
add_library(emulator STATIC ${EMULATOR_SOURCE})
else()
add_library(emulator STATIC ${EMULATOR_SOURCE} ${EMULATOR_HEADERS})
add_library(emulator SHARED ${EMULATOR_SOURCE})
endif()
if (PORTABLE AND NOT APPLE)
@ -42,6 +35,9 @@ else()
endif()
generate_export_header(emulator EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/emulator_export.h)
if (USE_EMSCRIPTEN)
target_compile_definitions(emulator PUBLIC EMULATOR_STATIC_DEFINE)
endif()
target_include_directories(emulator PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)