Skip to content

Commit

Permalink
Fix minor build error in export
Browse files Browse the repository at this point in the history
Signed-off-by: HyukWoo Park <[email protected]>
  • Loading branch information
clover2123 authored and ksh8281 committed Aug 28, 2023
1 parent a1fddb5 commit 89c3d0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 7 additions & 9 deletions build/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR ${COMPILER_CLANG_CL})
ENDIF()
SET (WALRUS_CXXFLAGS_SHAREDLIB)
SET (WALRUS_LDFLAGS_SHAREDLIB)
SET (WALRUS_CXXFLAGS_STATICLIB /DWALRUS_EXPORT)
SET (WALRUS_CXXFLAGS_SHELL /DWALRUS_EXPORT /std:c++17)
SET (WALRUS_CXXFLAGS_STATICLIB /DWASM_API_EXTERN)
SET (WALRUS_CXXFLAGS_SHELL /DWASM_API_EXTERN /std:c++17)
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET (WALRUS_CXXFLAGS
${WALRUS_CXXFLAGS}
Expand All @@ -63,7 +63,6 @@ ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET (WALRUS_CXXFLAGS_DEBUG -O0 -Wall -Wextra -Werror)
SET (WALRUS_CXXFLAGS_RELEASE -O2 -fno-stack-protector -fno-omit-frame-pointer)
SET (WALRUS_THIRDPARTY_CFLAGS -w -g3 -fdata-sections -ffunction-sections -fno-omit-frame-pointer -fvisibility=hidden)
SET (WALRUS_DEFINITIONS ${WALRUS_DEFINITIONS} "WASM_API_EXTERN=__attribute__((visibility(\"default\")))")

IF (WALRUS_SMALL_CONFIG)
SET (WALRUS_CXXFLAGS_RELEASE ${WALRUS_CXXFLAGS_RELEASE} -Os)
Expand All @@ -73,8 +72,8 @@ ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
ENDIF()
SET (WALRUS_CXXFLAGS_SHAREDLIB -fPIC)
SET (WALRUS_LDFLAGS_SHAREDLIB -ldl)
SET (WALRUS_CXXFLAGS_STATICLIB -fPIC -DWALRUS_EXPORT=)
SET (WALRUS_CXXFLAGS_SHELL -DWALRUS_EXPORT= -frtti -std=c++17)
SET (WALRUS_CXXFLAGS_STATICLIB -fPIC -DWASM_API_EXTERN=)
SET (WALRUS_CXXFLAGS_SHELL -DWASM_API_EXTERN= -frtti -std=c++17)

ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # Clang and AppleClang
SET (WALRUS_CXXFLAGS
Expand All @@ -94,7 +93,6 @@ ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # Clang and AppleClang
SET (WALRUS_CXXFLAGS_DEBUG -O0 -Wall -Wextra -Werror)
SET (WALRUS_CXXFLAGS_RELEASE -O2 -fno-stack-protector -fno-omit-frame-pointer)
SET (WALRUS_THIRDPARTY_CFLAGS -w -g3 -fdata-sections -ffunction-sections -fno-omit-frame-pointer -fvisibility=hidden)
SET (WALRUS_DEFINITIONS ${WALRUS_DEFINITIONS} "WASM_API_EXTERN=__attribute__((visibility(\"default\")))")

IF (WALRUS_SMALL_CONFIG)
SET (WALRUS_CXXFLAGS_RELEASE ${WALRUS_CXXFLAGS_RELEASE} -Os)
Expand All @@ -104,8 +102,8 @@ ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # Clang and AppleClang
ENDIF()
SET (WALRUS_CXXFLAGS_SHAREDLIB -fPIC)
SET (WALRUS_LDFLAGS_SHAREDLIB -ldl)
SET (WALRUS_CXXFLAGS_STATICLIB -fPIC -DWALRUS_EXPORT=)
SET (WALRUS_CXXFLAGS_SHELL -DWALRUS_EXPORT= -frtti -std=c++17)
SET (WALRUS_CXXFLAGS_STATICLIB -fPIC -DWASM_API_EXTERN=)
SET (WALRUS_CXXFLAGS_SHELL -DWASM_API_EXTERN= -frtti -std=c++17)
ELSE()
MESSAGE (FATAL_ERROR ${CMAKE_CXX_COMPILER_ID} " is Unsupported Compiler")
ENDIF()
Expand Down Expand Up @@ -219,4 +217,4 @@ ELSEIF (WALRUS_BUILD_64BIT)
SET (WALRUS_DEFINITIONS ${WALRUS_DEFINITIONS} -DWALRUS_64=1)
ELSE()
MESSAGE (FATAL_ERROR "unsupported mode")
ENDIF()
ENDIF()
6 changes: 3 additions & 3 deletions src/api/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <assert.h>

#ifndef WASM_API_EXTERN
#ifdef _WIN32
#define WASM_API_EXTERN __declspec(dllimport)
#ifdef _MSC_VER
#define WASM_API_EXTERN __declspec(dllexport)
#else
#define WASM_API_EXTERN
#define WASM_API_EXTERN __attribute__((visibility("default")))
#endif
#endif

Expand Down

0 comments on commit 89c3d0b

Please sign in to comment.