1:: This file is for Windows users, 2:: it launches CMake and creates configuration for Visual Studio 3:: for Release and Debug modes. 4 5@echo off 6setlocal ENABLEDELAYEDEXPANSION 7 8:: Check for options: [ --build_name_suffix suffix ] 9set buildNameSuffix="" 10if "%1" == "--build_name_suffix" ( 11 set buildNameSuffix=%2 12 SHIFT & SHIFT 13) 14 15:: Read platform 16set opsys=%1 17 18:: Checking for CMake 19 20echo. 21echo ============= Checking for CMake ============ 22echo. 23 24cmake --version 25if %errorlevel% == 0 ( 26 echo Found CMake 27) else ( 28 echo Error: CMake not found, please install it - see http://www.cmake.org/ 29 exit /B 1 30) 31 32:: Checking the current OS 33 34if "%opsys%" == "" ( 35 if "%PROCESSOR_ARCHITECTURE%" == "x86" ( 36 set opsys=Win32-vs2012 37 ) else if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 38 set opsys=Win64-vs2012 39 ) else ( 40 echo Error: OS not supported 41 exit /B 1 42 ) 43) 44 45if not exist "cmake\platforms\%opsys%" ( 46 echo Error: unsupported platform: %opsys% 47 exit /B 1 48) 49 50 51:: Import the platform specific configuration 52 53echo. 54echo ============= Checking for Visual Studio ============ 55echo. 56 57call "cmake\platforms\%opsys%\setvars.bat" || exit /B 1 58 59:: Generate build tree 60 61echo. 62echo ============= Creating build system for %opsys% ============ 63echo. 64 65if not exist build\%opsys%%buildNameSuffix% ( 66 mkdir build\%opsys%%buildNameSuffix% 67) 68 69echo Using cmake generator %CMAKE_VS_GENERATOR% 70set cmake_generator_options=-G "%CMAKE_VS_GENERATOR%" 71 72if "%CMAKE_VS_GENERATOR_TOOLSET%" neq "" ( 73 echo Using cmake generator toolset %CMAKE_VS_GENERATOR_TOOLSET% 74 set cmake_generator_options=%cmake_generator_options% -T "%CMAKE_VS_GENERATOR_TOOLSET%" 75) 76 77 78::set cmake_debug_options=--trace --debug-output 79pushd build\%opsys%%buildNameSuffix% 80cmake ..\.. %cmake_debug_options% %cmake_generator_options% -DVORPALINE_PLATFORM:STRING=%opsys% || exit /B 1 81popd 82 83echo. 84echo ============== Vorpaline build configured ================== 85echo. 86echo To build vorpaline: 87echo - go to build/%opsys%%buildNameSuffix% 88echo - run 'cmake --build . --config=Release(or Debug) [--target=target_to_build]' 89echo. 90echo Note: local configuration can be specified in CMakeOptions.txt 91echo See CMakeOptions.txt.sample for an example 92echo You'll need to re-run configure.bat if you create or modify CMakeOptions.txt 93echo. 94 95:: Clear globals 96 97set buildNameSuffix= 98set opsys= 99exit /B 0 100