File tree Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Expand file tree Collapse file tree 3 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
8484set (CMAKE_CXX_EXTENSIONS FALSE )
8585
8686#BEGIN internal
87+ option (BUILD_SHARED_LIBS "Use \" ON\" to build shared libraries instead of static where it's not specified (not recommended)" OFF )
8788option (USE_EMSCRIPTEN "Use \" ON\" for config building wasm." OFF )
8889option (TON_ONLY_TONLIB "Use \" ON\" to build only tonlib." OFF )
8990if (USE_EMSCRIPTEN)
Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
22
3- option (BUILD_SHARED_LIBS "Use \" OFF\" for a static build." ON )
4-
53if (NOT OPENSSL_FOUND)
64 find_package (OpenSSL REQUIRED)
75endif ()
@@ -11,11 +9,6 @@ set(EMULATOR_STATIC_SOURCE
119 tvm-emulator.hpp
1210)
1311
14- set (EMULATOR_HEADERS
15- transaction-emulator.h
16- emulator-extern.h
17- )
18-
1912set (EMULATOR_SOURCE
2013 emulator-extern.cpp
2114)
@@ -29,10 +22,10 @@ include(GenerateExportHeader)
2922add_library (emulator_static STATIC ${EMULATOR_STATIC_SOURCE} )
3023target_link_libraries (emulator_static PUBLIC ton_crypto smc-envelope)
3124
32- if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS )
33- add_library (emulator SHARED ${EMULATOR_SOURCE} ${EMULATOR_HEADERS } )
25+ if (USE_EMSCRIPTEN)
26+ add_library (emulator STATIC ${EMULATOR_SOURCE} )
3427else ()
35- add_library (emulator STATIC ${EMULATOR_SOURCE} ${EMULATOR_HEADERS } )
28+ add_library (emulator SHARED ${EMULATOR_SOURCE} )
3629endif ()
3730
3831if (PORTABLE AND NOT APPLE )
4235endif ()
4336
4437generate_export_header(emulator EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR} /emulator_export.h)
38+ if (USE_EMSCRIPTEN)
39+ target_compile_definitions (emulator PUBLIC EMULATOR_STATIC_DEFINE)
40+ endif ()
4541target_include_directories (emulator PUBLIC
4642 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >
4743 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >)
Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
22
3- option (BUILD_SHARED_LIBS "Use \" OFF\" for a static build." ON )
4-
53if (NOT OPENSSL_FOUND)
64 find_package (OpenSSL REQUIRED)
75endif ()
@@ -92,10 +90,10 @@ set(TONLIB_JSON_HEADERS tonlib/tonlib_client_json.h)
9290set (TONLIB_JSON_SOURCE tonlib/tonlib_client_json.cpp)
9391
9492include (GenerateExportHeader)
95- if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS )
96- add_library (tonlibjson SHARED ${TONLIB_JSON_SOURCE} ${TONLIB_JSON_HEADERS } )
93+ if (USE_EMSCRIPTEN)
94+ add_library (tonlibjson STATIC ${TONLIB_JSON_SOURCE} )
9795else ()
98- add_library (tonlibjson STATIC ${TONLIB_JSON_SOURCE} ${TONLIB_JSON_HEADERS } )
96+ add_library (tonlibjson SHARED ${TONLIB_JSON_SOURCE} )
9997endif ()
10098
10199if (PORTABLE AND NOT APPLE )
@@ -105,7 +103,7 @@ else()
105103endif ()
106104
107105generate_export_header(tonlibjson EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR} /tonlib/tonlibjson_export.h)
108- if (! BUILD_SHARED_LIBS )
106+ if (USE_EMSCRIPTEN )
109107 target_compile_definitions (tonlibjson PUBLIC TONLIBJSON_STATIC_DEFINE)
110108endif ()
111109target_include_directories (tonlibjson PUBLIC
@@ -159,7 +157,7 @@ endif()
159157
160158install (FILES ${TONLIB_JSON_HEADERS} ${CMAKE_CURRENT_BINARY_DIR} /tonlib/tonlibjson_export.h DESTINATION include /tonlib/)
161159
162- if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS )
160+ if (NOT USE_EMSCRIPTEN)
163161 install (EXPORT Tonlib
164162 FILE TonlibTargets.cmake
165163 NAMESPACE Tonlib::
You can’t perform that action at this time.
0 commit comments