From aab1fe0751a9bcddf076144f387db732b36c32af Mon Sep 17 00:00:00 2001 From: "aleksej.paschenko" Date: Thu, 27 Apr 2023 09:33:32 +0300 Subject: [PATCH] Use BUILD_SHARED_LIBS to decide whether to build libemulator.so (#671) * Update ubuntu:20.04 dockerfile (#636) * Update Dockerfile * Update Dockerfile --------- Co-authored-by: neodiX42 * Use BUILD_SHARED_LIBS to decide whether to build libemulator.so --------- Co-authored-by: EmelyanenkoK Co-authored-by: neodiX42 --- emulator/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/emulator/CMakeLists.txt b/emulator/CMakeLists.txt index 4e67d32c..1389050c 100644 --- a/emulator/CMakeLists.txt +++ b/emulator/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +option(BUILD_SHARED_LIBS "Use \"OFF\" for a static build." ON) + if (NOT OPENSSL_FOUND) find_package(OpenSSL REQUIRED) endif() @@ -27,7 +29,12 @@ include(GenerateExportHeader) add_library(emulator_static STATIC ${EMULATOR_STATIC_SOURCE}) target_link_libraries(emulator_static PUBLIC ton_crypto ton_block smc-envelope) -add_library(emulator STATIC ${EMULATOR_SOURCE} ${EMULATOR_HEADERS}) +if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS) + add_library(emulator SHARED ${EMULATOR_SOURCE} ${EMULATOR_HEADERS}) +else() + add_library(emulator STATIC ${EMULATOR_SOURCE} ${EMULATOR_HEADERS}) +endif() + target_link_libraries(emulator PUBLIC emulator_static) generate_export_header(emulator EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/emulator_export.h) target_include_directories(emulator PUBLIC