Created
December 1, 2018 06:07
-
-
Save gavxin/a409ab8e7c5a6c1b24312b792ec6d005 to your computer and use it in GitHub Desktop.
Abseil-cpp cmake batch complation.
This file contains hidden or 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
@ECHO OFF | |
SET VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" | |
cmd /c compile_one.bat x86 d md | |
cmd /c compile_one.bat x86 r md | |
cmd /c compile_one.bat x64 d md | |
cmd /c compile_one.bat x64 r md |
This file contains hidden or 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
@ECHO OFF | |
SET VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" | |
@ECHO Add following text to CMakeLists.txt | |
@ECHO ----------------------------- | |
@ECHO foreach(flag_var | |
@ECHO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE | |
@ECHO CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) | |
@ECHO if(${flag_var} MATCHES "/MD") | |
@ECHO string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") | |
@ECHO endif(${flag_var} MATCHES "/MD") | |
@ECHO endforeach(flag_var) | |
@ECHO ----------------------------- | |
@ECHO Pause for editing... | |
PAUSE | |
@ECHO Please comfirm CMakeLists.txt correctly edited. | |
PAUSE | |
cmd /c compile_one.bat x86 d mt | |
cmd /c compile_one.bat x86 r mt | |
cmd /c compile_one.bat x64 d mt | |
cmd /c compile_one.bat x64 r mt |
This file contains hidden or 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
@ECHO ON | |
REM compile_one.bat (x86|x64) (d|r) (md|mt) | |
PUSHD %~dp0 | |
mkdir build\%1%2_%3 | |
mkdir lib\%1%2_%3 | |
CALL %VCVARSALL% %1 | |
PUSHD build\%1%2_%3 | |
IF "%2" == "d" ( | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..\.. | |
) ELSE ( | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..\.. | |
) | |
ninja | |
POPD | |
FOR /R build\%1%2_%3 %%f in (*.lib) DO copy %%f lib\%1%2_%3 | |
POPD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment