Something went wrong on our end
-
Martin Beseda authoredMartin Beseda authored
win_VS_build_x64_debug.bat 3.88 KiB
@echo off
title Building the 'lib4neuro' project for Debug
cls
set "REBUILD_BOOST="
set "BUILD_EXAMPLES="
set "BUILD_TESTS="
set "BUILD_LIB="
set "BUILD_SOMETHING="
set "BUILD_SOMETHING_LIB="
rem call VsDevCmd.bat
rem Should we rebuild BOOST? (yes/no)
set REBUILD_BOOST=yes
rem Should we build the examples? (yes/no)
set BUILD_EXAMPLES=yes
rem Should we build the unit-tests? (yes/no)
set BUILD_TESTS=yes
rem Should we build the lib4neuro library? (yes)
set BUILD_LIB=yes
rem **********************DO NOT CHANGE BEYOND THIS LINE****************************************
set BUILD_SOMETHING=no
set BUILD_SOMETHING_LIB=no
IF "%BUILD_LIB%"=="yes" (
echo Lib4neuro build type: Debug
echo Lib4neuro build architecture: x64
echo Lib4neuro will be built in 'build\lib\'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_TESTS%"=="yes" (
echo Lib4neuro unit tests will be built in 'build\unit-tests'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%BUILD_EXAMPLES%"=="yes" (
echo Lib4neuro examples will be built in 'build\examples'
set BUILD_SOMETHING=yes
set BUILD_SOMETHING_LIB=yes
)
IF "%REBUILD_BOOST%"=="yes" (
echo The required BOOST library will be recompiled in the directory 'external_dependencies\boost'
set BUILD_SOMETHING=yes
)
IF "%BUILD_SOMETHING%"=="yes" (
rem pause
)
rem Boost rebuild
IF "%REBUILD_BOOST%"=="yes" (
title Rebuilding 'BOOST' for Debug
cd ..\..
rmdir /s /q external_dependencies\boost\stage 2>NUL
rmdir /s /q external_dependencies\boost\bin.v2 2>NUL
cd external_dependencies\boost
echo "DEPENDENCIES_LINK_TYPE %DEPENDENCIES_LINK_TYPE%"
.\b2 --layout=system variant=debug link=%DEPENDENCIES_LINK_TYPE% address-model=64 --with-system --with-serialization --with-random || exit 1
cd ..\..\build_scripts\windows
echo "LIBRARIES BOOST:"
dir ..\..\external_dependencies\boost\stage\lib
)
IF "%BUILD_SOMETHING_LIB%"=="yes" (
IF "%BUILD_LIB%"=="yes" (
call win_clean_lib.bat
)
IF "%BUILD_EXAMPLES%"=="yes" (
call win_clean_examples.bat
)
IF "%BUILD_TESTS%"=="yes" (
call win_clean_tests.bat
)
title Building the 'lib4neuro' project for Debug (preparing makefiles)
rem C++ compiler (Requires Visual Studio 2017)
set CXX_COMPILER=cl
set C_COMPILER=cl
set MAKEFILE_GENERATOR="Visual Studio 15 2017 Win64"
cd ..\..
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBUILD_TESTS=%BUILD_TESTS% -DBUILD_EXAMPLES=%BUILD_EXAMPLES% -DBUILD_LIB=%BUILD_LIB% -DLIB4NEURO_DIR=build\lib -DDEPENDENCIES_LINK_TYPE=%DEPENDENCIES_LINK_TYPE% . || exit 1
title Building the 'lib4neuro' project for Debug (building)
(cmake --build .) && (echo "Build complete.") || exit 1
cd build_scripts\windows
IF "%BUILD_LIB%"=="yes" (
cd ..\..
rem Moving LIB files around to have a neater structure
xcopy /y build\bin\Debug\lib4neuro.dll build\lib 2>NUL
xcopy /y build\lib\Debug\lib4neuro.lib build\lib 2>NUL
rmdir /s /q "build\lib\Debug" 2> NUL
rmdir /s /q "build\libboost_unit_test.dir" 2> NUL
cd build_scripts\windows
)
IF "%BUILD_EXAMPLES%"=="yes" (
cd ..\..
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\examples\bin\Debug\*.exe build\tmp 2>NUL
rmdir /s /q "build\examples" 2> NUL
move build\tmp build\examples
xcopy /y build\lib\*.dll build\examples 2>NUL
cd build_scripts\windows
)
IF "%BUILD_TESTS%"=="yes" (
cd ..\..
rem Moving EXAMPLE files around to have a neater structure
mkdir build\tmp
xcopy /y build\unit-tests\bin\Debug\*.exe build\tmp 2>NUL
rmdir /s /q "build\unit-tests" 2> NUL
move build\tmp build\unit-tests
xcopy /y build\lib\*.dll build\unit-tests 2>NUL
cd build_scripts\windows
)
call win_clean_garbage.bat
)