-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from h-vetinari/cmake_main
Build with CMake on unix
- Loading branch information
Showing
15 changed files
with
189 additions
and
170 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
:: Setup directory structure per protobuf's instructions. | ||
cd cmake | ||
if errorlevel 1 exit 1 | ||
@echo on | ||
|
||
mkdir build-shared | ||
if errorlevel 1 exit 1 | ||
cd build-shared | ||
if errorlevel 1 exit 1 | ||
if "%PKG_NAME%"=="libprotobuf-static" ( | ||
set CF_SHARED=OFF | ||
mkdir build-static | ||
cd build-static | ||
) else ( | ||
set CF_SHARED=ON | ||
mkdir build-shared | ||
cd build-shared | ||
) | ||
|
||
:: Configure and install based on protobuf's instructions and other `bld.bat`s. | ||
cmake -G "Ninja" ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ | ||
-Dprotobuf_WITH_ZLIB=ON ^ | ||
-Dprotobuf_BUILD_SHARED_LIBS=ON ^ | ||
-Dprotobuf_BUILD_SHARED_LIBS=%CF_SHARED% ^ | ||
-Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^ | ||
.. | ||
if errorlevel 1 exit 1 | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
cmake --build . --target install --config Release | ||
if errorlevel 1 exit 1 | ||
if %ERRORLEVEL% neq 0 exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
if [ "$(uname)" == "Linux" ]; | ||
then | ||
# protobuf uses PROTOBUF_OPT_FLAG to set the optimization level | ||
# unit test can fail if optmization above 0 are used. | ||
CPPFLAGS="${CPPFLAGS//-O[0-9]/}" | ||
CXXFLAGS="${CXXFLAGS//-O[0-9]/}" | ||
export PROTOBUF_OPT_FLAG="-O2" | ||
# to improve performance, disable checks intended for debugging | ||
CXXFLAGS="$CXXFLAGS -DNDEBUG" | ||
elif [ "$(uname)" == "Darwin" ]; | ||
then | ||
# remove pie from LDFLAGS | ||
LDFLAGS="${LDFLAGS//-pie/}" | ||
fi | ||
|
||
# required to pick up conda installed zlib | ||
export CPPFLAGS="${CPPFLAGS} -I${PREFIX}/include" | ||
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" | ||
|
||
if [[ "$PKG_NAME" == "libprotobuf-static" ]]; then | ||
export CF_SHARED=OFF | ||
mkdir build-static | ||
cd build-static | ||
else | ||
export CF_SHARED=ON | ||
mkdir build-shared | ||
cd build-shared | ||
fi | ||
|
||
if [[ "$CONDA_BUILD_CROSS_COMPILATION" == 1 ]]; then | ||
export CMAKE_ARGS="${CMAKE_ARGS} -Dprotobuf_BUILD_TESTS=OFF" | ||
fi | ||
|
||
cmake -G "Ninja" \ | ||
${CMAKE_ARGS} \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-Dprotobuf_WITH_ZLIB=ON \ | ||
-Dprotobuf_BUILD_SHARED_LIBS=$CF_SHARED \ | ||
.. | ||
|
||
cmake --build . | ||
|
||
if [[ "$CONDA_BUILD_CROSS_COMPILATION" != 1 ]]; then | ||
ninja check | ||
fi | ||
|
||
cmake --install . |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.