mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Windows build scripts: move build configuration type to a separate file.
This commit is contained in:
+6
-10
@@ -46,16 +46,12 @@ if not %ERRORLEVEL%==0 (
|
||||
)
|
||||
|
||||
:: Set up variables depending on the used Visual Studio version
|
||||
call vs-cfg.cmd %1 %2
|
||||
call vs-cfg.cmd %1
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call build-type-cfg.cmd %2
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
|
||||
set BUILD_TYPE=%3
|
||||
|
||||
IF %GENERATOR%=="" (
|
||||
call cecho.cmd 0 12 "GENERATOR not specified - cannot proceed!"
|
||||
GOTO :Error
|
||||
)
|
||||
|
||||
IF "%BUILD_TYPE%"=="" set BUILD_TYPE=Build
|
||||
|
||||
IF NOT "!BUILD_TYPE!"=="Build" IF NOT "!BUILD_TYPE!"=="Rebuild" IF NOT "!BUILD_TYPE!"=="Clean" (
|
||||
@@ -71,9 +67,9 @@ IF NOT EXIST %INSTALL_DIR%. mkdir %INSTALL_DIR%
|
||||
IF %VS_VER%==2008 set PATH=C:\Windows\Microsoft.NET\Framework\v3.5;%PATH%
|
||||
|
||||
:: User-configurable build options
|
||||
IF "%IFCOS_INSTALL_PYTHON%"=="" set IFCOS_INSTALL_PYTHON=TRUE
|
||||
IF "%IFCOS_USE_PYTHON2%"=="" set IFCOS_USE_PYTHON2=FALSE
|
||||
IF "%IFCOS_NUM_BUILD_PROCS%"=="" set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCESSORS%
|
||||
IF NOT DEFINED IFCOS_INSTALL_PYTHON set IFCOS_INSTALL_PYTHON=TRUE
|
||||
IF NOT DEFINED IFCOS_USE_PYTHON2 set IFCOS_USE_PYTHON2=FALSE
|
||||
IF NOT DEFINED IFCOS_NUM_BUILD_PROCS set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCESSORS%
|
||||
|
||||
:: For subroutines
|
||||
set MSBUILD_CMD=MSBuild.exe /nologo /m:%IFCOS_NUM_BUILD_PROCS% /t:%BUILD_TYPE%
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: ::
|
||||
:: This file is part of IfcOpenShell. ::
|
||||
:: ::
|
||||
:: IfcOpenShell is free software: you can redistribute it and/or modify ::
|
||||
:: it under the terms of the Lesser GNU General Public License as published by ::
|
||||
:: the Free Software Foundation, either version 3.0 of the License, or ::
|
||||
:: (at your option) any later version. ::
|
||||
:: ::
|
||||
:: IfcOpenShell is distributed in the hope that it will be useful, ::
|
||||
:: but WITHOUT ANY WARRANTY; without even the implied warranty of ::
|
||||
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ::
|
||||
:: Lesser GNU General Public License for more details. ::
|
||||
:: ::
|
||||
:: You should have received a copy of the Lesser GNU General Public License ::
|
||||
:: along with this program. If not, see <http://www.gnu.org/licenses/>. ::
|
||||
:: ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::
|
||||
|
||||
:: This script initializes various CMake build configuration type related variables.
|
||||
:: This batch file expects CMake build configuration type as %1.
|
||||
|
||||
@echo off
|
||||
|
||||
:: Set up variables depending on the used build configuration type.
|
||||
set BUILD_CFG=%1
|
||||
|
||||
:: The default build types provided by CMake
|
||||
set BUILD_CFG_MINSIZEREL=MinSizeRel
|
||||
set BUILD_CFG_RELEASE=Release
|
||||
set BUILD_CFG_RELWITHDEBINFO=RelWithDebInfo
|
||||
set BUILD_CFG_DEBUG=Debug
|
||||
set BUILD_CFG_DEFAULT=%BUILD_CFG_RELWITHDEBINFO%
|
||||
|
||||
IF "!BUILD_CFG!"=="" (
|
||||
set BUILD_CFG=%BUILD_CFG_DEFAULT%
|
||||
call utils\cecho.cmd 0 14 "%~nx0: Warning: BUILD_CFG not specified - using the default %BUILD_CFG_DEFAULT%"
|
||||
)
|
||||
IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% (
|
||||
IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% (
|
||||
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed."
|
||||
exit /b 1
|
||||
))
|
||||
|
||||
:: DEBUG_OR_RELEASE and DEBUG_OR_RELEASE_LOWERCASE are "Debug" and "debug" for Debug build and "Release" and
|
||||
:: "release" for all of the Release variants.
|
||||
:: POSTFIX_D, POSTFIX_UNDERSCORE_D and POSTFIX_UNDERSCORE_DEBUG are helpers for performing file copies and
|
||||
:: checking for existence of files. In release build these variables are empty.
|
||||
set DEBUG_OR_RELEASE=Release
|
||||
set DEBUG_OR_RELEASE_LOWERCASE=release
|
||||
set POSTFIX_D=
|
||||
set POSTFIX_UNDERSCORE_D=
|
||||
set POSTFIX_UNDERSCORE_DEBUG=
|
||||
IF %BUILD_CFG%==Debug (
|
||||
set DEBUG_OR_RELEASE=Debug
|
||||
set DEBUG_OR_RELEASE_LOWERCASE=debug
|
||||
set POSTFIX_D=d
|
||||
set POSTFIX_UNDERSCORE_D=_d
|
||||
set POSTFIX_UNDERSCORE_DEBUG=_debug
|
||||
)
|
||||
@@ -69,6 +69,7 @@ Directory Structure
|
||||
| build-deps.cmd - Fetches and builds all needed dependencies for IFCOS
|
||||
| BuildDepsCache-<ARCH>.txt - Cache file created by build-deps.cmd
|
||||
| build-ifcopenshell.cmd - Builds IFCOS
|
||||
| build-type-cfg.cmd - Utility file used by the build scripts
|
||||
| install-ifcopenshell.cmd - Builds IFCOS's INSTALL project
|
||||
| readme.md - This file
|
||||
| run-cmake.bat - Sets environment variables for the dependencies and runs CMake for IFCOS
|
||||
|
||||
+3
-5
@@ -24,7 +24,7 @@ set PROJECT_NAME=IfcOpenShell
|
||||
|
||||
:: Enable the delayed environment variable expansion needed in vs-cfg.cmd.
|
||||
setlocal EnableDelayedExpansion
|
||||
:: TODO Getting warning print in vs-cfg.cmd for missing build type although this script doesn't need it specified
|
||||
|
||||
call vs-cfg.cmd %1
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
|
||||
@@ -39,7 +39,6 @@ IF NOT EXIST ..\%BUILD_DIR%. mkdir ..\%BUILD_DIR%
|
||||
pushd ..\%BUILD_DIR%
|
||||
|
||||
set BOOST_ROOT=%DEPS_DIR%\boost
|
||||
REM set BOOST_INCLUDEDIR=%DEPS_DIR%\boost
|
||||
set BOOST_LIBRARYDIR=%DEPS_DIR%\boost\stage\vs%VS_VER%-%VS_PLATFORM%\lib
|
||||
set ICU_INCLUDE_DIR=%INSTALL_DIR%\icu\include
|
||||
set ICU_LIBRARY_DIR=%INSTALL_DIR%\icu\lib
|
||||
@@ -47,8 +46,8 @@ set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce
|
||||
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib
|
||||
set OPENCOLLADA_INCLUDE_DIR=%INSTALL_DIR%\OpenCOLLADA\include\opencollada
|
||||
set OPENCOLLADA_LIBRARY_DIR=%INSTALL_DIR%\OpenCOLLADA\lib\opencollada
|
||||
if "%PY_VER_MAJOR_MINOR%"=="" set PY_VER_MAJOR_MINOR=34
|
||||
if "%PYTHONPATH%"=="" set PYTHONPATH=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR%
|
||||
if not defined PY_VER_MAJOR_MINOR set PY_VER_MAJOR_MINOR=34
|
||||
if not defined PYTHONPATH set PYTHONPATH=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR%
|
||||
set PYTHON_INCLUDE_DIR=%PYTHONPATH%\include
|
||||
set PYTHON_LIBRARY=%PYTHONPATH%\libs\python%PY_VER_MAJOR_MINOR%.lib
|
||||
set SWIG_DIR=%INSTALL_DIR%\swigwin
|
||||
@@ -62,7 +61,6 @@ echo All arguments = %*
|
||||
echo.
|
||||
call cecho.cmd 0 10 "Dependency Environment Variables for %PROJECT_NAME%:"
|
||||
echo BOOST_ROOT = %BOOST_ROOT%
|
||||
REM echo BOOST_INCLUDEDIR = %BOOST_INCLUDEDIR%
|
||||
echo BOOST_LIBRARYDIR = %BOOST_LIBRARYDIR%
|
||||
echo ICU_INCLUDE_DIR = %ICU_INCLUDE_DIR%
|
||||
echo ICU_LIBRARY_DIR = %ICU_LIBRARY_DIR%
|
||||
|
||||
+6
-44
@@ -15,11 +15,11 @@
|
||||
:: You should have received a copy of the Lesser GNU General Public License ::
|
||||
:: along with this program. If not, see <http://www.gnu.org/licenses/>. ::
|
||||
:: ::
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::
|
||||
|
||||
:: This script initializes various Visual Studio -related environment variables needed for building
|
||||
:: This batch file expects CMake generator as %1 and build configuration type as %2.
|
||||
:: If %1 is not provided, it is deduced from the VisualStudioVersion environment variable and from the location of cl.exe.
|
||||
:: This script initializes various Visual Studio related environment variables needed for building.
|
||||
:: the dependencies. This batch file expects a CMake generator as %1. If %1 is not provided, it is
|
||||
:: deduced from the VisualStudioVersion environment variable and from the location of cl.exe.
|
||||
|
||||
:: NOTE This batch file expects the generator string to be CMake 3.0.0 and newer format, i.e.
|
||||
:: "Visual Studio 10 2010" instead of "Visual Studio 10". However, one can use this batch file
|
||||
@@ -31,8 +31,7 @@
|
||||
|
||||
set GENERATOR=%1
|
||||
|
||||
:: TODO IDEA: Take more user-friendly VS generators and convert them to the CMake ones?
|
||||
:: F.ex. "vs2013-32" and/or "vc14-64"
|
||||
:: TODO IDEA: Take more user-friendly VS generators (e.g. "vs2013-x86") and convert them to the CMake ones?
|
||||
|
||||
:: Supported Visual Studio versions:
|
||||
set GENERATORS[0]="Visual Studio 9 2008 Win64"
|
||||
@@ -67,7 +66,7 @@ IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" (
|
||||
)
|
||||
:: Check that the used CMake version supports the chosen generator
|
||||
set GENERATOR_CHECK=%GENERATOR: Win64=%
|
||||
cmake --help | findstr /c:%GENERATOR_CHECK%
|
||||
cmake --help | findstr /c:%GENERATOR_CHECK% >nul
|
||||
if not %ERRORLEVEL%==0 (
|
||||
call utils\cecho.cmd 0 12 "%~nx0: The used CMake version does not support '`"!GENERATOR!`'"- cannot proceed."
|
||||
exit /b 1
|
||||
@@ -124,43 +123,6 @@ set GENERATOR=%GENERATOR: 2010=%
|
||||
set VCPROJ_FILE_EXT=vcxproj
|
||||
IF %VS_VER%==2008 set VCPROJ_FILE_EXT=vcproj
|
||||
|
||||
:: Set up variables depending on the used build configuration type.
|
||||
set BUILD_CFG=%2
|
||||
|
||||
:: The default build types provided by CMake
|
||||
set BUILD_CFG_MINSIZEREL=MinSizeRel
|
||||
set BUILD_CFG_RELEASE=Release
|
||||
set BUILD_CFG_RELWITHDEBINFO=RelWithDebInfo
|
||||
set BUILD_CFG_DEBUG=Debug
|
||||
set BUILD_CFG_DEFAULT=%BUILD_CFG_RELWITHDEBINFO%
|
||||
|
||||
IF "!BUILD_CFG!"=="" (
|
||||
set BUILD_CFG=%BUILD_CFG_DEFAULT%
|
||||
call utils\cecho.cmd 0 14 "%~nx0: Warning: BUILD_CFG not specified - using the default %BUILD_CFG_DEFAULT%"
|
||||
)
|
||||
IF NOT !BUILD_CFG!==%BUILD_CFG_MINSIZEREL% IF NOT !BUILD_CFG!==%BUILD_CFG_RELEASE% (
|
||||
IF NOT !BUILD_CFG!==%BUILD_CFG_RELWITHDEBINFO% IF NOT !BUILD_CFG!==%BUILD_CFG_DEBUG% (
|
||||
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake build configuration type passed: !BUILD_CFG!. Cannot proceed."
|
||||
exit /b 1
|
||||
))
|
||||
|
||||
:: DEBUG_OR_RELEASE and DEBUG_OR_RELEASE_LOWERCASE are "Debug" and "debug" for Debug build and "Release" and
|
||||
:: "release" for all of the Release variants.
|
||||
:: POSTFIX_D, POSTFIX_UNDERSCORE_D and POSTFIX_UNDERSCORE_DEBUG are helpers for performing file copies and
|
||||
:: checking for existence of files. In release build these variables are empty.
|
||||
set DEBUG_OR_RELEASE=Release
|
||||
set DEBUG_OR_RELEASE_LOWERCASE=release
|
||||
set POSTFIX_D=
|
||||
set POSTFIX_UNDERSCORE_D=
|
||||
set POSTFIX_UNDERSCORE_DEBUG=
|
||||
IF %BUILD_CFG%==Debug (
|
||||
set DEBUG_OR_RELEASE=Debug
|
||||
set DEBUG_OR_RELEASE_LOWERCASE=debug
|
||||
set POSTFIX_D=d
|
||||
set POSTFIX_UNDERSCORE_D=_d
|
||||
set POSTFIX_UNDERSCORE_DEBUG=_debug
|
||||
)
|
||||
|
||||
:: Add utils to PATH
|
||||
set ORIGINAL_PATH=%PATH%
|
||||
set PATH=%PATH%;%~dp0utils
|
||||
|
||||
Reference in New Issue
Block a user