Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor build error in export #149

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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