Skip to content
Permalink
Browse files

Merge pull request #99 from SupSuper/shared-libs

Replace mode=static with CMake's BUILD_SHARED_LIBS flag
  • Loading branch information...
Turupawn committed Aug 1, 2019
2 parents f7ad9c0 + 86ef03f commit caa0195467a956359127d7619fbaf5336362f314
Showing with 13 additions and 13 deletions.
  1. +2 −2 .travis.yml
  2. +8 −8 CMakeLists.txt
  3. +3 −3 appveyor_build_config.bat
@@ -16,8 +16,8 @@ script:
- make -j2
- make test
- if [[ "$TRAVIS_TAG" ]]; then
cmake -D mode=static . ;
make -j2 ;
cmake -D BUILD_SHARED_LIBS=OFF . ;
make -j2 ;
fi
- if [ "$TRAVIS_TAG" ]; then
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
@@ -6,8 +6,9 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

# set the mode flag as static to compile statically, for example:
# cmake -D mode=static .
# set BUILD_SHARED_LIBs to OFF to compile statically, for example:
# cmake -D BUILD_SHARED_LIBS=OFF .
option(BUILD_SHARED_LIBS "Build Shared Libraries" ON)

# MSVC: set the crtmode flag to 'static' to include the Visual C++
# runtime statically. Requires libcurl to be built with /MT as well.
@@ -17,15 +18,14 @@ include_directories(include additional_dependencies include/dependencies/miniz)

file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.c")

if( mode AND mode STREQUAL "static" )
add_library(modio ${SOURCES})
if( BUILD_SHARED_LIBS )
message("Building mod.io SDK dynamically")
add_definitions(-DMODIO_DYNAMICLIB -DCURL_STATICLIB)
else()
message("Building mod.io SDK statically")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-DMODIO_STATICLIB -DCURL_STATICLIB)
add_library(modio STATIC ${SOURCES})
else()
message("Building mod.io SDK dynamically")
add_definitions(-DMODIO_DYNAMICLIB -DCURL_STATICLIB)
add_library(modio SHARED ${SOURCES})
endif()

IF (APPLE)
@@ -1,6 +1,6 @@
mkdir test_build
cd test_build
cmake -D mode=static -D test=on -D gtest_force_shared_crt=on -G "Visual Studio 15" c:\projects\source
cmake -D BUILD_SHARED_LIBS=OFF -D test=on -D gtest_force_shared_crt=on -G "Visual Studio 15" c:\projects\source
cmake --build . --config "Debug"
cd ..

@@ -16,11 +16,11 @@ if %APPVEYOR_REPO_TAG% == true (
cmake --build . --config "Release"
mkdir ..\static_x86
cd ..\static_x86
cmake -D mode=static -G "Visual Studio 15" c:\projects\source
cmake -D BUILD_SHARED_LIBS=OFF -G "Visual Studio 15" c:\projects\source
cmake --build . --config "Release"
mkdir ..\static_x64
cd ..\static_x64
cmake -D mode=static -G "Visual Studio 15 Win64" c:\projects\source
cmake -D BUILD_SHARED_LIBS=OFF -G "Visual Studio 15 Win64" c:\projects\source
cmake --build . --config "Release"
cd ..
7z a Windows.zip dynamic_x86\Release\* dynamic_x64\Release\* static_x86\Release\* static_x64\Release\*

0 comments on commit caa0195

Please sign in to comment.
You can’t perform that action at this time.