@@ -121,10 +121,14 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
121
121
122
122
include (${WAMR_ROOT_DIR} /build-scripts/runtime_lib.cmake )
123
123
124
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter -fvisibility=hidden" )
125
- # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
126
-
127
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused" )
124
+ if (NOT WIN32 )
125
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \
126
+ -ffunction-sections -fdata-sections \
127
+ -Wno-unused-parameter -Wno-pedantic" )
128
+ # Remove the extra spaces for better make log
129
+ string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS} )
130
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused" )
131
+ endif ()
128
132
129
133
if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64" )
130
134
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
@@ -145,6 +149,10 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
145
149
set (THREADS_PREFER_PTHREAD_FLAG ON )
146
150
find_package (Threads REQUIRED )
147
151
152
+ if (MSVC )
153
+ add_definitions (-DCOMPILING_WASM_RUNTIME_API=1 )
154
+ endif ()
155
+
148
156
# STATIC LIBRARY
149
157
if (WAMR_BUILD_STATIC )
150
158
add_library (iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE} )
@@ -155,6 +163,14 @@ if (WAMR_BUILD_STATIC)
155
163
target_link_libraries (iwasm_static INTERFACE boringssl_crypto )
156
164
endif ()
157
165
166
+ if (MINGW )
167
+ target_link_libraries (iwasm_static PRIVATE ws2_32 )
168
+ endif ()
169
+
170
+ if (WIN32 )
171
+ target_link_libraries (iwasm_static PRIVATE ntdll )
172
+ endif ()
173
+
158
174
install (TARGETS iwasm_static ARCHIVE DESTINATION lib )
159
175
endif ()
160
176
@@ -169,9 +185,14 @@ if (WAMR_BUILD_SHARED)
169
185
endif ()
170
186
171
187
if (MINGW )
172
- target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32 )
188
+ target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32 )
189
+ target_link_libraries (iwasm_shared PRIVATE ws2_32 )
173
190
endif ()
174
191
192
+ if (WIN32 )
193
+ target_link_libraries (iwasm_shared PRIVATE ntdll )
194
+ endif ()
195
+
175
196
install (TARGETS iwasm_shared LIBRARY DESTINATION lib )
176
197
endif ()
177
198
0 commit comments