File tree 3 files changed +12
-17
lines changed
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)
84
84
set (CMAKE_CXX_EXTENSIONS FALSE )
85
85
86
86
#BEGIN internal
87
+ option (BUILD_SHARED_LIBS "Use \" ON\" to build shared libraries instead of static where it's not specified (not recommended)" OFF )
87
88
option (USE_EMSCRIPTEN "Use \" ON\" for config building wasm." OFF )
88
89
option (TON_ONLY_TONLIB "Use \" ON\" to build only tonlib." OFF )
89
90
if (USE_EMSCRIPTEN)
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
2
2
3
- option (BUILD_SHARED_LIBS "Use \" OFF\" for a static build." ON )
4
-
5
3
if (NOT OPENSSL_FOUND)
6
4
find_package (OpenSSL REQUIRED)
7
5
endif ()
@@ -11,11 +9,6 @@ set(EMULATOR_STATIC_SOURCE
11
9
tvm-emulator.hpp
12
10
)
13
11
14
- set (EMULATOR_HEADERS
15
- transaction-emulator.h
16
- emulator-extern.h
17
- )
18
-
19
12
set (EMULATOR_SOURCE
20
13
emulator-extern.cpp
21
14
)
@@ -29,10 +22,10 @@ include(GenerateExportHeader)
29
22
add_library (emulator_static STATIC ${EMULATOR_STATIC_SOURCE} )
30
23
target_link_libraries (emulator_static PUBLIC ton_crypto smc-envelope)
31
24
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} )
34
27
else ()
35
- add_library (emulator STATIC ${EMULATOR_SOURCE} ${EMULATOR_HEADERS } )
28
+ add_library (emulator SHARED ${EMULATOR_SOURCE} )
36
29
endif ()
37
30
38
31
if (PORTABLE AND NOT APPLE )
42
35
endif ()
43
36
44
37
generate_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 ()
45
41
target_include_directories (emulator PUBLIC
46
42
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >
47
43
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >)
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
2
2
3
- option (BUILD_SHARED_LIBS "Use \" OFF\" for a static build." ON )
4
-
5
3
if (NOT OPENSSL_FOUND)
6
4
find_package (OpenSSL REQUIRED)
7
5
endif ()
@@ -92,10 +90,10 @@ set(TONLIB_JSON_HEADERS tonlib/tonlib_client_json.h)
92
90
set (TONLIB_JSON_SOURCE tonlib/tonlib_client_json.cpp)
93
91
94
92
include (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} )
97
95
else ()
98
- add_library (tonlibjson STATIC ${TONLIB_JSON_SOURCE} ${TONLIB_JSON_HEADERS } )
96
+ add_library (tonlibjson SHARED ${TONLIB_JSON_SOURCE} )
99
97
endif ()
100
98
101
99
if (PORTABLE AND NOT APPLE )
@@ -105,7 +103,7 @@ else()
105
103
endif ()
106
104
107
105
generate_export_header(tonlibjson EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR} /tonlib/tonlibjson_export.h)
108
- if (! BUILD_SHARED_LIBS )
106
+ if (USE_EMSCRIPTEN )
109
107
target_compile_definitions (tonlibjson PUBLIC TONLIBJSON_STATIC_DEFINE)
110
108
endif ()
111
109
target_include_directories (tonlibjson PUBLIC
@@ -159,7 +157,7 @@ endif()
159
157
160
158
install (FILES ${TONLIB_JSON_HEADERS} ${CMAKE_CURRENT_BINARY_DIR} /tonlib/tonlibjson_export.h DESTINATION include /tonlib/)
161
159
162
- if (NOT USE_EMSCRIPTEN AND BUILD_SHARED_LIBS )
160
+ if (NOT USE_EMSCRIPTEN)
163
161
install (EXPORT Tonlib
164
162
FILE TonlibTargets.cmake
165
163
NAMESPACE Tonlib::
You can’t perform that action at this time.
0 commit comments