Skip to content

Commit

Permalink
Merge pull request #83 from msakai/feature/mingw-static-libprotobuf
Browse files Browse the repository at this point in the history
Enable LINK_STATIC_LIBPROTOBUF option on MINGW
  • Loading branch information
msakai authored Sep 3, 2018
2 parents c4425fd + 3a76eca commit da9348d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ image:
environment:
matrix:
- TARGET: mingw
- TARGET: mingw
STATIC: 1
- TARGET: msvc

install:
Expand Down Expand Up @@ -57,7 +59,14 @@ build_script:
- cd build
- if [%TARGET%]==[msvc] set PATH=%PATH%;c:\protobuf-3.6.0-msvc\bin;c:\protobuf-3.6.0-msvc\include;c:\protobuf-3.6.0-msvc\lib;c:\projects\menoh\mkl-dnn-0.15-win64\bin;c:\projects\menoh\mkl-dnn-0.15-win64\include;c:\projects\menoh\mkl-dnn-0.15-win64\lib
- if [%TARGET%]==[mingw] (
cmake -G "MSYS Makefiles" -DENABLE_TEST=ON -DCMAKE_INSTALL_PREFIX=/mingw64 .. &&
if [%STATIC%]==[1] (
set STATIC_OPTION="-DLINK_STATIC_LIBPROTOBUF=ON -DLINK_STATIC_LIBSTDCXX=ON -DLINK_STATIC_LIBGCC=ON"
) else (
set STATIC_OPTION=""
)
)
- if [%TARGET%]==[mingw] (
cmake -G "MSYS Makefiles" -DENABLE_TEST=ON -DLINK_STATIC_LIBPROTOBUF=ON -DCMAKE_INSTALL_PREFIX=/mingw64 .. &&
make
) else (
cmake -G "Visual Studio 14 Win64" -DENABLE_TEST=OFF -DENABLE_BENCHMARK=OFF -DENABLE_EXAMPLE=OFF -DENABLE_TOOL=OFF -DCMAKE_INSTALL_PREFIX=c:\menoh-%MENOH_REV%-msvc .. &&
Expand Down
2 changes: 1 addition & 1 deletion cmake/SetupProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(LINK_STATIC_LIBPROTOBUF)
# because `libprotobuf.a` produced by the package manager is not PIC. So we need to
# build it by ourselves.

if(UNIX)
if(UNIX OR MINGW)
set(PROTOBUF_VERSION_STATIC "3.6.1")
set(PROTOBUF_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${PROTOBUF_VERSION_STATIC})
set(PROTOBUF_URL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION_STATIC}/protobuf-cpp-${PROTOBUF_VERSION_STATIC}.tar.gz")
Expand Down

0 comments on commit da9348d

Please sign in to comment.