Skip to content

Commit 7515fa3

Browse files
Fix linking problem for building DLL with MSVC
1 parent a94a3cd commit 7515fa3

File tree

10 files changed

+23
-12
lines changed

10 files changed

+23
-12
lines changed

.travis/setenv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ if [[ "$COMPILER" == "Emscripten" ]]; then
1212
-w /mfast/build \
1313
-t thewtex/cross-compiler-browser-asmjs "
1414
else
15-
export CONFIG_ARGS="-DCMAKE_CXX_COMPILER=$COMPILER"
16-
fi
15+
export CONFIG_ARGS="-DCMAKE_CXX_COMPILER=$COMPILER -DBUILD_SHARED_LIBS=ON"
16+
fi

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ before_build:
4646
- cmd: cd C:\projects\mfast
4747
- cmd: md build
4848
- cmd: cd build
49-
- cmd: if "%platform%"=="Win32" cmake -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%configuration% -DBOOST_ROOT="%BOOST_ROOT%" ..
50-
- cmd: if "%platform%"=="x64" cmake -G "%GENERATOR% Win64" -DCMAKE_BUILD_TYPE=%configuration% -DBOOST_ROOT="%BOOST_ROOT%" ..
49+
- cmd: if "%platform%"=="Win32" cmake -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_SHARED_LIB=ON -DBOOST_ROOT="%BOOST_ROOT%" ..
50+
- cmd: if "%platform%"=="x64" cmake -G "%GENERATOR% Win64" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_SHARED_LIB=ON -DBOOST_ROOT="%BOOST_ROOT%" ..
5151

5252
build:
5353
project: C:\projects\mfast\build\mfast.sln

src/mfast/coder/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11

22
file (GLOB_RECURSE headers "*.h") ## retrieve all header files in current directory
3-
file (GLOB_RECURSE sources "*.cpp") ## retrieve all source files in current directory
43

4+
set(sources common/dictionary_builder.cpp
5+
decoder/decoder_field_operator.cpp
6+
decoder/decoder_presence_map.cpp
7+
decoder/fast_decoder.cpp
8+
decoder/fast_istream.cpp
9+
encoder/encoder_field_operator.cpp
10+
encoder/fast_encoder.cpp
11+
encoder/fast_ostreambuf.cpp
12+
encoder_v2/fast_encoder_core.cpp
13+
)
514

615

716
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
@@ -26,7 +35,7 @@ set(MFAST_STATIC_COMPONENTS ${MFAST_STATIC_COMPONENTS} coder_static CACHE INTERN
2635

2736

2837
if (BUILD_SHARED_LIBS)
29-
add_library(mfast_coder SHARED ${mfast_coder_SRCS})
38+
add_library(mfast_coder SHARED ${mfast_coder_SRCS} decoder_v2/fast_decoder_core.cpp)
3039

3140
if (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.12")
3241
target_compile_definitions(mfast_coder INTERFACE "-DMFAST_DYN_LINK")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// required for MSVC when building DLL
2+
#include "fast_decoder_core.h"

src/mfast/coder/mfast_coder_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
#else
1515
/* We are either using or building static libs */
1616
#define MFAST_CODER_EXPORT
17-
#define MAST_CODER_NO_SHARED_LIBS
17+
#define MFAST_CODER_NO_SHARED_LIBS
1818
#endif
1919
#endif

src/mfast/decimal_ref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#if defined __GNUC__
2626
#pragma GCC diagnostic pop
2727
#endif
28-
#if defined(MAST_NO_SHARED_LIBS) && !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
28+
#if defined(MFAST_NO_SHARED_LIBS) && !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
2929
namespace boost {
3030
namespace multiprecision {
3131
namespace backends {

src/mfast/json/mfast_json_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
#else
2020
/* We are either using or building static libs */
2121
#define MFAST_JSON_EXPORT
22-
#define MAST_JSON_NO_SHARED_LIBS
22+
#define MFAST_JSON_NO_SHARED_LIBS
2323
#endif
2424
#endif

src/mfast/mfast_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/* We are either using or building static libs */
2424
#define MFAST_EXPORT
25-
#define MAST_NO_SHARED_LIBS
25+
#define MFAST_NO_SHARED_LIBS
2626
#endif
2727
#endif
2828

src/mfast/sqlite3/mfast_sqlite3_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#else
1515
/* We are either using or building static libs */
1616
#define MFAST_SQLITE3_EXPORT
17-
#define MAST_SQLITE3_NO_SHARED_LIBS
17+
#define MFAST_SQLITE3_NO_SHARED_LIBS
1818
#endif
1919
#endif
2020

src/mfast/xml_parser/mfast_xml_parser_export.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
#else
1515
/* We are either using or building static libs */
1616
#define MFAST_XML_PARSER_EXPORT
17-
#define MAST_XML_PARSER_NO_SHARED_LIBS
17+
#define MFAST_XML_PARSER_NO_SHARED_LIBS
1818
#endif
1919
#endif

0 commit comments

Comments
 (0)