Merge remote-tracking branch 'official/master'

Conflicts:
	src/ifcconvert/IfcConvert.cpp
	src/ifcgeom/IfcGeomIterator.h
This commit is contained in:
aothms
2015-12-21 11:36:23 +01:00
64 changed files with 1841 additions and 626 deletions
+7
View File
@@ -0,0 +1,7 @@
# Dependency and build folders created by the build scripts
/deps*/
/build*/
/install*/
/win/BuildDepsCache*.txt
/src/ifcexpressparser/__pycache__
/src/ifcexpressparser/express_parser.py
+37 -18
View File
@@ -1,15 +1,20 @@
IfcOpenShell
============
open source (LGPL) software library for working with the IFC file format
Open source (LGPL) software library for working with the IFC file format.
[http://ifcopenshell.org](http://ifcopenshell.org)
[http://academy.ifcopenshell.org](http://academy.ifcopenshell.org)
Prerequisites
=============
* Git, CMake (2.6 or newer), Visual Studio 2008 or newer (Windows), or GCC (*nix, Clang untested).
Dependencies
============
* [Boost](http://www.boost.org/)
* Open Cascade *optional*, but required for building IfcGeom)
* Open Cascade *optional*, but required for building IfcGeom
[Official](http://www.opencascade.org/getocc/download/loadocc/) or [community edition](https://github.com/tpaviot/oce)
For converting IFC representation items into BRep solids and tesselated meshes
* [ICU](http://site.icu-project.org/) *optional*
@@ -18,32 +23,44 @@ Dependencies
For IfcConvert to be able to write tessellated Collada (.dae) files
* [SWIG](http://www.swig.org/), [Python](https://www.python.org/) libraries *optional*
For building the IfcOpenShell Python interface and the Blender add-on
* 3ds max SDK *optional*
For building the 3ds max plug-in
* 3ds Max SDK *optional*
For building the 3ds Max plug-in
Compiling on Windows
====================
Users are advised to use the Visual Studio .sln file in the win/ folder.
For Windows users a prebuilt Open CASCADE version is available from the
http://opencascade.org website. Download and install this version and
provide the paths to the Open CASCADE header and library files to MS
Visual Studio C++.
Users are advised to build IfcOpenShell using the CMake file provided in
the cmake/ folder.
For building the Autodesk 3ds Max plugin, the 3ds Max SDK needs to be
installed as well as 3ds Max itself. Please provide the include and
library paths to Visual Studio.
The preferred way to fetch and build this project's dependencies is to use the build scripts
in win/ folder. **See [win/readme.md] for more information**. Instructions in a nutshell
(**assuming Visual Studio 2015 x64 environment variables set**):
For building the IfcPython wrapper, SWIG needs to be installed. Please
download the latest swigwin version from http://www.swig.org/download.html.
After extracting the .zip file, please add the extracted folder to the PATH
environment variable. Python needs to be installed, please provide the
include and library paths to Visual Studio.
> git clone https://github.com/IfcOpenShell/IfcOpenShell.git
> cd IfcOpenShell\win
> build-deps.cmd
> run-cmake.bat
You can now open and build the solution file in Visual Studio:
> ..\build-vs2015-x64\IfcOpenShell.sln
As the scripts default to using the `RelWithDebInfo` configuration, and a freshly created solution by CMake defaults
to `Debug`, make sure to switch the used build configuration. Build the `INSTALL` project (right-click -> Project
Only) to deploy the headers and binaries into a single location if wanted/needed.
Alternatively, one can use the utility batch files to build and install the project easily from the command-line:
> build-ifcopenshell.cmd
> install-ifcopenshell.cmd
Alternatively, the old Visual Studio solution and project files requiring manual work can
be found from the win/sln folder.
Compiling on *nix
=================
Users are advised to build IfcOpenShell using the cmake file provided in
Users are advised to build IfcOpenShell using the CMake file provided in
the cmake/ folder. There might be an Open CASCADE package in your operating
system's software repository. If not, you will need to compile Open
CASCADE yourself. See http://opencascade.org.
@@ -146,3 +163,5 @@ Or:
>>>
>>> # Writing IFC-SPF files to disk:
>>> f.write("out.ifc")
[win/readme.md]: https://github.com/IfcOpenShell/IfcOpenShell/tree/master/win/readme.md "win/readme.md"
+261 -180
View File
@@ -1,12 +1,64 @@
################################################################################
# #
# 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/>. #
# #
################################################################################
cmake_minimum_required (VERSION 2.6)
project (IfcOpenShell)
FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options)
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
OPTION(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
#TODO OPTION(IFCCONVERT_DOUBLE_PRECISION "IfcConvert: Use double precision floating-point numbers." OFF)
OPTION(USE_IFC4 "Use IFC 4 instead of IFC 2x3 (full rebuild recommended when switching this)" OFF)
OPTION(BUILD_IFCPYTHON "Build IfcPython." ON)
OPTION(BUILD_EXAMPLES "Build example applications." ON)
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
# Find Boost
IF(MSVC)
SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_STATIC_RUNTIME ON)
SET(Boost_USE_MULTITHREADED ON)
ENDIF()
FIND_PACKAGE(Boost REQUIRED COMPONENTS system program_options regex thread date_time)
MESSAGE(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
MESSAGE(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}")
# Find Open CASCADE header files
IF("$ENV{OCC_INCLUDE_DIR}" STREQUAL "")
# Usage:
# SET(SOME_LIRARIES foo bar)
# ADD_DEBUG_VARIANTS(SOME_LIRARIES "${SOME_LIRARIES}" "d")
# "foo bar" -> "optimized foo debug food optimized bar debug bard"
FUNCTION(ADD_DEBUG_VARIANTS NAME LIBRARIES POSTFIX)
SET(LIBRARIES_STR "${LIBRARIES}")
SET(LIBRARIES "")
FOREACH(lib ${LIBRARIES_STR})
SET(LIBRARIES "${LIBRARIES} optimized ${lib}")
SET(LIBRARIES "${LIBRARIES} debug ${lib}${POSTFIX}")
ENDFOREACH()
STRING(STRIP ${LIBRARIES} LIBRARIES) # leading and trailing whitespace cause confusion
SEPARATE_ARGUMENTS(LIBRARIES) # "optimized <lib> debug <lib>" needs to be a list instead of a string
SET(${NAME} ${LIBRARIES} PARENT_SCOPE)
ENDFUNCTION()
# Find Open CASCADE
IF("$ENV{OCC_INCLUDE_DIR}" STREQUAL "")
SET(OCC_INCLUDE_DIR "/usr/include/opencascade/" CACHE FILEPATH "Open CASCADE header files")
MESSAGE(STATUS "Looking for opencascade include files in: ${OCC_INCLUDE_DIR}")
MESSAGE(STATUS "Use OCC_INCLUDE_DIR to specify another directory")
@@ -22,8 +74,16 @@ ELSE()
MESSAGE(FATAL_ERROR "Unable to find header files, aborting")
ENDIF()
# Find Open CASCADE library files
IF("$ENV{OCC_LIBRARY_DIR}" STREQUAL "")
SET(OPENCASCADE_LIBRARIES
TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO
TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset
)
IF(MSVC)
ADD_DEBUG_VARIANTS(OPENCASCADE_LIBRARIES "${OPENCASCADE_LIBRARIES}" "d")
ENDIF()
IF("$ENV{OCC_LIBRARY_DIR}" STREQUAL "")
SET(OCC_LIBRARY_DIR "/usr/lib/" CACHE FILEPATH "Open CASCADE library files")
MESSAGE(STATUS "Looking for opencascade library files in: ${OCC_LIBRARY_DIR}")
MESSAGE(STATUS "Use OCC_LIBRARY_DIR to specify another directory")
@@ -32,210 +92,231 @@ ELSE()
MESSAGE(STATUS "Looking for opencascade library files in: ${OCC_LIBRARY_DIR}")
ENDIF()
FIND_LIBRARY(libTKernel "TKernel" ${OCC_LIBRARY_DIR} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
FIND_LIBRARY(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
IF(libTKernel)
MESSAGE(STATUS "Library files found")
ELSE()
MESSAGE(FATAL_ERROR "Unable to find library files, aborting")
ENDIF()
IF("$ENV{ICU_INCLUDE_DIR}" STREQUAL "")
MESSAGE(STATUS "No ICU include directory specified")
ElSE()
SET(ICU_INCLUDE_DIR CACHE FILEPATH "ICU header files")
IF(UNICODE_SUPPORT)
# Find ICU
IF("$ENV{ICU_INCLUDE_DIR}" STREQUAL "")
MESSAGE(STATUS "No ICU include directory specified")
ElSE()
SET(ICU_INCLUDE_DIR "$ENV{ICU_INCLUDE_DIR}" CACHE FILEPATH "ICU header files")
ENDIF()
IF("$ENV{ICU_LIBRARY_DIR}" STREQUAL "")
MESSAGE(STATUS "No ICU library directory specified")
ElSE()
SET(ICU_LIBRARY_DIR "$ENV{ICU_LIBRARY_DIR}" CACHE FILEPATH "ICU library files")
ENDIF()
FIND_LIBRARY(icu NAMES icuuc icuucd PATHS /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 ${ICU_LIBRARY_DIR})
IF(icu)
ADD_DEFINITIONS(-DHAVE_ICU)
MESSAGE(STATUS "ICU libraries found")
# NOTE icudata appears to be icudt on Windows/MSVC on icudata on others
IF(MSVC)
SET(ICU_LIBRARIES icuuc icudt)
ADD_DEBUG_VARIANTS(ICU_LIBRARIES "${ICU_LIBRARIES}" "d")
ADD_DEFINITIONS(-DU_STATIC_IMPLEMENTATION) # required for static ICU
ELSE()
SET(ICU_LIBRARIES icuuc icudata)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "UNICODE_SUPPORT enabled, but unable to find ICU. Disable UNICODE_SUPPORT or fix ICU paths to proceed.")
ENDIF()
ENDIF()
IF("$ENV{ICU_LIBRARY_DIR}" STREQUAL "")
MESSAGE(STATUS "No ICU library directory specified")
ElSE()
SET(ICU_LIBRARY_DIR CACHE FILEPATH "ICU library files")
IF(COLLADA_SUPPORT)
# Find OpenCOLLADA
IF("$ENV{OPENCOLLADA_INCLUDE_DIR}" STREQUAL "")
MESSAGE(STATUS "No OpenCOLLADA include directory specified")
SET(OPENCOLLADA_INCLUDE_DIR "/usr/local/include/opencollada" CACHE FILEPATH "OpenCOLLADA header files")
ElSE()
SET(OPENCOLLADA_INCLUDE_DIR "$ENV{OPENCOLLADA_INCLUDE_DIR}" CACHE FILEPATH "OpenCOLLADA header files")
ENDIF()
IF("$ENV{OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
MESSAGE(STATUS "No OpenCOLLADA library directory specified")
SET(OPENCOLLADA_LIBRARY_DIR "/usr/local/lib/opencollada" CACHE FILEPATH "OpenCOLLADA library files")
ElSE()
SET(OPENCOLLADA_LIBRARY_DIR "$ENV{OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
ENDIF()
SET(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
FIND_FILE(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
IF(COLLADASWStreamWriter_h)
MESSAGE(STATUS "OpenCOLLADA header files found")
ADD_DEFINITIONS(-DWITH_OPENCOLLADA)
SET(OPENCOLLADA_LIBRARIES
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
OpenCOLLADAStreamWriter UTF buffer ftoa pcre
)
IF(MSVC)
ADD_DEBUG_VARIANTS(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" "d")
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA. Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
ENDIF()
ENDIF()
FIND_LIBRARY(icu "icuuc" /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 ${ICU_LIBRARY_DIR})
# TODO Are these needed on other platforms still or can these be removed for good?
IF (NOT WIN32)
INCLUDE(CheckIncludeFileCXX)
IF(icu)
MESSAGE(STATUS "ICU libraries found")
ADD_DEFINITIONS(-DHAVE_ICU)
SET(ICU_LIBRARIES icuuc icudata)
ELSE()
MESSAGE(STATUS "Unable to find ICU library files, continuing")
MACRO(CHECK_ADD_OCE_OCC_DEF INCLUDE)
STRING(REPLACE . _ STR ${INCLUDE})
STRING(TOUPPER ${STR} STR)
CHECK_INCLUDE_FILE_CXX("${INCLUDE}" FOUND_${STR})
IF(FOUND_${STR})
ADD_DEFINITIONS(-DOCE_HAVE_${STR})
ADD_DEFINITIONS(-DHAVE_${STR})
ENDIF(FOUND_${STR})
ENDMACRO()
CHECK_ADD_OCE_OCC_DEF(limits)
CHECK_ADD_OCE_OCC_DEF(climits)
CHECK_ADD_OCE_OCC_DEF(limits.h)
CHECK_ADD_OCE_OCC_DEF(fstream)
CHECK_ADD_OCE_OCC_DEF(fstream.h)
CHECK_ADD_OCE_OCC_DEF(iomanip)
CHECK_ADD_OCE_OCC_DEF(iomanip.h)
CHECK_ADD_OCE_OCC_DEF(iostream)
CHECK_ADD_OCE_OCC_DEF(iostream.h)
ENDIF()
IF("$ENV{OPENCOLLADA_INCLUDE_DIR}" STREQUAL "")
MESSAGE(STATUS "No OpenCOLLADA include directory specified")
SET(OPENCOLLADA_INCLUDE_DIR "/usr/local/include/opencollada" CACHE FILEPATH "OpenCOLLADA header files")
ElSE()
SET(OPENCOLLADA_INCLUDE_DIR "$ENV{OPENCOLLADA_INCLUDE_DIR}" CACHE FILEPATH "OpenCOLLADA header files")
ENDIF()
IF("$ENV{OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
MESSAGE(STATUS "No OpenCOLLADA library directory specified")
SET(OPENCOLLADA_LIBRARY_DIR "/usr/local/lib/opencollada" CACHE FILEPATH "OpenCOLLADA library files")
ElSE()
SET(OPENCOLLADA_LIBRARY_DIR "$ENV{OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
ENDIF()
SET(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
FIND_FILE(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
IF(COLLADASWStreamWriter_h)
MESSAGE(STATUS "OpenCOLLADA header files found")
ADD_DEFINITIONS(-DWITH_OPENCOLLADA)
SET(OPENCOLLADA_LIBRARIES
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils
OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
OpenCOLLADAStreamWriter UTF buffer ftoa pcre
)
ELSE()
MESSAGE(STATUS "OpenCOLLADA header files not found, continuing without COLLADA support")
ENDIF()
INCLUDE(CheckIncludeFileCXX)
MACRO(CHECK_ADD_OCE_OCC_DEF INCLUDE)
STRING(REPLACE . _ STR ${INCLUDE})
STRING(TOUPPER ${STR} STR)
CHECK_INCLUDE_FILE_CXX("${INCLUDE}" FOUND_${STR})
IF(FOUND_${STR})
ADD_DEFINITIONS(-DOCE_HAVE_${STR})
ADD_DEFINITIONS(-DHAVE_${STR})
ENDIF(FOUND_${STR})
ENDMACRO(CHECK_ADD_OCE_OCC_DEF)
CHECK_ADD_OCE_OCC_DEF(limits)
CHECK_ADD_OCE_OCC_DEF(climits)
CHECK_ADD_OCE_OCC_DEF(limits.h)
CHECK_ADD_OCE_OCC_DEF(fstream)
CHECK_ADD_OCE_OCC_DEF(fstream.h)
CHECK_ADD_OCE_OCC_DEF(iomanip)
CHECK_ADD_OCE_OCC_DEF(iomanip.h)
CHECK_ADD_OCE_OCC_DEF(iostream)
CHECK_ADD_OCE_OCC_DEF(iostream.h)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
# NOTE: RelWithDebInfo and Release use O2 (= /Ox /Gl /Gy/ = Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) by default,
# with the exception with RelWithDebInfo has /Ob1 instead. /Ob2 has been observed to improve the performance
# of IfcConvert significantly.
# TODO Setting of /GL and /LTCG don't seem to apply for static libraries (IfcGeom, IfcParse)
if(ENABLE_BUILD_OPTIMIZATIONS)
if(MSVC)
# C++
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /GL")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
# Linker
# /OPT:REF enables also /OPT:ICF and disables INCREMENTAL
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
# /OPT:NOICF is recommended when /DEBUG is used (http://msdn.microsoft.com/en-us/library/xe4t6fc1.aspx)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:NOICF")
else()
#TODO GCC (& Clang?) optimizations
message(STATUS "ENABLE_BUILD_OPTIMIZATIONS not implemented for GCC/non-MSVC compilers.)")
endif()
endif()
IF(MSVC)
ADD_DEFINITIONS(-D_UNICODE)
ElSE(MSVC)
ADD_DEFINITIONS(-fPIC -Wno-non-virtual-dtor)
ENDIF(MSVC)
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS} /usr/inc /usr/local/inc /usr/local/include/oce ${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
ADD_LIBRARY(IfcParse STATIC
../src/ifcparse/Ifc2x3-latebound.cpp
../src/ifcparse/Ifc2x3.cpp
../src/ifcparse/Ifc4-latebound.cpp
../src/ifcparse/Ifc4.cpp
../src/ifcparse/IfcCharacterDecoder.cpp
../src/ifcparse/IfcGlobalId.cpp
../src/ifcparse/IfcHierarchyHelper.cpp
../src/ifcparse/IfcLateBoundEntity.cpp
../src/ifcparse/IfcParse.cpp
../src/ifcparse/IfcSIPrefix.cpp
../src/ifcparse/IfcSpfHeader.cpp
../src/ifcparse/IfcUtil.cpp
../src/ifcparse/IfcWrite.cpp
)
ADD_LIBRARY(IfcGeom STATIC
../src/ifcgeom/IfcGeomCurves.cpp
../src/ifcgeom/IfcGeomFaces.cpp
../src/ifcgeom/IfcGeomFunctions.cpp
../src/ifcgeom/IfcGeomHelpers.cpp
../src/ifcgeom/IfcGeomMaterial.cpp
../src/ifcgeom/IfcGeomRenderStyles.cpp
../src/ifcgeom/IfcGeomRepresentation.cpp
../src/ifcgeom/IfcGeomShapes.cpp
../src/ifcgeom/IfcGeomWires.cpp
../src/ifcgeom/IfcRegister.cpp
)
IF(icu)
TARGET_LINK_LIBRARIES(IfcParse icuuc)
# Enforce Unicode for CRT and Win32 API calls
ADD_DEFINITIONS(-D_UNICODE -DUNICODE)
# Disable warnings about unsafe C functions; we could use the safe C99 & C11 versions if we have no need for supporting old compilers.
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-bigobj) # required for building the big ifcXXX.objs, https://msdn.microsoft.com/en-us/library/ms173499.aspx
# Bump up the warning level from the default 3 to 4.
ADD_DEFINITIONS(-W4)
IF(MSVC_VERSION GREATER 1800) # > 2013
# Disable overeager and false positives causing C4458 ("declaration of 'indentifier' hides class member"), at least for now.
ADD_DEFINITIONS(-wd4458)
ENDIF()
# Link against the static VC runtime
FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
IF(${flag} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
ENDIF()
IF(${flag} MATCHES "/MDd")
STRING(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
ENDIF()
ENDFOREACH()
ElSE()
ADD_DEFINITIONS(-fPIC -Wno-non-virtual-dtor)
ENDIF()
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}
)
if(NOT WIN32)
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} /usr/inc /usr/local/inc /usr/local/include/oce)
endif()
IF(USE_IFC4)
ADD_DEFINITIONS(-DUSE_IFC4)
ELSE()
ADD_DEFINITIONS(-DUSE_IFC2x3) # TODO Make all caps? i.e. USE_IFC2X3
ENDIF()
# IfcParse
file(GLOB CPP_FILES ../src/ifcparse/*.cpp)
file(GLOB H_FILES ../src/ifcparse/*.h)
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
ADD_LIBRARY(IfcParse STATIC ${SOURCE_FILES})
IF(UNICODE_SUPPORT)
TARGET_LINK_LIBRARIES(IfcParse ${ICU_LIBRARIES})
ENDIF()
# IfcGeom
file(GLOB CPP_FILES ../src/ifcgeom/*.cpp)
file(GLOB H_FILES ../src/ifcgeom/*.h)
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
ADD_LIBRARY(IfcGeom STATIC ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(IfcGeom IfcParse)
LINK_DIRECTORIES (${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 ${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
ADD_EXECUTABLE(IfcConvert
../src/ifcconvert/ColladaSerializer.cpp
../src/ifcconvert/IfcConvert.cpp
../src/ifcconvert/OpenCascadeBasedSerializer.cpp
../src/ifcconvert/WavefrontObjSerializer.cpp
../src/ifcconvert/XmlSerializer.cpp
../src/ifcconvert/SvgSerializer.cpp
../src/ifcconvert/util.cpp
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR}
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS}
)
if(NOT WIN32)
LINK_DIRECTORIES(${LINK_DIRECTORIES} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
endif()
TARGET_LINK_LIBRARIES (IfcConvert IfcParse IfcGeom TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
# IfcConvert
# TODO
# if (IFCCONVERT_DOUBLE_PRECISION)
# add_definitions(-DIFCCONVERT_DOUBLE_PRECISION)
# endif()
file(GLOB CPP_FILES ../src/ifcconvert/*.cpp)
file(GLOB H_FILES ../src/ifcconvert/*.h)
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
ADD_EXECUTABLE(IfcConvert ${SOURCE_FILES})
ADD_EXECUTABLE(IfcGeomServer
../src/ifcgeomserver/IfcGeomServer.cpp
)
TARGET_LINK_LIBRARIES(IfcConvert IfcParse IfcGeom ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
TARGET_LINK_LIBRARIES (IfcGeomServer IfcParse IfcGeom TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet TKSTEP TKSTEPBase TKSTEPAttr TKXSBase TKSTEP209 TKIGES TKOffset ${ICU_LIBRARIES})
# IfcGeomServer
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
ADD_EXECUTABLE(IfcGeomServer ${SOURCE_FILES})
# Build python wrapper using separate CMakeLists.txt
ADD_SUBDIRECTORY(../src/ifcwrap ifcwrap)
TARGET_LINK_LIBRARIES(IfcGeomServer IfcParse IfcGeom ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES})
# Build IfcParseExamples using separate CMakeLists.txt
ADD_SUBDIRECTORY(../src/examples examples)
IF(BUILD_IFCPYTHON)
ADD_SUBDIRECTORY(../src/ifcwrap ifcwrap)
ENDIF()
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(../src/examples examples)
ENDIF()
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
# IF(BUILD_QTVIEWER)
# ADD_SUBDIRECTORY(../src/qtviewer qtviewer)
# ENDIF()
# CMake installation targets
SET(include_files_geom
../src/ifcgeom/IfcGeom.h
../src/ifcgeom/IfcGeomElement.h
../src/ifcgeom/IfcGeomIterator.h
../src/ifcgeom/IfcGeomIteratorSettings.h
../src/ifcgeom/IfcGeomMaterial.h
../src/ifcgeom/IfcGeomRenderStyles.h
../src/ifcgeom/IfcGeomRepresentation.h
../src/ifcgeom/IfcGeomShapeType.h
../src/ifcgeom/IfcRegister.h
../src/ifcgeom/IfcRegisterConvertCurve.h
../src/ifcgeom/IfcRegisterConvertFace.h
../src/ifcgeom/IfcRegisterConvertShape.h
../src/ifcgeom/IfcRegisterConvertShapes.h
../src/ifcgeom/IfcRegisterConvertWire.h
../src/ifcgeom/IfcRegisterCreateCache.h
../src/ifcgeom/IfcRegisterDef.h
../src/ifcgeom/IfcRegisterGeomHeader.h
../src/ifcgeom/IfcRegisterPurgeCache.h
../src/ifcgeom/IfcRegisterShapeType.h
../src/ifcgeom/IfcRegisterUndef.h
../src/ifcgeom/IfcRepresentationShapeItem.h
)
SET(include_files_parse
../src/ifcparse/Ifc2x3-latebound.h
../src/ifcparse/Ifc2x3.h
../src/ifcparse/Ifc2x3enum.h
../src/ifcparse/Ifc4-latebound.h
../src/ifcparse/Ifc4.h
../src/ifcparse/Ifc4enum.h
../src/ifcparse/IfcCharacterDecoder.h
../src/ifcparse/IfcEntityDescriptor.h
../src/ifcparse/IfcException.h
../src/ifcparse/IfcFile.h
../src/ifcparse/IfcGlobalId.h
../src/ifcparse/IfcHierarchyHelper.h
../src/ifcparse/IfcLateBoundEntity.h
../src/ifcparse/IfcParse.h
../src/ifcparse/IfcSIPrefix.h
../src/ifcparse/IfcSpfHeader.h
../src/ifcparse/IfcSpfStream.h
../src/ifcparse/IfcUtil.h
../src/ifcparse/IfcWritableEntity.h
../src/ifcparse/IfcWrite.h
../src/ifcparse/SharedPointer.h
)
FILE(GLOB include_files_geom ../src/ifcgeom/*.h)
FILE(GLOB include_files_parse ../src/ifcparse/*.h)
INSTALL(FILES ${include_files_geom} DESTINATION include/ifcgeom)
INSTALL(FILES ${include_files_parse} DESTINATION include/ifcparse)
INSTALL(TARGETS IfcConvert DESTINATION bin)
INSTALL(TARGETS IfcConvert IfcGeomServer DESTINATION bin)
INSTALL(TARGETS IfcParse IfcGeom DESTINATION lib)
+21 -2
View File
@@ -1,5 +1,24 @@
################################################################################
# #
# 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/>. #
# #
################################################################################
ADD_EXECUTABLE(IfcParseExamples IfcParseExamples.cpp)
TARGET_LINK_LIBRARIES (IfcParseExamples IfcParse)
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
ADD_EXECUTABLE(IfcOpenHouse IfcOpenHouse.cpp)
TARGET_LINK_LIBRARIES (IfcOpenHouse IfcParse IfcGeom TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet TKOffset)
TARGET_LINK_LIBRARIES(IfcOpenHouse IfcParse IfcGeom ${OPENCASCADE_LIBRARIES})
+1 -1
View File
@@ -50,7 +50,7 @@ boost::none_t const null = boost::none;
// The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron
void createGroundShape(TopoDS_Shape& shape);
int main(int argc, char** argv) {
int main() {
// The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
// convenience functions for working with geometry in IFC files.
+5 -5
View File
@@ -39,8 +39,8 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const
COLLADASW::FloatSource source(mSW);
source.setId(mesh_id + suffix);
source.setArrayId(mesh_id + suffix + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX);
source.setAccessorStride(strlen(coords));
source.setAccessorCount(floats.size() / 3);
source.setAccessorStride((unsigned long)strlen(coords));
source.setAccessorCount((unsigned long)floats.size() / 3);
for (unsigned int i = 0; i < source.getAccessorStride(); ++i) {
source.getParameterNameList().push_back(std::string(1, coords[i]));
}
@@ -73,7 +73,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::write(const std::str
int previous_material_id = -1;
for (std::vector<int>::const_iterator it = faces.begin(); !faces.empty(); it += 3) {
const int current_material_id = *(material_it++);
const int num_triangles = std::distance(index_range_start, it) / 3;
const unsigned long num_triangles = (unsigned long)std::distance(index_range_start, it) / 3;
if ((previous_material_id != current_material_id && num_triangles > 0) || (it == faces.end())) {
COLLADASW::Triangles triangles(mSW);
triangles.setMaterial(materials[previous_material_id].name());
@@ -126,9 +126,9 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::write(const std::str
for (linelist_t::const_iterator it = linelist.begin(); it != linelist.end(); ++it) {
COLLADASW::Lines lines(mSW);
lines.setMaterial(materials[it->first].name());
lines.setCount(it->second.size());
lines.setCount((unsigned long)it->second.size());
int offset = 0;
lines.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::VERTEX, "#" + mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, 0));
lines.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::VERTEX, "#" + mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, offset++));
lines.prepareToAppendValues();
lines.appendValues(it->second);
lines.finish();
+18 -1
View File
@@ -22,6 +22,10 @@
#ifndef COLLADASERIALIZER_H
#define COLLADASERIALIZER_H
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4201 4512)
#endif
#include <COLLADASWStreamWriter.h>
#include <COLLADASWPrimitves.h>
#include <COLLADASWLibraryGeometries.h>
@@ -34,6 +38,9 @@
#include <COLLADASWLibraryMaterials.h>
#include <COLLADASWBaseInputElement.h>
#include <COLLADASWAsset.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "../ifcgeom/IfcGeomIterator.h"
@@ -41,12 +48,15 @@
class ColladaSerializer : public GeometrySerializer
{
// TODO The vast amount of implement details of ColladaSerializer could be hidden to the cpp file.
private:
class ColladaExporter
{
private:
class ColladaGeometries : public COLLADASW::LibraryGeometries
{
ColladaGeometries(const ColladaGeometries&); //N/A
ColladaGeometries& operator =(const ColladaGeometries&); //N/A
public:
explicit ColladaGeometries(COLLADASW::StreamWriter& stream)
: COLLADASW::LibraryGeometries(&stream)
@@ -58,6 +68,9 @@ private:
class ColladaScene : public COLLADASW::LibraryVisualScenes
{
private:
ColladaScene(const ColladaScene&); //N/A
ColladaScene& operator =(const ColladaScene&); //N/A
const std::string scene_id;
bool scene_opened;
public:
@@ -71,9 +84,13 @@ private:
};
class ColladaMaterials : public COLLADASW::LibraryMaterials
{
ColladaMaterials(const ColladaMaterials&); //N/A
ColladaMaterials& operator =(const ColladaMaterials&); //N/A
private:
class ColladaEffects : public COLLADASW::LibraryEffects
{
ColladaEffects(const ColladaEffects&); //N/A
ColladaEffects& operator =(const ColladaEffects&); //N/A
public:
explicit ColladaEffects(COLLADASW::StreamWriter& stream)
: COLLADASW::LibraryEffects(&stream)
@@ -148,7 +165,7 @@ public:
bool ready();
void writeHeader();
void write(const IfcGeom::TriangulationElement<double>* o);
void write(const IfcGeom::BRepElement<double>* o) {}
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
void finalize();
bool isTesselated() const { return true; }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
+2
View File
@@ -43,6 +43,8 @@
#include "../ifcconvert/XmlSerializer.h"
#include "../ifcconvert/SvgSerializer.h"
#include <IGESControl_Controller.hxx>
static std::string DEFAULT_EXTENSION = "obj";
void printVersion() {
+1 -2
View File
@@ -20,7 +20,6 @@
#ifndef IGESSERIALIZER_H
#define IGESSERIALIZER_H
#include <IGESControl_Controller.hxx>
#include <IGESControl_Writer.hxx>
#include <Interface_Static.hxx>
@@ -43,7 +42,7 @@ public:
void finalize() {
writer.Write(out_filename.c_str());
}
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) {
const char* symbol = getSymbolForUnitMagnitude(magnitude);
if (symbol) {
Interface_Static::SetCVal("xstep.cascade.unit", symbol);
+4 -3
View File
@@ -25,8 +25,10 @@
#include "../ifcconvert/GeometrySerializer.h"
class OpenCascadeBasedSerializer : public GeometrySerializer {
OpenCascadeBasedSerializer(const OpenCascadeBasedSerializer&); //N/A
OpenCascadeBasedSerializer& operator =(const OpenCascadeBasedSerializer&); //N/A
protected:
const std::string& out_filename;
const std::string out_filename;
const char* getSymbolForUnitMagnitude(float mag);
public:
explicit OpenCascadeBasedSerializer(const std::string& out_filename)
@@ -35,10 +37,9 @@ public:
{}
virtual ~OpenCascadeBasedSerializer() {}
void writeHeader() {}
void writeMaterial(const IfcGeom::SurfaceStyle& style) {}
bool ready();
virtual void writeShape(const TopoDS_Shape& shape) = 0;
void write(const IfcGeom::TriangulationElement<double>* o) {}
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
void write(const IfcGeom::BRepElement<double>* o);
bool isTesselated() const { return false; }
void setFile(IfcParse::IfcFile*) {}
+1 -2
View File
@@ -20,7 +20,6 @@
#ifndef STEPSERIALIZER_H
#define STEPSERIALIZER_H
#include <STEPControl_Controller.hxx>
#include <STEPControl_Writer.hxx>
#include <Interface_Static.hxx>
@@ -49,7 +48,7 @@ public:
writer.Write(out_filename.c_str());
std::cout.rdbuf(sb);
}
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
void setUnitNameAndMagnitude(const std::string& /*name*/, float magnitude) {
const char* symbol = getSymbolForUnitMagnitude(magnitude);
if (symbol) {
Interface_Static::SetCVal("xstep.cascade.unit", symbol);
+2 -2
View File
@@ -43,7 +43,7 @@
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Version.hxx>
#include "../ifcparse/IfcGlobalId.h"
#include "SvgSerializer.h"
@@ -178,7 +178,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement<double>* o) {
typedef IfcSchema::IfcRelAggregates decomposition_element;
#endif
while (true) {
for (;;) {
// Iterate over the decomposing element to find the parent IfcBuildingStorey
decomposition_element::list::ptr decomposes = obdef->Decomposes();
if (!decomposes->size()) {
+2 -4
View File
@@ -35,7 +35,6 @@ class SvgSerializer : public GeometrySerializer {
public:
typedef std::pair<std::string, std::vector<util::string_buffer> > path_object;
protected:
const char* getSymbolForUnitMagnitude(float mag);
std::ofstream svg_file;
double xmin, ymin, xmax, ymax, width, height;
boost::optional<double> section_height;
@@ -62,15 +61,14 @@ public:
virtual void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; }
virtual ~SvgSerializer() {}
virtual void writeHeader();
virtual void writeMaterial(const IfcGeom::SurfaceStyle& style) {}
virtual bool ready();
virtual void write(const IfcGeom::TriangulationElement<double>* o) {}
virtual void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
virtual void write(const IfcGeom::BRepElement<double>* o);
virtual void write(path_object& p, const TopoDS_Wire& wire);
virtual path_object& start_path(IfcSchema::IfcBuildingStorey* storey, const std::string& id);
virtual bool isTesselated() const { return false; }
virtual void finalize();
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) {}
virtual void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
virtual void setFile(IfcParse::IfcFile* f) { file = f; }
virtual void setBoundingRectangle(double width, double height);
virtual void setSectionHeight(double h) { section_height = h; }
+1 -1
View File
@@ -75,7 +75,7 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<double>*
const IfcGeom::Representation::Triangulation<double>& mesh = o->geometry();
const int vcount = mesh.verts().size() / 3;
const int vcount = (int)mesh.verts().size() / 3;
for ( std::vector<double>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end(); ) {
const double x = *(it++);
const double y = *(it++);
+2 -2
View File
@@ -46,10 +46,10 @@ public:
void writeHeader();
void writeMaterial(const IfcGeom::Material& style);
void write(const IfcGeom::TriangulationElement<double>* o);
void write(const IfcGeom::BRepElement<double>* o) {}
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
void finalize() {}
bool isTesselated() const { return true; }
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {}
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
void setFile(IfcParse::IfcFile*) {}
};
+23 -1
View File
@@ -1,3 +1,22 @@
/********************************************************************************
* *
* 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/>. *
* *
********************************************************************************/
#include <map>
#include <boost/property_tree/ptree.hpp>
@@ -7,6 +26,8 @@
#include "XmlSerializer.h"
#include <algorithm>
using boost::property_tree::ptree;
using namespace IfcSchema;
@@ -58,7 +79,8 @@ boost::optional<std::string> format_attribute(const Argument* argument, IfcUtil:
unit_name = unit->Name();
}
for (std::string::iterator c = unit_name.begin(); c != unit_name.end(); ++c) *c = tolower(*c);
// TODO add toLower() and toUpper() string helper functions for the project
std::transform(unit_name.begin(), unit_name.end(), unit_name.begin(), ::tolower);
value = unit_name;
}
+3 -1
View File
@@ -4,6 +4,8 @@ the IFC schema and will most likely fail on any other Express schema.
The code can be invoked in the following way and results in two header files
and a single implementation file named according to the schema name in the
Express file. A python 3 interpreter with the pyparsing library is required.
Express file. A python 3 interpreter with the pyparsing [1] library is required.
$ python bootstrap.py express.bnf > express_parser.py && python express_parser.py IFC2X3_TC1.exp
[1] http://pyparsing.wikispaces.com/Download+and+Installation
+36 -26
View File
@@ -23,7 +23,6 @@ header = """
#include <string>
#include <vector>
#include <map>
#include <boost/optional.hpp>
@@ -31,6 +30,11 @@ header = """
#include "../ifcparse/IfcException.h"
#include "../ifcparse/%(schema_name)senum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema %(schema_name)s
namespace %(schema_name)s {
@@ -47,6 +51,10 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
"""
@@ -107,6 +115,8 @@ implementation= """
#include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace %(schema_name)s;
using namespace IfcParse;
using namespace IfcWrite;
@@ -261,49 +271,49 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
}
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
while (true) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
for(;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
if ((t = Parent(t)) == -1) break;
}
throw IfcException("Attribute not found");
}
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value;
std::set<std::string> return_value;
while (true) {
for (;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
if ((t = Parent(t)) == -1) break;
}
return return_value;
return return_value;
}
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
}
"""
+2 -2
View File
@@ -149,8 +149,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBSplineCurveWithKnots* l, Hand
const std::vector<double> knots = l->Knots();
TColgp_Array1OfPnt Poles(0, cps->size() - 1);
TColStd_Array1OfReal Knots(0, knots.size() - 1);
TColStd_Array1OfInteger Mults(0, mults.size() - 1);
TColStd_Array1OfReal Knots(0, (int)knots.size() - 1);
TColStd_Array1OfInteger Mults(0, (int)mults.size() - 1);
Standard_Integer Degree = l->Degree();
Standard_Boolean Periodic = l->ClosedCurve();
+9 -10
View File
@@ -101,7 +101,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
IfcSchema::IfcFaceBound::list::ptr bounds = l->Bounds();
Handle(Geom_Surface) face_surface;
bool reversed_face_surface = false;
const bool is_face_surface = l->is(IfcSchema::Type::IfcFaceSurface);
if (is_face_surface) {
@@ -237,9 +236,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) {
// If the wires are reversed the face needs to be reversed as well in order
// to maintain the counter-clock-wise ordering of the bounding wire's vertices.
bool all_reversed = true;
TopoDS_Iterator it(outer_face_bound, false);
for (; it.More(); it.Next()) {
const TopoDS_Wire& w = TopoDS::Wire(it.Value());
TopoDS_Iterator jt(outer_face_bound, false);
for (; jt.More(); jt.Next()) {
const TopoDS_Wire& w = TopoDS::Wire(jt.Value());
if ((w.Orientation() != TopAbs_REVERSED) == same_sense) {
all_reversed = false;
}
@@ -856,7 +855,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCompositeProfileDef* l, TopoDS
builder.MakeCompound(compound);
IfcSchema::IfcProfileDef::list::ptr profiles = l->Profiles();
bool first = true;
//bool first = true;
for (IfcSchema::IfcProfileDef::list::it it = profiles->begin(); it != profiles->end(); ++it) {
TopoDS_Face f;
if (convert_face(*it, f)) {
@@ -899,11 +898,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBSplineSurfaceWithKnots* l, To
std::vector<int> umults = l->UMultiplicities();
std::vector<int> vmults = l->VMultiplicities();
TColgp_Array2OfPnt Poles (0, cps->size() - 1, 0, (*cps->begin()).size() - 1);
TColStd_Array1OfReal UKnots(0, uknots.size() - 1);
TColStd_Array1OfReal VKnots(0, vknots.size() - 1);
TColStd_Array1OfInteger UMults(0, umults.size() - 1);
TColStd_Array1OfInteger VMults(0, vmults.size() - 1);
TColgp_Array2OfPnt Poles (0, (int)cps->size() - 1, 0, (int)(*cps->begin()).size() - 1);
TColStd_Array1OfReal UKnots(0, (int)uknots.size() - 1);
TColStd_Array1OfReal VKnots(0, (int)vknots.size() - 1);
TColStd_Array1OfInteger UMults(0, (int)umults.size() - 1);
TColStd_Array1OfInteger VMults(0, (int)vmults.size() - 1);
Standard_Integer UDegree = l->UDegree();
Standard_Integer VDegree = l->VDegree();
+10 -12
View File
@@ -213,12 +213,11 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
? BRepBuilderAPI_GTransform(opening_shape_unlocated,opening_shape_gtrsf,true).Shape()
: opening_shape_unlocated.Moved(opening_shape_gtrsf.Trsf());
double opening_volume, original_shape_volume;
double opening_volume;
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
opening_volume = shape_volume(opening_shape);
if ( opening_volume <= ALMOST_ZERO )
Logger::Message(Logger::LOG_WARNING,"Empty opening for:",entity->entity);
original_shape_volume = shape_volume(entity_shape);
}
if (entity_shape.ShapeType() == TopAbs_COMPSOLID) {
@@ -240,9 +239,9 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
BRepCheck_Analyzer analyser(brep_cut_result);
bool is_valid = analyser.IsValid() != 0;
if (is_valid) {
TopExp_Explorer exp(brep_cut_result, TopAbs_SOLID);
for (; exp.More(); exp.Next()) {
builder.Add(compound, exp.Current());
TopExp_Explorer exp2(brep_cut_result, TopAbs_SOLID);
for (; exp2.More(); exp2.Next()) {
builder.Add(compound, exp2.Current());
added = true;
}
}
@@ -277,7 +276,7 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
entity_shape = brep_cut_result;
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
const double volume_after_subtraction = shape_volume(entity_shape);
double original_shape_volume = shape_volume(entity_shape);
if ( ALMOST_THE_SAME(original_shape_volume,volume_after_subtraction) )
Logger::Message(Logger::LOG_WARNING,"Subtraction yields unchanged volume:",entity->entity);
}
@@ -625,11 +624,11 @@ IfcSchema::IfcProductDefinitionShape* IfcGeom::tesselate(TopoDS_Shape& shape, do
IfcSchema::IfcFaceOuterBound* bound = new IfcSchema::IfcFaceOuterBound(loop, face.Orientation() != TopAbs_REVERSED);
IfcSchema::IfcFaceBound::list::ptr bounds (new IfcSchema::IfcFaceBound::list);
bounds->push(bound);
IfcSchema::IfcFace* face = new IfcSchema::IfcFace(bounds);
IfcSchema::IfcFace* face2 = new IfcSchema::IfcFace(bounds);
es->push(loop);
es->push(bound);
es->push(face);
faces->push(face);
es->push(face2);
faces->push(face2);
}
}
}
@@ -713,7 +712,6 @@ bool IfcGeom::Kernel::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& sha
// Now loop over all the vertices that are part of the wire(s) to be filled
for (int i = 1; i <= num_verts; ++i) {
first = current = TopoDS::Vertex(vertex_to_edges.FindKey(i));
const bool isSame = first.IsSame(current);
// We keep track of the vertices we already used
if (visited.find(vertex_to_edges.FindIndex(current)) != visited.end()) {
continue;
@@ -721,7 +719,7 @@ bool IfcGeom::Kernel::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& sha
// Given these vertices, try to find closed loops and create new
// wires out of them.
BRepBuilderAPI_MakeWire w;
while (true) {
for (;;) {
visited.insert(vertex_to_edges.FindIndex(current));
// Find the edge that the current vertex is part of and points
// away from the previous vertex (null for the first vertex).
@@ -842,7 +840,7 @@ void IfcGeom::Kernel::remove_redundant_points_from_loop(TColgp_SequenceOfPnt& po
if (tol <= 0.) tol = getValue(GV_POINT_EQUALITY_TOLERANCE);
tol *= tol;
while (true) {
for (;;) {
bool removed = false;
int n = polygon.Length() - (closed ? 0 : 1);
for (int i = 1; i <= n; ++i) {
+1 -1
View File
@@ -287,7 +287,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& t
return false;
}
IfcSchema::IfcLocalPlacement* current = (IfcSchema::IfcLocalPlacement*)l;
while (1) {
for (;;) {
gp_Trsf trsf2;
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
if ( relplacement->is(IfcSchema::Type::IfcAxis2Placement3D) ) {
+5 -5
View File
@@ -289,7 +289,7 @@ namespace IfcGeom {
}
BRepElement<P>* create_shape_model_for_next_entity() {
while ( true ) {
for (;;) {
IfcSchema::IfcRepresentation* representation;
// Have we reached the end of our list of representations?
@@ -322,16 +322,16 @@ namespace IfcGeom {
// Filter the products based on the set of entities being included or excluded for
// processing. The set is iterated over te able to filter on subtypes.
for ( IfcSchema::IfcProduct::list::it it = unfiltered_products->begin(); it != unfiltered_products->end(); ++it ) {
for ( IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt ) {
bool found = false;
for (std::set<IfcSchema::Type::Enum>::const_iterator jt = entities_to_include_or_exclude.begin(); jt != entities_to_include_or_exclude.end(); ++jt) {
if ((*it)->is(*jt)) {
for (std::set<IfcSchema::Type::Enum>::const_iterator kt = entities_to_include_or_exclude.begin(); kt != entities_to_include_or_exclude.end(); ++kt) {
if ((*jt)->is(*kt)) {
found = true;
break;
}
}
if (found == include_entities_in_processing) {
ifcproducts->push(*it);
ifcproducts->push(*jt);
}
}
+20 -18
View File
@@ -41,6 +41,8 @@ namespace IfcGeom {
namespace Representation {
class Representation {
Representation(const Representation&); //N/A
Representation& operator =(const Representation&); //N/A
protected:
const ElementSettings _settings;
public:
@@ -116,33 +118,33 @@ namespace IfcGeom {
: Representation(shape_model.settings())
, _id(shape_model.getId())
{
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it = shape_model.begin(); it != shape_model.end(); ++ it ) {
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++ iit ) {
int surface_style_id = -1;
if (it->hasStyle()) {
Material adapter(&it->Style());
if (iit->hasStyle()) {
Material adapter(&iit->Style());
std::vector<Material>::const_iterator jt = std::find(_materials.begin(), _materials.end(), adapter);
if (jt == _materials.end()) {
surface_style_id = _materials.size();
surface_style_id = (int)_materials.size();
_materials.push_back(adapter);
} else {
surface_style_id = jt - _materials.begin();
surface_style_id = (int)(jt - _materials.begin());
}
}
if (settings().apply_default_materials() && surface_style_id == -1) {
Material material(IfcGeom::get_default_style(settings().element_type()));
std::vector<Material>::const_iterator it = std::find(_materials.begin(), _materials.end(), material);
if (it == _materials.end()) {
surface_style_id = _materials.size();
std::vector<Material>::const_iterator mit = std::find(_materials.begin(), _materials.end(), material);
if (mit == _materials.end()) {
surface_style_id = (int)_materials.size();
_materials.push_back(material);
} else {
surface_style_id = it - _materials.begin();
surface_style_id = (int)(mit - _materials.begin());
}
}
const TopoDS_Shape& s = it->Shape();
const gp_GTrsf& trsf = it->Placement();
const TopoDS_Shape& s = iit->Shape();
const gp_GTrsf& trsf = iit->Placement();
// Triangulate the shape
try {
@@ -233,11 +235,11 @@ namespace IfcGeom {
addEdge(dict[n2], dict[n3], edgecount, edges_temp);
addEdge(dict[n3], dict[n1], edgecount, edges_temp);
}
for ( std::vector<std::pair<int,int> >::const_iterator it = edges_temp.begin(); it != edges_temp.end(); ++it ) {
if (edgecount[*it] == 1) {
for ( std::vector<std::pair<int,int> >::const_iterator jt = edges_temp.begin(); jt != edges_temp.end(); ++jt ) {
if (edgecount[*jt] == 1) {
// non manifold edge, face boundary
_edges.push_back(it->first);
_edges.push_back(it->second);
_edges.push_back(jt->first);
_edges.push_back(jt->second);
}
}
}
@@ -247,11 +249,11 @@ namespace IfcGeom {
// Edges are only emitted if there are no faces. A mixed representation of faces
// and loose edges is discouraged by the standard. An alternative would be to use
// TopExp::MapShapesAndAncestors() to find edges that do not belong to any face.
for (TopExp_Explorer exp(s, TopAbs_EDGE); exp.More(); exp.Next()) {
BRepAdaptor_Curve crv(TopoDS::Edge(exp.Current()));
for (TopExp_Explorer texp(s, TopAbs_EDGE); texp.More(); texp.Next()) {
BRepAdaptor_Curve crv(TopoDS::Edge(texp.Current()));
GCPnts_QuasiUniformDeflection tessellater(crv, settings().deflection_tolerance());
int n = tessellater.NbPoints();
int start = _verts.size() / 3;
int start = (int)_verts.size() / 3;
for (int i = 1; i <= n; ++i) {
gp_XYZ p = tessellater.Value(i).XYZ();
trsf.Transforms(p);
+6 -6
View File
@@ -404,7 +404,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBooleanResult* l, TopoDS_Shape
bool IfcGeom::Kernel::convert(const IfcSchema::IfcConnectedFaceSet* l, TopoDS_Shape& shape) {
IfcSchema::IfcFace::list::ptr faces = l->CfsFaces();
bool facesAdded = false;
const unsigned int num_faces = faces->size();
const unsigned int num_faces = (unsigned)faces->size();
bool valid_shell = false;
if ( num_faces < getValue(GV_MAX_FACES_TO_SEW) ) {
BRepOffsetAPI_Sewing builder;
@@ -632,9 +632,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCurveBoundedPlane* l, TopoDS_S
BRepBuilderAPI_MakeFace mf (outer);
mf.Add(outer);
IfcSchema::IfcCurve::list::ptr inner = l->InnerBoundaries();
IfcSchema::IfcCurve::list::ptr boundaries = l->InnerBoundaries();
for (IfcSchema::IfcCurve::list::it it = inner->begin(); it != inner->end(); ++it) {
for (IfcSchema::IfcCurve::list::it it = boundaries->begin(); it != boundaries->end(); ++it) {
TopoDS_Wire inner;
convert_wire(*it, inner);
@@ -767,8 +767,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap
// Subtraction of pipes with small radii is unstable.
hasInnerRadius = false;
} else {
Handle(Geom_Circle) circle = new Geom_Circle(directrix, r2);
section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle));
Handle(Geom_Circle) circle2 = new Geom_Circle(directrix, r2);
section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle2));
}
}
@@ -887,7 +887,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTriangulatedFaceSet* l, TopoDS
if (faces.empty()) return false;
const unsigned int num_faces = indices.size();
const unsigned int num_faces = (unsigned)indices.size();
bool valid_shell = false;
if (faces.size() < getValue(GV_MAX_FACES_TO_SEW)) {
+3 -5
View File
@@ -184,8 +184,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire&
bool trim_cartesian = l->MasterRepresentation() == IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_CARTESIAN;
IfcEntityList::ptr trims1 = l->Trim1();
IfcEntityList::ptr trims2 = l->Trim2();
bool trimmed1 = false;
bool trimmed2 = false;
unsigned sense_agreement = l->SenseAgreement() ? 0 : 1;
double flts[2];
gp_Pnt pnts[2];
@@ -411,9 +409,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcEdgeLoop* l, TopoDS_Wire& resu
TopoDS_Wire w;
if (convert_wire(*it, w)) {
if (!(*it)->Orientation()) w.Reverse();
TopoDS_Iterator it(w, false);
for (; it.More(); it.Next()) {
const TopoDS_Edge& e = TopoDS::Edge(it.Value());
TopoDS_Iterator topoit(w, false);
for (; topoit.More(); topoit.Next()) {
const TopoDS_Edge& e = TopoDS::Edge(topoit.Value());
mw.Add(e);
}
// mw.Add(w);
+18 -22
View File
@@ -69,7 +69,7 @@ void swrite(std::ostream& s, T t) {
template <>
void swrite(std::ostream& s, std::string t) {
int32_t len = t.size();
int32_t len = (int32_t)t.size();
swrite(s, len);
s.write(t.c_str(), len);
while (len++ % 4) s.put(0);
@@ -156,16 +156,16 @@ public:
class Get : public Command {
protected:
void read_content(std::istream& s) {}
void write_content(std::ostream& s) {}
void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& /*s*/) {}
public:
Get() : Command(GET) {};
};
class GetLog : public Command {
protected:
void read_content(std::istream& s) {}
void write_content(std::ostream& s) {}
void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& /*s*/) {}
public:
GetLog() : Command(GET_LOG) {};
};
@@ -189,7 +189,7 @@ private:
const IfcGeom::TriangulationElement<float>* geom;
bool append_line_data;
protected:
void read_content(std::istream& s) {}
void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& s) {
swrite<int32_t>(s, geom->id());
swrite(s, geom->guid());
@@ -238,9 +238,9 @@ protected:
}
{ std::vector<float> diffuse_color_array;
for (std::vector<IfcGeom::Material>::const_iterator it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) {
const IfcGeom::Material& m = *it;
if (m.hasDiffuse()) {
const double* color = m.diffuse();
const IfcGeom::Material& mat = *it;
if (mat.hasDiffuse()) {
const double* color = mat.diffuse();
diffuse_color_array.push_back(static_cast<float>(color[0]));
diffuse_color_array.push_back(static_cast<float>(color[1]));
diffuse_color_array.push_back(static_cast<float>(color[2]));
@@ -249,8 +249,8 @@ protected:
diffuse_color_array.push_back(0.f);
diffuse_color_array.push_back(0.f);
}
if (m.hasTransparency()) {
diffuse_color_array.push_back(static_cast<float>(1. - m.transparency()));
if (mat.hasTransparency()) {
diffuse_color_array.push_back(static_cast<float>(1. - mat.transparency()));
} else {
diffuse_color_array.push_back(1.f);
}
@@ -268,25 +268,21 @@ public:
class Next : public Command {
protected:
void read_content(std::istream& s) {}
void write_content(std::ostream& s) {}
void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& /*s*/) {}
public:
Next() : Command(NEXT) {};
};
class Bye : public Command {
protected:
void read_content(std::istream& s) {}
void write_content(std::ostream& s) {}
void read_content(std::istream& /*s*/) {}
void write_content(std::ostream& /*s*/) {}
public:
Bye() : Command(BYE) {};
};
int main (int argc, char** argv) {
if (sizeof(float) != 4 || sizeof(int32_t) != 4) {
return 1;
}
int main () {
// Redirect stdout to this stream, so that involuntary
// writes to stdout do not interfere with our protocol.
std::ostringstream oss;
@@ -308,7 +304,7 @@ int main (int argc, char** argv) {
Hello().write(std::cout);
int exit_code = 0;
while (1) {
for (;;) {
const int32_t msg_type = sread<int32_t>(std::cin);
switch (msg_type) {
case IFC_MODEL: {
@@ -323,7 +319,7 @@ int main (int argc, char** argv) {
settings.convert_back_units() = true;
settings.include_curves() = true;
iterator = new IfcGeom::Iterator<float>(settings, data, len);
iterator = new IfcGeom::Iterator<float>(settings, data, (int)len);
has_more = iterator->initialize();
More(has_more).write(std::cout);
+25 -25
View File
@@ -4247,48 +4247,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
}
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
while (true) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
for(;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
if ((t = Parent(t)) == -1) break;
}
throw IfcException("Attribute not found");
}
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value;
std::set<std::string> return_value;
while (true) {
for (;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
if ((t = Parent(t)) == -1) break;
}
return return_value;
return return_value;
}
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
}
#endif
+2
View File
@@ -31,6 +31,8 @@
#include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace Ifc2x3;
using namespace IfcParse;
using namespace IfcWrite;
+9 -1
View File
@@ -29,7 +29,6 @@
#include <string>
#include <vector>
#include <map>
#include <boost/optional.hpp>
@@ -37,6 +36,11 @@
#include "../ifcparse/IfcException.h"
#include "../ifcparse/Ifc2x3enum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema Ifc2x3
namespace Ifc2x3 {
@@ -41583,4 +41587,8 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
+25 -25
View File
@@ -4941,48 +4941,48 @@ std::pair<const char*, int> Type::GetEnumerationIndex(Enum t, const std::string&
}
std::pair<Type::Enum, unsigned> Type::GetInverseAttribute(Enum t, const std::string& a) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
while (true) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
for(;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
jt = it->second.find(a);
if (jt != it->second.end()) {
return jt->second;
}
}
if ((t = Parent(t)) == -1) break;
}
throw IfcException("Attribute not found");
}
std::set<std::string> Type::GetInverseAttributeNames(Enum t) {
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
if (inverse_map.empty()) ::InitInverseMap();
inverse_map_t::const_iterator it;
inverse_map_t::mapped_type::const_iterator jt;
std::set<std::string> return_value;
std::set<std::string> return_value;
while (true) {
for (;;) {
it = inverse_map.find(t);
if (it != inverse_map.end()) {
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
for (jt = it->second.begin(); jt != it->second.end(); ++jt) {
return_value.insert(jt->first);
}
}
if ((t = Parent(t)) == -1) break;
}
return return_value;
return return_value;
}
void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) {
std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type());
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
if (i != derived_map.end()) {
for (std::set<int>::const_iterator it = i->second.begin(); it != i->second.end(); ++it) {
e->setArgumentDerived(*it);
}
}
}
#endif
+2
View File
@@ -31,6 +31,8 @@
#include "../ifcparse/IfcWrite.h"
#include "../ifcparse/IfcWritableEntity.h"
#include <map>
using namespace Ifc4;
using namespace IfcParse;
using namespace IfcWrite;
+9 -1
View File
@@ -29,7 +29,6 @@
#include <string>
#include <vector>
#include <map>
#include <boost/optional.hpp>
@@ -37,6 +36,11 @@
#include "../ifcparse/IfcException.h"
#include "../ifcparse/Ifc4enum.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#define IfcSchema Ifc4
namespace Ifc4 {
@@ -55147,4 +55151,8 @@ void InitStringMap();
IfcUtil::IfcBaseClass* SchemaEntity(IfcAbstractEntity* e = 0);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
+6 -6
View File
@@ -130,12 +130,12 @@ IfcCharacterDecoder::operator std::string() {
#ifdef HAVE_ICU
unsigned int old_hex = 0; // for compatibility_mode
#endif
while ( current_char = file->Peek() ) {
while ( (current_char = file->Peek()) != 0 ) {
if ( EXPECTS_CHARACTER(parse_state) ) {
#ifdef HAVE_ICU
if ( previous_codepage != codepage ) {
if ( converter ) ucnv_close(converter);
char encoder[11] = {'i','s','o','-','8','8','5','9','-',codepage + 0x30};
char encoder[11] = {'i','s','o','-','8','8','5','9','-', (char)codepage + 0x30};
converter = ucnv_open(encoder, &status);
}
const char characters[2] = { current_char + 0x80 };
@@ -188,7 +188,7 @@ IfcCharacterDecoder::operator std::string() {
if (old_hex == 0) {
old_hex = hex;
} else {
char characters[3] = { old_hex, hex };
char characters[3] = { (char)old_hex, (char)hex };
const char* char_array = &characters[0];
UChar32 ch = ucnv_getNextUChar(compatibility_converter,&char_array,char_array+2,&status);
addChar(s,ch);
@@ -227,7 +227,7 @@ void IfcCharacterDecoder::dryRun() {
unsigned int parse_state = 0;
char current_char;
unsigned int hex_count = 0;
while ( current_char = file->Peek() ) {
while ((current_char = file->Peek()) != 0) {
if ( EXPECTS_CHARACTER(parse_state) ) {
parse_state = 0;
} else if ( current_char == '\'' && ! parse_state ) {
@@ -340,8 +340,8 @@ IfcCharacterEncoder::operator std::string() {
oss << "\\X" << num_bytes_str << "\\";
}
if ( within_spf_range ) {
oss.put(ch);
if ( ch == '\\' || ch == '\'' ) oss.put(ch);
oss.put((char)ch);
if ( ch == '\\' || ch == '\'' ) oss.put((char)ch);
} else {
oss << std::hex << std::setw(num_bytes*2) << std::uppercase << std::setfill('0') << (int) ch;
}
+2 -2
View File
@@ -48,7 +48,7 @@ namespace IfcUtil {
std::pair<const char*, int> getIndex(const std::string& value) const {
std::vector<std::string>::const_iterator it = std::find(values.begin(), values.end(), value);
if (it != values.end()) {
return std::make_pair(it->c_str(), std::distance(it, values.begin()));
return std::make_pair(it->c_str(), (int)std::distance(it, values.begin()));
} else {
throw IfcParse::IfcException("Invalid enumeration value");
}
@@ -91,7 +91,7 @@ namespace IfcUtil {
arguments.push_back(IfcArgumentDescriptor(name, optional, argument_type, data_type));
}
unsigned getArgumentCount() const {
return (parent ? parent->getArgumentCount() : 0) + arguments.size();
return (parent ? parent->getArgumentCount() : 0) + (unsigned)arguments.size();
}
const std::string& getArgumentName(unsigned i) const {
const unsigned a = argument_start();
+3 -3
View File
@@ -38,7 +38,7 @@ std::string base64(unsigned v, int l) {
r.push_back(chars[v%64]);
v /= 64;
}
while ( r.size() != l ) r.push_back('0');
while ( (int)r.size() != l ) r.push_back('0');
std::reverse(r.begin(),r.end());
return r;
}
@@ -52,7 +52,7 @@ unsigned from_base64(const std::string& s) {
r *= 64;
const char* c = strchr(chars,*i);
if ( !c ) throw IfcParse::IfcException("Failed to decode GlobalId");
r += (c-chars);
r += (unsigned)(c-chars);
}
return r;
}
@@ -70,7 +70,7 @@ std::string compress(unsigned char* v) {
// Expands the base64 representation into a UUID byte array
void expand(const std::string& s, std::vector<unsigned char>& v) {
v.push_back(from_base64(s.substr(0,2)));
v.push_back((unsigned char)from_base64(s.substr(0,2)));
for( unsigned i = 0; i < 5; ++i ) {
unsigned d = from_base64(s.substr(2+4*i,4));
for ( unsigned j = 0; j < 3; ++ j ) {
+5 -5
View File
@@ -290,7 +290,7 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
IfcSchema::IfcAxis2Placement2D* place, IfcSchema::IfcAxis2Placement3D* place2,
IfcSchema::IfcDirection* dir, IfcSchema::IfcRepresentationContext* context)
{
if (false) {
if (false) { // TODO What's this?
IfcSchema::IfcRectangleProfileDef* profile = new IfcSchema::IfcRectangleProfileDef(
IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA, boost::none, place ? place : addPlacement2d(), w, d);
IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
@@ -303,10 +303,10 @@ void IfcHierarchyHelper::addBox(IfcSchema::IfcShapeRepresentation* rep, double w
rep->setItems(items);
} else {
std::vector<std::pair<double, double> > points;
points.push_back(std::pair<double, double>(-w/2, -d/2));
points.push_back(std::pair<double, double>(w/2, -d/2));
points.push_back(std::pair<double, double>(w/2, d/2));
points.push_back(std::pair<double, double>(-w/2, d/2));
points.push_back(std::make_pair(-w/2, -d/2));
points.push_back(std::make_pair(w/2, -d/2));
points.push_back(std::make_pair(w/2, d/2));
points.push_back(std::make_pair(-w/2, d/2));
// The call to addExtrudedPolyline() closes the polyline
addExtrudedPolyline(rep, points, h, place, place2, dir, context);
}
+21 -21
View File
@@ -87,35 +87,35 @@ unsigned int IfcParse::IfcLateBoundEntity::getArgumentCount() const {
return IfcSchema::Type::GetAttributeCount(_type);
}
IfcUtil::ArgumentType IfcParse::IfcLateBoundEntity::getArgumentType(unsigned int i) const {
return IfcSchema::Type::GetAttributeDerived(_type, i)
return IfcSchema::Type::GetAttributeDerived(_type, (unsigned char)i)
? IfcUtil::Argument_DERIVED
: IfcSchema::Type::GetAttributeType(_type,i);
: IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
}
IfcSchema::Type::Enum IfcParse::IfcLateBoundEntity::getArgumentEntity(unsigned int i) const {
return IfcSchema::Type::GetAttributeEntity(_type, i);
return IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
}
Argument* IfcParse::IfcLateBoundEntity::getArgument(unsigned int i) const {
return entity->getArgument(i);
}
const char* IfcParse::IfcLateBoundEntity::getArgumentName(unsigned int i) const {
return IfcSchema::Type::GetAttributeName(_type,i).c_str();
return IfcSchema::Type::GetAttributeName(_type, (unsigned char)i).c_str();
}
bool IfcParse::IfcLateBoundEntity::getArgumentOptionality(unsigned int i) const {
return IfcSchema::Type::GetAttributeOptional(_type, i);
return IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
}
void IfcParse::IfcLateBoundEntity::invalid_argument(unsigned int i, const std::string& t) {
const std::string arg_name = IfcSchema::Type::GetAttributeName(_type,i);
const std::string arg_name = IfcSchema::Type::GetAttributeName(_type, (unsigned char)i);
throw IfcException(t + " is not a valid type for '" + arg_name + "'");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsNull(unsigned int i) {
bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, i);
bool is_optional = IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i);
if (is_optional) {
writable_entity()->setArgument(i);
} else invalid_argument(i,"NULL");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_INT) {
writable_entity()->setArgument(i,v);
} else if ( (arg_type == Argument_BOOL) && ( (v == 0) || (v == 1) ) ) {
@@ -123,23 +123,23 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsInt(unsigned int i, int v) {
} else invalid_argument(i,"INTEGER");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsBool(unsigned int i, bool v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_BOOL) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"BOOLEAN");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsDouble(unsigned int i, double v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_DOUBLE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"REAL");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std::string& a) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_STRING) {
writable_entity()->setArgument(i,a);
} else if (arg_type == Argument_ENUMERATION) {
std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, i), a);
std::pair<const char*, int> enum_data = IfcSchema::Type::GetEnumerationIndex(IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i), a);
writable_entity()->setArgument(i, enum_data.second, enum_data.first);
} else if (arg_type == Argument_BINARY) {
if (valid_binary_string(a)) {
@@ -151,19 +151,19 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsString(unsigned int i, const std
} else invalid_argument(i,"STRING");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfInt(unsigned int i, const std::vector<int>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_INT) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF INT");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfDouble(unsigned int i, const std::vector<double>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_DOUBLE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF DOUBLE");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i, const std::vector<std::string>& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_STRING) {
writable_entity()->setArgument(i,v);
} else if (arg_type == Argument_AGGREGATE_OF_BINARY) {
@@ -180,31 +180,31 @@ void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfString(unsigned int i
} else invalid_argument(i,"AGGREGATE OF STRING");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsEntityInstance(unsigned int i, IfcParse::IfcLateBoundEntity* v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"ENTITY INSTANCE");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfEntityInstance(unsigned int i, IfcEntityList::ptr v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF ENTITY INSTANCE");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfInt(unsigned int i, const std::vector< std::vector<int> >& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_INT) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF INT");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfDouble(unsigned int i, const std::vector< std::vector<double> >& v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_DOUBLE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF DOUBLE");
}
void IfcParse::IfcLateBoundEntity::setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, IfcEntityListList::ptr v) {
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type,i);
IfcUtil::ArgumentType arg_type = IfcSchema::Type::GetAttributeType(_type, (unsigned char)i);
if (arg_type == Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
writable_entity()->setArgument(i,v);
} else invalid_argument(i,"AGGREGATE OF AGGREGATE OF ENTITY INSTANCE");
@@ -230,7 +230,7 @@ bool IfcParse::IfcLateBoundEntity::is_valid() {
const Argument& arg = *getArgument(i);
is_null = arg.isNull();
} catch(IfcException) {}
if (!IfcSchema::Type::GetAttributeOptional(_type,i) && is_null) {
if (!IfcSchema::Type::GetAttributeOptional(_type, (unsigned char)i) && is_null) {
if (!valid) {
oss << ", ";
}
+27 -26
View File
@@ -143,6 +143,8 @@ void IfcSpfStream::ReadBuffer(bool inc) {
offset += len;
fseek(stream, offset, SEEK_SET);
}
#else
(void)inc;
#endif
eof = feof(stream) != 0;
if ( eof ) return;
@@ -308,7 +310,7 @@ Token IfcSpfLexer::Next() {
while ( ! stream->eof ) {
// Read character and increment pointer if not starting a new token
char c = stream->Peek();
c = stream->Peek();
if ( len && (c == '(' || c == ')' || c == '=' || c == ',' || c == ';' || c == '/') ) break;
stream->Inc();
len ++;
@@ -363,7 +365,7 @@ bool TokenFunc::startsWith(const Token& t, char c) {
}
bool TokenFunc::isOperator(const Token& t, char op) {
return (!t.first) && (!op || op == t.second);
return (!t.first) && (!op || (unsigned)op == t.second);
}
bool TokenFunc::isIdentifier(const Token& t) {
@@ -394,8 +396,8 @@ bool TokenFunc::isInt(const Token& t) {
const std::string str = asString(t);
const char* start = str.c_str();
char* end;
long result = strtol(start,&end,10);
return ((end - start) == str.length());
/*long result =*/ strtol(start,&end,10);
return ((end - start) == (ptrdiff_t)str.length());
}
bool TokenFunc::isBool(const Token& t) {
@@ -412,11 +414,11 @@ bool TokenFunc::isFloat(const Token& t) {
const char* start = str.c_str();
char* end;
#ifdef _MSC_VER
double result = _strtod_l(start,&end,locale);
/*double result =*/ _strtod_l(start,&end,locale);
#else
double result = strtod_l(start,&end,locale);
#endif
return ((end - start) == str.length());
return ((end - start) == (ptrdiff_t)str.length());
}
int TokenFunc::asInt(const Token& t) {
@@ -467,7 +469,7 @@ boost::dynamic_bitset<> TokenFunc::asBinary(const Token& t) {
}
++it;
unsigned i = (str.size()-1) * 4 - n;
unsigned i = ((unsigned)str.size()-1) * 4 - n;
boost::dynamic_bitset<> bitset(i);
for(; it != str.end(); ++it) {
@@ -508,8 +510,7 @@ EntityArgument::EntityArgument(const Token& t) {
// Aditionally, stores the ids (i.e. #[\d]+) in a vector
//
void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
IfcParse::IfcFile* file = t->file;
//IfcParse::IfcFile* file = t->file;
Token next = t->Next();
while( next.second || next.first ) {
if ( TokenFunc::isOperator(next,',') ) {
@@ -517,9 +518,9 @@ void ArgumentList::read(IfcSpfLexer* t, std::vector<unsigned int>& ids) {
} else if ( TokenFunc::isOperator(next,')') ) {
break;
} else if ( TokenFunc::isOperator(next,'(') ) {
ArgumentList* list = new ArgumentList();
list->read(t, ids);
push(list);
ArgumentList* alist = new ArgumentList();
alist->read(t, ids);
push(alist);
} else {
if ( TokenFunc::isIdentifier(next) ) {
ids.push_back(TokenFunc::asInt(next));
@@ -640,7 +641,7 @@ ArgumentList::operator IfcEntityListList::ptr() const {
for ( it = list.begin(); it != list.end(); ++ it ) {
const Argument* arg = *it;
const ArgumentList* arg_list;
if ((arg_list = dynamic_cast<const ArgumentList*>(arg))) {
if ((arg_list = dynamic_cast<const ArgumentList*>(arg)) != 0) {
IfcEntityList::ptr e = *arg_list;
l->push(e);
}
@@ -732,7 +733,7 @@ TokenArgument::operator std::vector< std::vector<int> >() const { throw IfcExcep
TokenArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
TokenArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
unsigned int TokenArgument::size() const { return 1; }
Argument* TokenArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of attributes"); }
Argument* TokenArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of attributes"); }
std::string TokenArgument::toString(bool upper) const {
if ( upper && TokenFunc::isString(token) ) {
return IfcWrite::IfcCharacterEncoder(TokenFunc::asString(token));
@@ -764,7 +765,7 @@ EntityArgument::operator std::vector< std::vector<int> >() const { throw IfcExce
EntityArgument::operator std::vector< std::vector<double> >() const { throw IfcException("Argument is not a list of list of floats"); }
EntityArgument::operator IfcEntityListList::ptr() const { throw IfcException("Argument is not a list of list of entity instances"); }
unsigned int EntityArgument::size() const { return 1; }
Argument* EntityArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of arguments"); }
Argument* EntityArgument::operator [] (unsigned int /*i*/) const { throw IfcException("Argument is not a list of arguments"); }
std::string EntityArgument::toString(bool upper) const {
return entity->entity->toString(upper);
}
@@ -1070,9 +1071,9 @@ void IfcFile::addEntities(IfcEntityList::ptr es) {
IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) {
// If this instance has been inserted before, return
// a reference to the copy that was created from it.
entity_entity_map_t::iterator it = entity_file_map.find(entity);
if (it != entity_file_map.end()) {
return it->second;
entity_entity_map_t::iterator mit = entity_file_map.find(entity);
if (mit != entity_file_map.end()) {
return mit->second;
}
// Obtain all forward references by a depth-first
@@ -1272,8 +1273,8 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) {
// moment, inversely related instances affected by the removal of the
// entity being deleted are not deleted themselves.
if (references) {
for (IfcEntityList::it it = references->begin(); it != references->end(); ++it) {
IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *it;
for (IfcEntityList::it iit = references->begin(); iit != references->end(); ++iit) {
IfcUtil::IfcBaseEntity* related_instance = (IfcUtil::IfcBaseEntity*) *iit;
for (unsigned i = 0; i < related_instance->getArgumentCount(); ++i) {
Argument* attr = related_instance->getArgument(i);
if (attr->isNull()) continue;
@@ -1495,21 +1496,21 @@ std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitE
if (named_unit->UnitType() != type) {
continue;
}
IfcSchema::IfcSIUnit* unit = 0;
IfcSchema::IfcSIUnit* siunit = 0;
if (named_unit->is(IfcSchema::Type::IfcConversionBasedUnit)) {
IfcSchema::IfcConversionBasedUnit* u = (IfcSchema::IfcConversionBasedUnit*)named_unit;
IfcSchema::IfcMeasureWithUnit* mu = u->ConversionFactor();
return_value.second *= static_cast<double>(*mu->ValueComponent()->entity->getArgument(0));
return_value.first = named_unit;
if (mu->UnitComponent()->is(IfcSchema::Type::IfcSIUnit)) {
unit = (IfcSchema::IfcSIUnit*) mu->UnitComponent();
siunit = (IfcSchema::IfcSIUnit*) mu->UnitComponent();
}
} else if (named_unit->is(IfcSchema::Type::IfcSIUnit)) {
return_value.first = unit = (IfcSchema::IfcSIUnit*) named_unit;
return_value.first = siunit = (IfcSchema::IfcSIUnit*) named_unit;
}
if (unit) {
if (unit->hasPrefix()) {
return_value.second *= IfcSIPrefixToValue(unit->Prefix());
if (siunit) {
if (siunit->hasPrefix()) {
return_value.second *= IfcSIPrefixToValue(siunit->Prefix());
}
}
}
+5 -2
View File
@@ -29,6 +29,9 @@ class HeaderEntity : public IfcAbstractEntity {
private:
ArgumentList* _list;
const char * const _datatype;
HeaderEntity(const HeaderEntity&); //N/A
HeaderEntity& operator =(const HeaderEntity&); //N/A
protected:
HeaderEntity(const char * const datatype, IfcSpfLexer* lexer)
: _datatype(datatype), _list(0)
@@ -65,7 +68,7 @@ public:
return (*_list)[i];
}
IfcEntityList::ptr getInverse(IfcSchema::Type::Enum type, int attribute_index) {
IfcEntityList::ptr getInverse(IfcSchema::Type::Enum /*type*/, int /*attribute_index*/) {
return IfcEntityList::ptr(new IfcEntityList);
}
@@ -81,7 +84,7 @@ public:
return (IfcSchema::Type::Enum) -1;
}
bool is(IfcSchema::Type::Enum v) const {
bool is(IfcSchema::Type::Enum /*v*/) const {
return false;
}
+4 -4
View File
@@ -107,7 +107,7 @@ namespace IfcUtil {
unsigned int getArgumentCount() const;
Argument* getArgument(unsigned int i) const;
const char* getArgumentName(unsigned int i) const;
IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const { return IfcSchema::Type::UNDEFINED; }
IfcSchema::Type::Enum getArgumentEntity(unsigned int /*i*/) const { return IfcSchema::Type::UNDEFINED; }
};
bool valid_binary_string(const std::string& s);
@@ -194,11 +194,11 @@ public:
}
outer_it begin() const { return ls.begin(); }
outer_it end() const { return ls.end(); }
int size() const { return ls.size(); }
int size() const { return (int)ls.size(); }
int totalSize() const {
int accum = 0;
for (outer_it it = begin(); it != end(); ++it) {
accum += it->size();
accum += (int)it->size();
}
return accum;
}
@@ -237,7 +237,7 @@ public:
void push(const std::vector<T*>& t) {ls.push_back(t);}
outer_it begin() { return ls.begin(); }
outer_it end() { return ls.end(); }
int size() const { return ls.size(); }
int size() const { return (int)ls.size(); }
int totalSize() const {
int accum = 0;
for (outer_it it = begin(); it != end(); ++it) {
+24 -23
View File
@@ -85,7 +85,7 @@ Argument* IfcWritableEntity::getArgument (unsigned int i) {
}
return args[i];
}
unsigned int IfcWritableEntity::getArgumentCount() const {return args.size(); }
unsigned int IfcWritableEntity::getArgumentCount() const { return (unsigned)args.size(); }
IfcSchema::Type::Enum IfcWritableEntity::type() const { return _type; }
bool IfcWritableEntity::is(IfcSchema::Type::Enum v) const { return _type == v; }
std::string IfcWritableEntity::toString(bool upper) const {
@@ -105,7 +105,6 @@ std::string IfcWritableEntity::toString(bool upper) const {
ss << dt << "(";
for (std::map<int,Argument*>::const_iterator it = args.begin(); it != args.end(); ++ it) {
if ( it != args.begin() ) ss << ",";
const Argument* a = it->second;
ss << it->second->toString(upper);
}
ss << ")";
@@ -141,7 +140,6 @@ void IfcWritableEntity::setArgument(int i) {
}
void IfcWritableEntity::setArgument(int i, Argument* a) {
IfcWrite::IfcWriteArgument* wa = new IfcWrite::IfcWriteArgument(this);
IfcUtil::ArgumentType attr_type = a->type();
switch(attr_type) {
case IfcUtil::Argument_NULL:
@@ -183,7 +181,7 @@ void IfcWritableEntity::setArgument(int i, Argument* a) {
this->setArgument(i, attr_value); }
break;
case IfcUtil::Argument_ENUMERATION: {
IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, i);
IfcSchema::Type::Enum ty = IfcSchema::Type::GetAttributeEntity(_type, (unsigned char)i);
std::string enum_literal = a->toString();
// Remove leading and trailing '.'
enum_literal = enum_literal.substr(1, enum_literal.size() - 2);
@@ -292,27 +290,30 @@ void IfcWritableEntity::setArgument(int i,const std::vector< boost::dynamic_bits
class SizeVisitor : public boost::static_visitor<int> {
public:
int operator()(const boost::none_t& i) const { return -1; }
int operator()(const IfcWriteArgument::Derived& i) const { return -1; }
int operator()(const int& i) const { return -1; }
int operator()(const bool& i) const { return -1; }
int operator()(const double& i) const { return -1; }
int operator()(const std::string& i) const { return -1; }
int operator()(const boost::dynamic_bitset<>& i) const { return -1; }
int operator()(const std::vector<int>& i) const { return i.size(); }
int operator()(const std::vector<double>& i) const { return i.size(); }
int operator()(const std::vector< std::vector<int> >& i) const { return i.size(); }
int operator()(const std::vector< std::vector<double> >& i) const { return i.size(); }
int operator()(const std::vector<std::string>& i) const { return i.size(); }
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return i.size(); }
int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; }
int operator()(const IfcUtil::IfcBaseClass* const& i) const { return -1; }
int operator()(const boost::none_t& /*i*/) const { return -1; }
int operator()(const IfcWriteArgument::Derived& /*i*/) const { return -1; }
int operator()(const int& /*i*/) const { return -1; }
int operator()(const bool& /*i*/) const { return -1; }
int operator()(const double& /*i*/) const { return -1; }
int operator()(const std::string& /*i*/) const { return -1; }
int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
int operator()(const std::vector<int>& i) const { return (int)i.size(); }
int operator()(const std::vector<double>& i) const { return (int)i.size(); }
int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); }
int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); }
int operator()(const std::vector<std::string>& i) const { return (int)i.size(); }
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); }
int operator()(const IfcWriteArgument::EnumerationReference& /*i*/) const { return -1; }
int operator()(const IfcUtil::IfcBaseClass* const& /*i*/) const { return -1; }
int operator()(const IfcEntityList::ptr& i) const { return i->size(); }
int operator()(const IfcEntityListList::ptr& i) const { return i->size(); }
};
class StringBuilderVisitor : public boost::static_visitor<void> {
private:
StringBuilderVisitor(const StringBuilderVisitor&); //N/A
StringBuilderVisitor& operator =(const StringBuilderVisitor&); //N/A
std::ostringstream& data;
template <typename T> void serialize(const std::vector<T>& i) {
data << "(";
@@ -352,7 +353,7 @@ private:
oss.imbue(std::locale::classic());
oss.put('"');
oss << std::hex << std::setw(1);
unsigned c = b.size();
unsigned c = (unsigned)b.size();
unsigned n = (4 - (c % 4)) & 3;
oss << n;
for (unsigned i = 0; i < c + n;) {
@@ -371,8 +372,8 @@ private:
public:
StringBuilderVisitor(std::ostringstream& stream, bool upper = false)
: data(stream), upper(upper) {}
void operator()(const boost::none_t& i) { data << "$"; }
void operator()(const IfcWriteArgument::Derived& i) { data << "*"; }
void operator()(const boost::none_t& /*i*/) { data << "$"; }
void operator()(const IfcWriteArgument::Derived& /*i*/) { data << "*"; }
void operator()(const int& i) { data << i; }
void operator()(const bool& i) { data << (i ? ".T." : ".F."); }
void operator()(const double& i) { data << format_double(i); }
@@ -502,7 +503,7 @@ IfcWriteArgument::operator std::vector< std::vector<int> >() const { return as<s
IfcWriteArgument::operator std::vector< std::vector<double> >() const { return as<std::vector< std::vector<double> > >(); }
IfcWriteArgument::operator IfcEntityListList::ptr() const { throw; }
bool IfcWriteArgument::isNull() const { return type() == IfcUtil::Argument_NULL; }
Argument* IfcWriteArgument::operator [] (unsigned int i) const { throw IfcParse::IfcException("Invalid cast"); }
Argument* IfcWriteArgument::operator [] (unsigned int /*i*/) const { throw IfcParse::IfcException("Invalid cast"); }
std::string IfcWriteArgument::toString(bool upper) const {
std::ostringstream str;
str.imbue(std::locale::classic());
+51 -14
View File
@@ -1,37 +1,74 @@
################################################################################
# #
# 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/>. #
# #
################################################################################
FIND_PACKAGE(SWIG)
IF(NOT SWIG_FOUND)
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find SWIG. Disable BUILD_IFCPYTHON or fix SWIG paths to proceed.")
ENDIF()
IF(SWIG_FOUND)
INCLUDE(${SWIG_USE_FILE})
INCLUDE(${SWIG_USE_FILE})
IF(NOT "$ENV{PYTHON_INCLUDE_DIR}" STREQUAL "")
SET(PYTHON_INCLUDE_DIR $ENV{PYTHON_INCLUDE_DIR} CACHE FILEPATH "Python header files")
MESSAGE(STATUS "Looking for Python header files in: ${PYTHON_INCLUDE_DIR}")
ENDIF()
IF(NOT "$ENV{PYTHON_LIBRARY}" STREQUAL "")
SET(PYTHON_LIBRARY $ENV{PYTHON_LIBRARY} CACHE FILEPATH "Python library file")
MESSAGE(STATUS "Looking for Python library file in: ${PYTHON_LIBRARY}")
ENDIF()
FIND_PACKAGE(PythonLibs)
IF(PYTHONLIBS_FOUND)
IF(NOT PYTHONLIBS_FOUND)
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
ENDIF()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
# NOTE Workaround for most likely missing debug Python libraries on Windows (requires Python built from the source).
# Python 3.5 intaller and onwards will have an option to install the debug libraries too.
IF (WIN32 AND NOT PYTHON_DEBUG_LIBRARIES)
MESSAGE(STATUS "PYTHON_DEBUG_LIBRARIES not found, defining SWIG_PYTHON_INTERPRETER_NO_DEBUG workaround for IfcWrap.")
ADD_DEFINITIONS(-DSWIG_PYTHON_INTERPRETER_NO_DEBUG)
ENDIF()
SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(ifcopenshell_wrapper python IfcPython.i)
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${PYTHON_LIBRARIES} IfcParse IfcGeom TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet TKOffset ${ICU_LIBRARIES})
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper IfcParse IfcGeom ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${ICU_LIBRARIES})
# To install IfcPython let's get the site-packages dir from python
EXECUTE_PROCESS(COMMAND python -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"
EXECUTE_PROCESS(COMMAND
python -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"
OUTPUT_VARIABLE python_package_dir)
IF("${python_package_dir}" STREQUAL "")
MESSAGE(FATAL_ERROR "Python executable not in PATH, aborting")
ENDIF()
INSTALL(FILES
"${CMAKE_BINARY_DIR}/ifcwrap/ifcopenshell_wrapper.py"
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/__init__.py"
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/guid.py"
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/__init__.py"
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/guid.py"
DESTINATION "${python_package_dir}/ifcopenshell")
INSTALL(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
DESTINATION "${python_package_dir}/ifcopenshell/geom")
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/geom/__init__.py"
DESTINATION "${python_package_dir}/ifcopenshell/geom")
INSTALL(TARGETS _ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
ENDIF(PYTHONLIBS_FOUND)
ENDIF(SWIG_FOUND)
+30
View File
@@ -17,6 +17,36 @@
* *
********************************************************************************/
%begin %{
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* https://github.com/swig/swig/issues/325 */
# include <basetsd.h>
# include <assert.h>
# include <ctype.h>
# include <errno.h>
# include <io.h>
# include <math.h>
# include <sal.h>
# include <stdarg.h>
# include <stddef.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/stat.h>
# include <time.h>
# include <wchar.h>
#endif
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4127 4244 4702 4510 4512 4610)
# if _MSC_VER > 1800
# pragma warning(disable : 4456 4459)
# endif
#endif
// TODO add '# pragma warning(pop)' to the very end of the file
%}
%include "std_string.i"
%include "exception.i"
+4 -4
View File
@@ -132,9 +132,9 @@
template <typename T>
PyObject* pythonize_vector(const std::vector<T>& v) {
const unsigned size = v.size();
const size_t size = v.size();
PyObject* pyobj = PyTuple_New(size);
for (unsigned int i = 0; i < size; ++i) {
for (size_t i = 0; i < size; ++i) {
PyTuple_SetItem(pyobj, i, pythonize(v[i]));
}
return pyobj;
@@ -142,9 +142,9 @@
template <typename T>
PyObject* pythonize_vector2(const std::vector< std::vector<T> >& v) {
const unsigned size = v.size();
const size_t size = v.size();
PyObject* pyobj = PyTuple_New(size);
for (unsigned int i = 0; i < size; ++i) {
for (size_t i = 0; i < size; ++i) {
PyTuple_SetItem(pyobj, i, pythonize_vector(v[i]));
}
return pyobj;
+19 -10
View File
@@ -1,9 +1,21 @@
OPTION( QT_USE_QTVIEWER "IfcOpenShell QT GUI Viewer, QT environment required" OFF )
IF (QT_USE_QTVIEWER)
################################################################################
# #
# 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/>. #
# #
################################################################################
# Find QT header files
SET(QT_MIN_VERSION "4.5.0")
@@ -40,7 +52,4 @@ QT_WRAP_CPP(QTviewer QTviewer_SRCS ${QTviewer_MOC_SRCS})
ADD_EXECUTABLE( QTviewer ${QTviewer_SRCS} ${QTviewer_MOC_SRCS})
#http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet)
ENDIF (QT_USE_QTVIEWER)
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
+437
View File
@@ -0,0 +1,437 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: 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 batch file expects CMake generator as %1 and build configuration type as %2. If not provided,
:: a deduced generator will be used for %1 and BUILD_CFG_DEFAULT for %2 (both set in vs-cfg.cmd)
:: Optionally a build type (Build/Rebuild/Clean) can be passed as %3.
@echo off
echo.
set PROJECT_NAME=IfcOpenShell
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
echo.
:: Enable the delayed environment variable expansion needed in vs-cfg.cmd.
setlocal EnableDelayedExpansion
:: Make sure vcvarsall.bat is called and dev env set is up.
IF "%VSINSTALLDIR%"=="" (
call utils\cecho.cmd 0 12 "Visual Studio environment variables not set - cannot proceed!"
GOTO :ErrorAndPrintUsage
)
:: Set up variables depending on the used Visual Studio version
call vs-cfg.cmd %1 %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" (
call utils\cecho.cmd 0 12 "Invalid build type passed: !BUILD_TYPE!. Cannot proceed, aborting!"
GOTO :Error
)
:: Make sure deps and install folders exists.
IF NOT EXIST %DEPS_DIR%. mkdir %DEPS_DIR%
IF NOT EXIST %INSTALL_DIR%. mkdir %INSTALL_DIR%
:: If we use VS2008, framework path (for MSBuild) may not be correctly set. Manually attempt to add in that case
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%
:: For subroutines
set MSBUILD_CMD=MSBuild.exe /nologo /m:%IFCOS_NUM_BUILD_PROCS% /t:%BUILD_TYPE%
REM /clp:ErrorsOnly;WarningsOnly
:: Note BUILD_TYPE not passed, Clean e.g. wouldn't delete the installed files.
set INSTALL_CMD=MSBuild.exe /nologo /m:%IFCOS_NUM_BUILD_PROCS%
echo.
:: Check that required tools are in PATH
FOR %%i IN (powershell git cmake) DO (
where.exe %%i 1> NUL 2> NUL || call cecho.cmd 0 12 "Required tool `'%%i`' not installed or not added to PATH" && goto :ErrorAndPrintUsage
)
:: Print build configuration information
call cecho.cmd 0 10 "Script configuration:"
call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR%`'`t
echo - Passed to CMake -G option.
call cecho.cmd 0 13 "* Target Architecture`t= %TARGET_ARCH%"
echo - Whether were doing 32-bit (x86) or 64-bit (x64) build.
call cecho.cmd 0 13 "* Dependency Directory`t= %DEPS_DIR%"
echo - The directory where %PROJECT_NAME% dependencies are fetched and built.
call cecho.cmd 0 13 "* Installation Directory = %INSTALL_DIR%"
echo - The directory where %PROJECT_NAME% dependencies are installed.
call cecho.cmd 0 13 "* Build Config Type`t= %BUILD_CFG%"
echo - The used build configuration type for the dependencies.
echo Defaults to RelWithDebInfo if not specified.
IF %BUILD_CFG%==MinSizeRel call cecho.cmd 0 14 " WARNING: MinSizeRel build can suffer from a significant performance loss."
call cecho.cmd 0 13 "* Build Type`t`t= %BUILD_TYPE%"
echo - The used build type for the dependencies (Build, Rebuild, Clean).
echo Defaults to Build if not specified. Rebuild/Clean also uninstalls Python (if it was installed by this script).
call cecho.cmd 0 13 "* IFCOS_INSTALL_PYTHON`t= %IFCOS_INSTALL_PYTHON%"
echo - Download and install Python.
echo Set to something other than TRUE if you wish to use an already installed version of Python.
call cecho.cmd 0 13 "* IFCOS_USE_PYTHON2`t= %IFCOS_USE_PYTHON2%"
echo - Use Python 2 instead of 3.
echo Set to TRUE if you wish to use Python 2 instead of 3. Has no effect if IFCOS_INSTALL_PYTHON is not TRUE.
call cecho.cmd 0 13 "* IFCOS_NUM_BUILD_PROCS`t= %IFCOS_NUM_BUILD_PROCS%"
echo - How many MSBuild.exe processes may be run in parallel.
echo Defaults to NUMBER_OF_PROCESSORS. Used also by other IfcOpenShell build scripts.
echo.
call :PrintUsage
call cecho.cmd 0 14 "Warning: You will need roughly 8 GB of disk space to proceed `(VS 2015 x64 RelWithDebInfo`)."
echo.
call cecho.cmd black cyan "If you are not ready with the above, press Ctrl-C to abort!"
pause
echo.
cd %DEPS_DIR%
:: Note all of the depedencies have approriate label so that user can easily skip something if wanted
:: by modifying this file and using goto.
:Boost
set BOOST_VERSION=1.59.0
:: DEPENDENCY_NAME is used for logging and DEPENDENCY_DIR for saving from some redundant typing
set DEPENDENCY_NAME=Boost %BOOST_VERSION%
set DEPENDENCY_DIR="%DEPS_DIR%\boost"
:: Version string with underscores instead of dots.
set BOOST_VER=%BOOST_VERSION:.=_%
set BOOST_ROOT=%DEPS_DIR%\boost
REM set BOOST_INCLUDEDIR=%DEPS_DIR%\boost
set BOOST_LIBRARYDIR=%DEPS_DIR%\boost\stage\%VS_PLATFORM%\lib
:: NOTE Also zip download exists, if encountering problems with 7z for some reason.
set ZIP_EXT=7z
set BOOST_ZIP=boost_%BOOST_VER%.%ZIP_EXT%
call :DownloadFile http://downloads.sourceforge.net/project/boost/boost/%BOOST_VERSION%/%BOOST_ZIP% "%DEPS_DIR%" %BOOST_ZIP%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :ExtractArchive %BOOST_ZIP% "%DEPS_DIR%" "%DEPS_DIR%\boost"
IF NOT %ERRORLEVEL%==0 GOTO :Error
:: Build Boost build script
IF EXIST "%DEPS_DIR%\boost_%BOOST_VER%". (
cd "%DEPS_DIR%"
ren boost_%BOOST_VER% boost
IF NOT EXIST "%DEPS_DIR%\boost\boost.css" GOTO :Error
cd "%DEPS_DIR%\boost"
call cecho.cmd 0 13 "Building Boost build script."
call bootstrap vc%VC_VER%
IF NOT %ERRORLEVEL%==0 GOTO :Error
)
set BOOST_LIBS=--with-system --with-regex --with-thread --with-program_options --with-date_time
:: NOTE Boost is fast to build with limited set of libraries so build it always.
cd "%DEPS_DIR%\boost"
call cecho.cmd 0 13 "Building %DEPENDENCY_NAME% %BOOST_LIBS% Please be patient, this will take a while."
IF EXIST "%DEPS_DIR%\boost\bin.v2\project-cache.jam" del "%DEPS_DIR%\boost\bin.v2\project-cache.jam"
call .\b2 toolset=msvc-%VC_VER%.0 runtime-link=static address-model=%ARCH_BITS% -j%IFCOS_NUM_BUILD_PROCS% ^
variant=%DEBUG_OR_RELEASE_LOWERCASE% %BOOST_LIBS% stage --stagedir=stage/vs%VS_VER%-%VS_PLATFORM%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:ICU
set DEPENDENCY_NAME=ICU
set DEPENDENCY_DIR=N/A
set ICU_ZIP=icu-55.1-vs%VS_VER%.7z
cd "%DEPS_DIR%"
call :DownloadFile http://www.npcglib.org/~stathis/downloads/%ICU_ZIP% "%DEPS_DIR%" %ICU_ZIP%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :ExtractArchive %ICU_ZIP% "%DEPS_DIR%" "%INSTALL_DIR%\icu"
IF NOT %ERRORLEVEL%==0 GOTO :Error
:: Rename lib and bin directories to predictable form
IF EXIST "%DEPS_DIR%\icu-55.1-vs%VS_VER%". (
pushd "%DEPS_DIR%\icu-55.1-vs%VS_VER%"
IF EXIST bin. ren bin bin%ARCH_BITS%"
IF EXIST lib. ren lib lib%ARCH_BITS%"
popd
)
IF EXIST "%DEPS_DIR%\icu-55.1-vs%VS_VER%\". (
robocopy "%DEPS_DIR%\icu-55.1-vs%VS_VER%\include" "%INSTALL_DIR%\icu\include" /E /IS /njh /njs
IF NOT EXIST "%INSTALL_DIR%\icu\lib". mkdir "%INSTALL_DIR%\icu\lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicutest%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutest%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicutu%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icutu%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuuc%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuuc%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicudt%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icudt%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuin%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuin%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicuio%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icuio%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\sicule%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\icule%POSTFIX_D%.lib"
copy /y "%DEPS_DIR%\icu-55.1-vs%VS_VER%\lib%ARCH_BITS%\siculx%POSTFIX_D%.lib" "%INSTALL_DIR%\icu\lib\iculx%POSTFIX_D%.lib"
)
:OpenCOLLADA
:: Note OpenCOLLADA has only Release and Debug builds.
set DEPENDENCY_NAME=OpenCOLLADA
set DEPENDENCY_DIR=%DEPS_DIR%\OpenCOLLADA
call :GitCloneOrPullRepository https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPENDENCY_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"
:: NOTE OpenCOLLADA has been observed to have problems with switching between debug and release builds so
:: uncomment to following line in order to delete the CMakeCache.txt always if experiencing problems.
REM IF EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt". del "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt"
:: NOTE Enforce that the embedded LibXml2 and PCRE are used as there might be problems with arbitrary versions of the libraries.
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\OpenCOLLADA" -DUSE_STATIC_MSVC_RUNTIME=1 -DCMAKE_DEBUG_POSTFIX=d ^
-DLIBXML2_LIBRARIES="" -DLIBXML2_INCLUDE_DIR="" -DPCRE_INCLUDE_DIR="" -DPCRE_LIBRARIES=""
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM TODO OpenCOLLADA takes a long time to build; build only if needed
REM IF NOT EXIST "%DEPS_DIR%\OpenCOLLADA\%BUILD_DIR%\lib\%DEBUG_OR_RELEASE%\OpenCOLLADASaxFrameworkLoader.lib".
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OPENCOLLADA.sln" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:oce-win-bundle
set DEPENDENCY_NAME=oce-win-bundle
set DEPENDENCY_DIR=%DEPS_DIR%\oce-win-bundle
:: TODO Temporarily use our own repo until the upstream is fixed
REM call :GitCloneOrPullRepository https://github.com/QbProg/oce-win-bundle.git "%DEPENDENCY_DIR%"
call :GitCloneOrPullRepository https://github.com/Tridify/oce-win-bundle.git "%DEPENDENCY_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF NOT EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%". (
cd "%DEPENDENCY_DIR%"
call git branch msvc-enhancements origin/msvc-enhancements
IF NOT %ERRORLEVEL%==0 GOTO :Error
call git checkout msvc-enhancements
IF NOT %ERRORLEVEL%==0 GOTO :Error
)
cd "%DEPENDENCY_DIR%"
call :RunCMake -DOCE_WIN_BUNDLE_INSTALL_DIR="%INSTALL_DIR%\oce-win-bundle" -DBUNDLE_USE_STATIC_MSVC_RUNTIME=1
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM IF NOT EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%\FreeImage.cmake\%BUILD_CFG%\FreeImage.dll"
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\oce-win-bundle.sln" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:OCE
set DEPENDENCY_NAME=Open CASCADE Community Edition
set DEPENDENCY_DIR=%DEPS_DIR%\oce
:: TODO Temporarily use our own repo until the upstream has static VC runtime option
REM call :GitCloneOrPullRepository https://github.com/tpaviot/oce.git "%DEPENDENCY_DIR%"
call :GitCloneOrPullRepository https://github.com/Tridify/oce.git "%DEPENDENCY_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF NOT EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%". (
cd "%DEPENDENCY_DIR%"
call git branch temp-vs-static-lib-build-fixes origin/temp-vs-static-lib-build-fixes
IF NOT %ERRORLEVEL%==0 GOTO :Error
call git checkout temp-vs-static-lib-build-fixes
IF NOT %ERRORLEVEL%==0 GOTO :Error
)
cd "%DEPENDENCY_DIR%"
set OCE_BUNDLE_ROOT_PATH="%INSTALL_DIR%\oce-win-bundle"
REM -DOCE_USE_BUNDLE_SOURCE=1 REM set OCE_BUNDLE_ROOT_PATH=%DEPS_DIR%\oce-win-bundle
:: NOTE Specify OCE_NO_LIBRARY_VERSION as rc.exe can fail due to long filenames and huge command-line parameter
:: input (more than 32,000 characters). Could maybe try using subst for the build dir to overcome this.
call :RunCMake -DOCE_BUILD_SHARED_LIB=0 -DOCE_USE_BUNDLE=1 -DOCE_BUNDLE_ROOT_PATH="%OCE_BUNDLE_ROOT_PATH%" ^
-DOCE_INSTALL_PREFIX="%INSTALL_DIR%\oce" -DOCE_TESTING=0 -DOCE_NO_LIBRARY_VERSION=1 ^
-DOCE_USE_STATIC_MSVC_RUNTIME=1
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM TODO OCE takes a long time to build; build only if needed
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCE.sln" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:Python
:: TODO Update to 3.5 when it's released as it will have an option to install debug libraries.
:: NOTE If updating the default Python version, change PY_VER_MAJOR_MINOR accordingly in run-cmake.bat
set PYTHON_VERSION=3.4.3
IF "%IFCOS_USE_PYTHON2%"=="TRUE" set PYTHON_VERSION=2.7.10
set PY_VER_MAJOR_MINOR=%PYTHON_VERSION:~0,3%
set PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR:.=%
set PYTHONPATH=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR%
set DEPENDENCY_NAME=Python %PYTHON_VERSION%
set DEPENDENCY_DIR=N/A
set PYTHON_AMD64_POSTFIX=.amd64
:: NOTE/TODO Beginning from 3.5.0: set PYTHON_AMD64_POSTFIX=-amd64
IF NOT %TARGET_ARCH%==x64 set PYTHON_AMD64_POSTFIX=
set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.msi
:: NOTE/TODO 3.5.0 doesn't use MSI any longer, but exe: set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
REM Store Python versions to BuildDepsCache.txt for run-cmake.bat
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
echo PYTHONPATH=%PYTHONPATH%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
cd "%DEPS_DIR%"
call :DownloadFile https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER% "%DEPS_DIR%" %PYTHON_INSTALLER%
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM Uninstall if build Rebuild/Clean used
IF NOT %BUILD_TYPE%==Build (
call cecho.cmd 0 13 "Uninstalling %DEPENDENCY_NAME%. Please be patient, this will take a while."
msiexec /x %PYTHON_INSTALLER% /qn
)
IF NOT EXIST "%PYTHONPATH%". (
call cecho.cmd 0 13 "Installing %DEPENDENCY_NAME%. Please be patient, this will take a while."
msiexec /qn /i %PYTHON_INSTALLER% TARGETDIR="%PYTHONPATH%"
) ELSE (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already installed. Skipping."
)
) ELSE (
call cecho.cmd 0 13 "IFCOS_INSTALL_PYTHON not true, skipping installation of Python."
)
:SWIG
set SWIG_VERSION=3.0.7
set DEPENDENCY_NAME=SWIG %SWIG_VERSION%
set DEPENDENCY_DIR=N/A
set SWIG_ZIP=swigwin-%SWIG_VERSION%.zip
cd "%DEPS_DIR%"
call :DownloadFile http://sourceforge.net/projects/swig/files/swigwin/swigwin-%SWIG_VERSION%/%SWIG_ZIP% "%DEPS_DIR%" %SWIG_ZIP%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :ExtractArchive %SWIG_ZIP% "%DEPS_DIR%" "%DEPS_DIR%\swigwin"
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF EXIST "%DEPS_DIR%\swigwin-%SWIG_VERSION%". (
pushd %DEPS%
ren swigwin-%SWIG_VERSION% swigwin
popd
)
IF EXIST "%DEPS_DIR%\swigwin\". robocopy "%DEPS_DIR%\swigwin" "%INSTALL_DIR%\swigwin" /E /IS /MOVE /njh /njs
:Successful
echo.
call %~dp0\utils\cecho.cmd 0 10 "%PROJECT_NAME% dependencies built."
goto :Finish
:ErrorAndPrintUsage
echo.
call :PrintUsage
:Error
echo.
call %~dp0\utils\cecho.cmd 0 12 "An error occurred! Aborting!"
goto :Finish
:Finish
set PATH=%ORIGINAL_PATH%
cd %~dp0
endlocal
goto :EOF
::::::::::::::::::::::::::::::::::::: Subroutines :::::::::::::::::::::::::::::::::::::
:: DownloadFile - Downloads a file using wget
:: Params: %1 url, %2 destinationDir, %3 filename
:DownloadFile
pushd %2
IF NOT EXIST "%3". (
call cecho.cmd 0 13 "Downloading %DEPENDENCY_NAME% into %2."
powershell -Command "$webClient = new-object System.Net.WebClient; $webClient.DownloadFile('%1', '%3')"
REM Old wget version in case someone has problem with PowerShell: wget --no-check-certificate %1
) ELSE (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already downloaded. Skipping."
)
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: ExtractArchive - Extracts an archive file using 7-zip
:: Params: %1 filename, %2 destinationDir, %3 dirAfterExtraction
:ExtractArchive
IF NOT EXIST "%3". (
call cecho.cmd 0 13 "Extracting %DEPENDENCY_NAME% into %2."
7za x %1 -y -o%2
) ELSE (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already extracted into %3. Skipping."
)
exit /b %ERRORLEVEL%
:: GitCloneOrPullRepository - Clones or pulls (if repository already cloned) a Git repository
:: Params: %1 gitUrl, %2 destDir
:: F.ex. call :GitCloneRepository https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPS_DIR%\OpenCOLLADA\"
:GitCloneOrPullRepository
IF NOT EXIST %2. (
call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %2."
pushd "%DEPS_DIR%"
call git clone %1 %2
) ELSE (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned. Pulling latest changes."
pushd %2
call git pull
)
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: RunCMake - Runs CMake for a CMake-based project
:: Params: %* cmakeOptions
:: NOTE cd to root CMakeLists.txt folder before calling this if the CMakeLists.txt is not in the repo root.
:RunCMake
call cecho.cmd 0 13 "Running CMake for %DEPENDENCY_NAME%."
IF NOT EXIST %BUILD_DIR%. mkdir %BUILD_DIR%
IF NOT %ERRORLEVEL%==0 GOTO :Error
pushd %BUILD_DIR%
:: TODO make deleting cache a parameter for this subroutine? We probably want to delete the
:: cache always e.g. when we've had new changes in the repository.
IF %BUILD_TYPE%==Rebuild IF EXIST CMakeCache.txt. del CMakeCache.txt
cmake .. -G %GENERATOR% %*
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: BuildSolution - Builds/Rebuilds/Cleans a solution using MSBuild
:: Params: %1 solutioName, %2 configuration
:BuildSolution
call cecho.cmd 0 13 "%BUILD_TYPE%ing %2 %DEPENDENCY_NAME%. Please be patient, this will take a while."
%MSBUILD_CMD% %1 /p:configuration=%2;platform=%VS_PLATFORM%
exit /b %ERRORLEVEL%
:: InstallCMakeProject - Builds the INSTALL project of CMake-based project
:: Params: %1 buildDir, %2 == configuration
:: NOTE the actual install dir is set during cmake run.
:InstallCMakeProject
pushd %1
call cecho.cmd 0 13 "Installing %2 %DEPENDENCY_NAME%. Please be patient, this will take a while."
%INSTALL_CMD% INSTALL.%VCPROJ_FILE_EXT% /p:configuration=%2;platform=%VS_PLATFORM%
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: PrintUsage - Prints usage information
:PrintUsage
call %~dp0\utils\cecho.cmd 0 10 "Requirements for a successful execution:"
echo 1. Install PowerShell (preinstalled in Windows ^>= 7) and make sure 'powershell' is accessible from PATH.
echo - https://support.microsoft.com/en-us/kb/968929
echo 2. Install Git and make sure 'git' is accessible from PATH.
echo - http://code.google.com/p/tortoisegit/
echo 3. Install CMake and make sure 'cmake' is accessible from PATH.
echo - http://www.cmake.org/
echo 4. Visual Studio 2008 or newer (2013 or newer recommended).
echo - https://www.visualstudio.com/
echo 5. Run this batch script with Visual Studio environment variables set.
echo - https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx
echo.
REM TODO 3ds Max SDK instructions?
+52
View File
@@ -0,0 +1,52 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: 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 batch file expects CMake generator as %1 and build configuration type as %2. If not provided,
:: a deduced generator will be used for %1 and BUILD_CFG_DEFAULT for %2 (both set in vs-cfg.cmd)
:: Possible extra parameters are passed for the MSBuild call.
@echo off
set PROJECT_NAME=IfcOpenShell
echo.
:: Enable the delayed environment variable expansion needed in VSConfig.cmd.
setlocal EnableDelayedExpansion
call vs-cfg.cmd %1 %2
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo.
IF "%IFCOS_NUM_BUILD_PROCS%"=="" set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCESSORS%
call cecho.cmd 0 13 "* IFCOS_NUM_BUILD_PROCS`t= %IFCOS_NUM_BUILD_PROCS%"
echo.
call cecho.cmd 0 13 "Building %VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME%"
MSBuild ..\%BUILD_DIR%\%PROJECT_NAME%.sln /nologo /m:%IFCOS_NUM_BUILD_PROCS% /p:Platform=%VS_PLATFORM% ^
/p:Configuration=%BUILD_CFG% %3 %4 %5 %6 %7 %8 %9
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo.
call cecho.cmd 0 10 "%VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME% build finished."
goto :End
:Error
echo.
call %~dp0\utils\cecho.cmd 0 12 "%VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME% build failed!"
:End
endlocal
+52
View File
@@ -0,0 +1,52 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: 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 batch file expects CMake generator as %1 and build configuration type as %2. If not provided,
:: a deduced generator will be used for %1 and BUILD_CFG_DEFAULT for %2 (both set in vs-cfg.cmd)
:: Possible extra parameters are passed for the MSBuild call.
@echo off
set PROJECT_NAME=IfcOpenShell
echo.
:: Enable the delayed environment variable expansion needed in VSConfig.cmd.
setlocal EnableDelayedExpansion
call vs-cfg.cmd %1 %2
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo.
IF "%IFCOS_NUM_BUILD_PROCS%"=="" set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCESSORS%
call cecho.cmd 0 13 "* IFCOS_NUM_BUILD_PROCS`t= %IFCOS_NUM_BUILD_PROCS%"
echo.
call cecho.cmd 0 13 "Installing %VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME%"
MSBuild ..\%BUILD_DIR%\INSTALL.%VCPROJ_FILE_EXT% /nologo /m:%IFCOS_NUM_BUILD_PROCS% /p:Platform=%VS_PLATFORM% ^
/p:Configuration=%BUILD_CFG% %3 %4 %5 %6 %7 %8 %9
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo.
call cecho.cmd 0 10 "%VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME% installation finished."
goto :End
:Error
echo.
call %~dp0\utils\cecho.cmd 0 12 "%VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME% installation failed!"
:End
endlocal
+61
View File
@@ -0,0 +1,61 @@
Windows Build Tools and Scripts
===============================
This folder contains build tools and script for automatic building and deployment of IfcOpenShell (IFCOS)
and its dependencies.
As a general guideline, `.cmd` files are non-standalone batch files that need to be run from command
prompt or from another batch file, and/or while the Visual Studio environment variables set, and `.bat` files are
standalone batch files that can be run also e.g. from the File Explorer.
Usage Instructions
------------------
Execute `build-deps.cmd` to fetch, build and install the dependencies. The batch file will print
the requirements for a successful execution. The script allows a few user-configurable build options
which are listed in the usage instructions. Either edit the script file or set these values before
running the script.
`build-deps.cmd` expects a CMake generator as `%1` and a build configuration type (`RelWithDebInfo/Release/MinSizeRel/Debug`,
defaults to `RelWithDebInfo`) as `%2`. If the generator is not provided, the generator is deduced from the Visual Studio
environment variables. A build type (`Build/Rebuild/Clean`, defaults to `Build`) can be provided as `%3`. See `vs-cfg.cmd`
if you wish to change the defaults. The batch file will create `deps\` and `deps-vs<VERSION>-<ARCHITECTURE>-installed\`
directories to the project root. Debug and release builds of the depedencies can co-exist by simply running
`build-deps.cmd <GENERATOR> Debug` and `build-deps.cmd <GENERATOR> <Release|RelWithDebInfo|MinSizeRel>`.
After the dependencies are build, execute `run-cmake.bat`. The batch file expects always a CMake generator as `%1`
(if not provided, the same default value as above is used), and the rest of possible parameters are passed as is.
**If you wish to use any library from a custom location, modify the paths in `run-cmake.bat` accordingly**. The batch
script will create a folder of form `build-vs<VERSION>-<ARCHITECTURE>\` which will contain the solution and project
files for Visual Studio.
Note that building IfcOpenShell as 64-bit is recommended as many of real life IFC files has been observed to take
easily more than 2 GBs of RAM while converting.
After this, one can build the project using the `IfcOpenShell.sln` file in the build folder. Build the `INSTALL` project
if wanted. Convenience batch files `build-ifcopenshell.cmd` and `install-ifcopenshell.cmd` can also be used. The batch files
expect `%1` and `%2` in same fashion as above and possible extra parameters are passed for the `MSBuild`call. The project will
be installed to `installed-vs<VERSION>-<ARCHITECTURE>\` folder in the project's root folder and the required IfcOpenShell-Python
parts are deployed to the `<PYTHONPATH>\Lib\site-packages\` folder.
**Note:** All of the dependencies are build as static libraries against the static run-time allowing the developer
to effortlessly deploy standalone IFCOS binaries.
Directory Structure
------------------
```
..
+---build-vs<VER>-<ARCH> - Created by run-cmake.bat, for a certain VS version and target architecture
+---deps - Created by build-deps.cmd, common for all VS versions and target architectures
+---deps-installed-vs<VER>-<ARCH> - Created by build-deps.cmd, for a certain VS version and target architecture
+---installed-vs<VER>-<ARCH> - Created by building the IFCOS's INSTALL project
\---win
| 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
| 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
| vs-cfg.cmd - Utility file used by the build scripts
+---sln - Contains the old Visual Studio solution and project files
\---utils - Contains various utilities for the build scripts
```
+112
View File
@@ -0,0 +1,112 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: 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/>. ::
:: ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
echo.
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
:: Read Python related variables from BuildDepsCache.txt
for /f "delims== tokens=1,2" %%G in (BuildDepsCache-%TARGET_ARCH%.txt) do set %%G=%%H
pushd ..
set CMAKE_INSTALL_PREFIX=%CD%\installed-vs%VS_VER%-%TARGET_ARCH%
popd
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
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%
set PYTHON_INCLUDE_DIR=%PYTHONPATH%\include
set PYTHON_LIBRARY=%PYTHONPATH%\libs\python%PY_VER_MAJOR_MINOR%.lib
set SWIG_DIR=%INSTALL_DIR%\swigwin
set PATH=%PATH%;%SWIG_DIR%;%PYTHONPATH%
:: TODO 3ds Max SDK?
echo.
call cecho.cmd 0 10 "Script configuration:"
echo CMake Generator = %GENERATOR%
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%
echo OCC_INCLUDE_DIR = %OCC_INCLUDE_DIR%
echo OCC_LIBRARY_DIR = %OCC_LIBRARY_DIR%
echo OPENCOLLADA_INCLUDE_DIR = %OPENCOLLADA_INCLUDE_DIR%
echo OPENCOLLADA_LIBRARY_DIR = %OPENCOLLADA_LIBRARY_DIR%
echo PYTHONPATH = %PYTHONPATH%
echo PYTHON_INCLUDE_DIR = %PYTHON_INCLUDE_DIR%
echo PYTHON_LIBRARY = %PYTHON_LIBRARY%
echo SWIG_DIR = %SWIG_DIR%
echo.
echo CMAKE_INSTALL_PREFIX = %CMAKE_INSTALL_PREFIX%
echo.
set CMAKELISTS_DIR=..\cmake
REM IF NOT EXIST %PROJECT_NAME%.sln. (
IF EXIST CMakeCache.txt. del /Q CMakeCache.txt
call cecho.cmd 0 13 "Running CMake for %PROJECT_NAME%."
IF "%2"=="" (
REM No extra arguments provided, trust that GENERATOR is set properly.
cmake.exe %CMAKELISTS_DIR% -G %GENERATOR% -DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%"
) ELSE (
REM Extra arguments has been provided. As CMake options are typically of format -DSOMETHING:BOOL=ON,
REM i.e. they contain an equal sign, they will mess up the batch file argument parsing if the arguments are passed on
REM by splitting them %2 %3 %4 %5 %6 %7 %8 %9. In the extra argument case trust that user has provided the generator
REM as the first argument as pass all arguments as is by using %*.
cmake.exe %CMAKELISTS_DIR% -G %*
)
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM ) ELSE (
REM call cecho.cmd 0 10 "%PROJECT_NAME%.sln exists. Skipping CMake call for %PROJECT_NAME%."
REM call cecho.cmd 0 10 "Delete %BUILD_DIR%\%PROJECT_NAME%.sln to trigger a CMake rerun."
REM )
echo.
goto :Finish
:Error
echo.
call %~dp0\utils\cecho.cmd 0 12 "An error occurred! Aborting!"
goto :Finish
:Finish
popd
set PATH=%ORIGINAL_PATH%
endlocal
@@ -17,8 +17,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\obj\debug"
OutputDirectory="..\..\build\debug"
IntermediateDirectory="..\..\temp\obj\debug"
ConfigurationType="1"
CharacterSet="2"
>
@@ -88,8 +88,8 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\obj\release"
OutputDirectory="..\..\build\release"
IntermediateDirectory="..\..\temp\obj\release"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
@@ -168,31 +168,31 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\ifcconvert\ColladaSerializer.cpp"
RelativePath="..\..\src\ifcconvert\ColladaSerializer.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\IfcConvert.cpp"
RelativePath="..\..\src\ifcconvert\IfcConvert.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\OpenCascadeBasedSerializer.cpp"
RelativePath="..\..\src\ifcconvert\OpenCascadeBasedSerializer.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\SvgSerializer.cpp"
RelativePath="..\..\src\ifcconvert\SvgSerializer.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\util.cpp"
RelativePath="..\..\src\ifcconvert\util.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\WavefrontObjSerializer.cpp"
RelativePath="..\..\src\ifcconvert\WavefrontObjSerializer.cpp"
>
</File>
<File
RelativePath="..\src\ifcconvert\XmlSerializer.cpp"
RelativePath="..\..\src\ifcconvert\XmlSerializer.cpp"
>
</File>
</Filter>
@@ -202,43 +202,43 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\ifcconvert\ColladaSerializer.h"
RelativePath="..\..\src\ifcconvert\ColladaSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\GeometrySerializer.h"
RelativePath="..\..\src\ifcconvert\GeometrySerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\IgesSerializer.h"
RelativePath="..\..\src\ifcconvert\IgesSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\OpenCascadeBasedSerializer.h"
RelativePath="..\..\src\ifcconvert\OpenCascadeBasedSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\StepSerializer.h"
RelativePath="..\..\src\ifcconvert\StepSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\Serializer.h"
RelativePath="..\..\src\ifcconvert\Serializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\SvgSerializer.h"
RelativePath="..\..\src\ifcconvert\SvgSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\util.h"
RelativePath="..\..\src\ifcconvert\util.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\WavefrontObjSerializer.h"
RelativePath="..\..\src\ifcconvert\WavefrontObjSerializer.h"
>
</File>
<File
RelativePath="..\src\ifcconvert\XmlSerializer.h"
RelativePath="..\..\src\ifcconvert\XmlSerializer.h"
>
</File>
</Filter>
+31 -31
View File
@@ -151,43 +151,43 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\ifcgeom\IfcGeomCurves.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomCurves.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomFaces.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomFaces.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomFunctions.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomFunctions.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomHelpers.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomHelpers.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomMaterial.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomMaterial.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomRenderStyles.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomRenderStyles.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomRepresentation.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomRepresentation.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomShapes.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomShapes.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomWires.cpp"
RelativePath="..\..\src\ifcgeom\IfcGeomWires.cpp"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegister.cpp"
RelativePath="..\..\src\ifcgeom\IfcRegister.cpp"
>
</File>
</Filter>
@@ -197,87 +197,87 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\ifcgeom\IfcGeom.h"
RelativePath="..\..\src\ifcgeom\IfcGeom.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomElement.h"
RelativePath="..\..\src\ifcgeom\IfcGeomElement.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomIterator.h"
RelativePath="..\..\src\ifcgeom\IfcGeomIterator.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomIteratorSettings.h"
RelativePath="..\..\src\ifcgeom\IfcGeomIteratorSettings.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomMaterial.h"
RelativePath="..\..\src\ifcgeom\IfcGeomMaterial.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomRenderStyles.h"
RelativePath="..\..\src\ifcgeom\IfcGeomRenderStyles.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomRepresentation.h"
RelativePath="..\..\src\ifcgeom\IfcGeomRepresentation.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcGeomShapeType.h"
RelativePath="..\..\src\ifcgeom\IfcGeomShapeType.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegister.h"
RelativePath="..\..\src\ifcgeom\IfcRegister.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterConvertCurve.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterConvertCurve.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterConvertFace.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterConvertFace.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterConvertShape.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterConvertShape.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterConvertShapes.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterConvertShapes.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterConvertWire.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterConvertWire.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterCreateCache.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterCreateCache.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterDef.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterDef.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterGeomHeader.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterGeomHeader.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterPurgeCache.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterPurgeCache.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterShapeType.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterShapeType.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRegisterUndef.h"
RelativePath="..\..\src\ifcgeom\IfcRegisterUndef.h"
>
</File>
<File
RelativePath="..\src\ifcgeom\IfcRepresentationShapeItem.h"
RelativePath="..\..\src\ifcgeom\IfcRepresentationShapeItem.h"
>
</File>
</Filter>
+10 -10
View File
@@ -17,8 +17,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\max\debug"
OutputDirectory="..\..\build\debug"
IntermediateDirectory="..\..\temp\max\debug"
ConfigurationType="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog.htm"
@@ -63,7 +63,7 @@
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib flt.lib geom.lib gfx.lib gup.lib helpsys.lib imageViewers.lib ManipSys.lib maxnet.lib Maxscrpt.lib maxutil.lib MenuMan.lib menus.lib mesh.lib MNMath.lib Paramblk2.lib particle.lib Poly.lib RenderUtil.lib SpringSys.lib tessint.lib viewfile.lib acap.lib TKerneld.lib TKMathd.lib TKBRepd.lib TKGeomBased.lib TKGeomAlgod.lib TKG3dd.lib TKG2dd.lib TKShHealingd.lib TKTopAlgod.lib TKMeshd.lib TKPrimd.lib TKBoold.lib TKBOd.lib TKFilletd.lib"
OutputFile="$(OutDir)\$(ProjectName).dli"
ModuleDefinitionFile="..\src\ifcmax\ifcmax.def"
ModuleDefinitionFile="..\..\src\ifcmax\ifcmax.def"
GenerateDebugInformation="true"
TargetMachine="1"
/>
@@ -91,8 +91,8 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\max\release"
OutputDirectory="..\..\build\release"
IntermediateDirectory="..\..\temp\max\release"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
@@ -138,7 +138,7 @@
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib flt.lib geom.lib gfx.lib gup.lib helpsys.lib imageViewers.lib ManipSys.lib maxnet.lib Maxscrpt.lib maxutil.lib MenuMan.lib menus.lib mesh.lib MNMath.lib Paramblk2.lib particle.lib Poly.lib RenderUtil.lib SpringSys.lib tessint.lib viewfile.lib acap.lib TKernel.lib TKMath.lib TKBRep.lib TKGeomBase.lib TKGeomAlgo.lib TKG3d.lib TKG2d.lib TKShHealing.lib TKTopAlgo.lib TKMesh.lib TKPrim.lib TKBool.lib TKBO.lib TKFillet.lib"
OutputFile="$(OutDir)\$(ProjectName).dli"
ModuleDefinitionFile="..\src\ifcmax\ifcmax.def"
ModuleDefinitionFile="..\..\src\ifcmax\ifcmax.def"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
@@ -176,7 +176,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\ifcmax\IfcMax.cpp"
RelativePath="..\..\src\ifcmax\IfcMax.cpp"
>
</File>
</Filter>
@@ -186,16 +186,16 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\ifcmax\IfcMax.h"
RelativePath="..\..\src\ifcmax\IfcMax.h"
>
</File>
<File
RelativePath="..\src\ifcmax\MaxMaterials.h"
RelativePath="..\..\src\ifcmax\MaxMaterials.h"
>
</File>
</Filter>
<File
RelativePath="..\src\ifcmax\IfcMax.def"
RelativePath="..\..\src\ifcmax\IfcMax.def"
>
</File>
</Files>
@@ -17,8 +17,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\house\debug"
OutputDirectory="..\..\build\debug"
IntermediateDirectory="..\..\temp\house\debug"
ConfigurationType="1"
CharacterSet="2"
>
@@ -88,8 +88,8 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\house\release"
OutputDirectory="..\..\build\release"
IntermediateDirectory="..\..\temp\house\release"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
@@ -168,7 +168,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\examples\IfcOpenHouse.cpp"
RelativePath="..\..\src\examples\IfcOpenHouse.cpp"
>
</File>
</Filter>
+38 -38
View File
@@ -17,8 +17,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\parse\debug"
OutputDirectory="..\..\build\debug"
IntermediateDirectory="..\..\temp\parse\debug"
ConfigurationType="4"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog.htm"
@@ -80,8 +80,8 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\parse\release"
OutputDirectory="..\..\build\release"
IntermediateDirectory="..\..\temp\parse\release"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
@@ -150,7 +150,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\ifcparse\Ifc2x3-latebound.cpp"
RelativePath="..\..\src\ifcparse\Ifc2x3-latebound.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -162,7 +162,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\src\ifcparse\Ifc2x3.cpp"
RelativePath="..\..\src\ifcparse\Ifc2x3.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -174,7 +174,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\src\ifcparse\Ifc4-latebound.cpp"
RelativePath="..\..\src\ifcparse\Ifc4-latebound.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -186,7 +186,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\src\ifcparse\Ifc4.cpp"
RelativePath="..\..\src\ifcparse\Ifc4.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -198,39 +198,39 @@
</FileConfiguration>
</File>
<File
RelativePath="..\src\ifcparse\IfcCharacterDecoder.cpp"
RelativePath="..\..\src\ifcparse\IfcCharacterDecoder.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcParse.cpp"
RelativePath="..\..\src\ifcparse\IfcParse.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcUtil.cpp"
RelativePath="..\..\src\ifcparse\IfcUtil.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcWrite.cpp"
RelativePath="..\..\src\ifcparse\IfcWrite.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcSIPrefix.cpp"
RelativePath="..\..\src\ifcparse\IfcSIPrefix.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcSpfHeader.cpp"
RelativePath="..\..\src\ifcparse\IfcSpfHeader.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcGlobalId.cpp"
RelativePath="..\..\src\ifcparse\IfcGlobalId.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcHierarchyHelper.cpp"
RelativePath="..\..\src\ifcparse\IfcHierarchyHelper.cpp"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcLateBoundEntity.cpp"
RelativePath="..\..\src\ifcparse\IfcLateBoundEntity.cpp"
>
</File>
</Filter>
@@ -240,87 +240,87 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\src\ifcparse\Ifc2x3-latebound.h"
RelativePath="..\..\src\ifcparse\Ifc2x3-latebound.h"
>
</File>
<File
RelativePath="..\src\ifcparse\Ifc2x3.h"
RelativePath="..\..\src\ifcparse\Ifc2x3.h"
>
</File>
<File
RelativePath="..\src\ifcparse\Ifc2x3enum.h"
RelativePath="..\..\src\ifcparse\Ifc2x3enum.h"
>
</File>
<File
RelativePath="..\src\ifcparse\Ifc4-latebound.h"
RelativePath="..\..\src\ifcparse\Ifc4-latebound.h"
>
</File>
<File
RelativePath="..\src\ifcparse\Ifc4.h"
RelativePath="..\..\src\ifcparse\Ifc4.h"
>
</File>
<File
RelativePath="..\src\ifcparse\Ifc4enum.h"
RelativePath="..\..\src\ifcparse\Ifc4enum.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcCharacterDecoder.h"
RelativePath="..\..\src\ifcparse\IfcCharacterDecoder.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcEntityDescriptor.h"
RelativePath="..\..\src\ifcparse\IfcEntityDescriptor.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcException.h"
RelativePath="..\..\src\ifcparse\IfcException.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcFile.h"
RelativePath="..\..\src\ifcparse\IfcFile.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcGlobalId.h"
RelativePath="..\..\src\ifcparse\IfcGlobalId.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcHierarchyHelper.h"
RelativePath="..\..\src\ifcparse\IfcHierarchyHelper.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcLateBoundEntity.h"
RelativePath="..\..\src\ifcparse\IfcLateBoundEntity.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcParse.h"
RelativePath="..\..\src\ifcparse\IfcParse.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcSIPrefix.h"
RelativePath="..\..\src\ifcparse\IfcSIPrefix.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcSpfHeader.h"
RelativePath="..\..\src\ifcparse\IfcSpfHeader.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcSpfStream.h"
RelativePath="..\..\src\ifcparse\IfcSpfStream.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcUtil.h"
RelativePath="..\..\src\ifcparse\IfcUtil.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcWritableEntity.h"
RelativePath="..\..\src\ifcparse\IfcWritableEntity.h"
>
</File>
<File
RelativePath="..\src\ifcparse\IfcWrite.h"
RelativePath="..\..\src\ifcparse\IfcWrite.h"
>
</File>
<File
RelativePath="..\src\ifcparse\SharedPointer.h"
RelativePath="..\..\src\ifcparse\SharedPointer.h"
>
</File>
</Filter>
@@ -18,8 +18,8 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\examples\debug"
OutputDirectory="..\..\build\debug"
IntermediateDirectory="..\..\temp\examples\debug"
ConfigurationType="1"
CharacterSet="1"
>
@@ -90,8 +90,8 @@
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\examples\release"
OutputDirectory="..\..\build\release"
IntermediateDirectory="..\..\temp\examples\release"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
@@ -173,7 +173,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\examples\IfcParseExamples.cpp"
RelativePath="..\..\src\examples\IfcParseExamples.cpp"
>
</File>
</Filter>
+12 -12
View File
@@ -14,12 +14,12 @@
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
<..\..s>
<..\..
Name="Debug|Win32"
OutputDirectory="..\build\debug"
IntermediateDirectory="..\temp\wrap\debug"
ConfigurationType="2"
..\..Type="2"
CharacterSet="2"
BuildLogFile="$(IntDir)\BuildLog.htm"
>
@@ -87,12 +87,12 @@
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
</..\..>
<..\..
Name="Release|Win32"
OutputDirectory="..\build\release"
IntermediateDirectory="..\temp\wrap\release"
ConfigurationType="2"
..\..Type="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
@@ -160,8 +160,8 @@
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
</..\..>
</..\..s>
<References>
</References>
<Files>
@@ -184,7 +184,7 @@
<File
RelativePath="..\src\ifcwrap\IfcPython.i"
>
<FileConfiguration
<File..\..
Name="Debug|Win32"
>
<Tool
@@ -192,8 +192,8 @@
CommandLine="swig -c++ -python $(InputPath)&#x0D;&#x0A;"
Outputs="$(InputDir)$(InputName)_wrap.cpp"
/>
</FileConfiguration>
<FileConfiguration
</File..\..>
<File..\..
Name="Release|Win32"
>
<Tool
@@ -201,7 +201,7 @@
CommandLine="swig -c++ -python $(InputPath)&#x0D;&#x0A;"
Outputs="$(InputDir)$(InputName)_wrap.cpp"
/>
</FileConfiguration>
</File..\..>
</File>
<File
RelativePath="..\src\ifcwrap\IfcGeomWrapper.i"
+16
View File
@@ -0,0 +1,16 @@
Original information from the README.md:
For Windows users a prebuilt Open CASCADE version is available from the
http://opencascade.org website. Download and install this version and
provide the paths to the Open CASCADE header and library files to MS
Visual Studio C++.
For building the Autodesk 3ds Max plugin, the 3ds Max SDK needs to be
installed as well as 3ds Max itself. Please provide the include and
library paths to Visual Studio.
For building the IfcPython wrapper, SWIG needs to be installed. Please
download the latest swigwin version from http://www.swig.org/download.html.
After extracting the .zip file, please add the extracted folder to the PATH
environment variable. Python needs to be installed, please provide the
include and library paths to Visual Studio.
BIN
View File
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
:: Usage: call cecho.cmd background foreground "message here"
:: NOTES/TODOS 1) This is super slow 2) leading spaces are omitted 3) printing string with quotes doesn't work (quotes must be escaped awkwardly)
@powershell -command write-host -background %~1 -foreground "%~2" "%3"
@exit /b
+29
View File
@@ -0,0 +1,29 @@
7-Zip Command line version
~~~~~~~~~~~~~~~~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-Zip Copyright (C) 1999-2010 Igor Pavlov.
7za.exe is distributed under the GNU LGPL license
Notes:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.
GNU LGPL information
--------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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 GNU
Lesser General Public License for more details.
You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
+182
View File
@@ -0,0 +1,182 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: 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 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.
:: 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
:: also with CMake 2 as the generator will be converted into the older format if necessary.
:: NOTE: The delayed environment variable expansion needs to be enabled before calling this.
@echo off
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"
:: Supported Visual Studio versions:
set GENERATORS[0]="Visual Studio 9 2008 Win64"
set GENERATORS[1]="Visual Studio 9 2008"
set GENERATORS[2]="Visual Studio 10 2010 Win64"
set GENERATORS[3]="Visual Studio 10 2010"
set GENERATORS[4]="Visual Studio 11 2012 Win64"
set GENERATORS[5]="Visual Studio 11 2012"
set GENERATORS[6]="Visual Studio 12 2013 Win64"
set GENERATORS[7]="Visual Studio 12 2013"
set GENERATORS[8]="Visual Studio 14 2015 Win64"
set GENERATORS[9]="Visual Studio 14 2015"
set LAST_GENERATOR_IDX=9
REM Deduce desired architecture from the location of cl.exe
where cl.exe | findstr /r /c:"amd64" >nul
set START=%ERRORLEVEL%
set STEP=2
IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" (
set VC_VER=%VisualStudioVersion:.0=%
FOR /l %%i in (%START%,%STEP%,%LAST_GENERATOR_IDX%) DO (
REM http://stackoverflow.com/a/8758579
REM NOTE add space before VC_VER so that e.g. "12" doesn't match with "2012"
echo(!GENERATORS[%%i]! | findstr /r /c:" !VC_VER!" >nul && (
set GENERATOR=!GENERATORS[%%i]!
call utils\cecho.cmd black cyan "Generator not passed, but VisualStudioVersion=%VisualStudioVersion% environment variable detected:"
call utils\cecho.cmd black cyan "using '`"!GENERATOR!`'" as the generator."
GOTO :GeneratorValid
)
)
)
FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
IF !GENERATOR!==!GENERATORS[%%i]! GOTO :GeneratorValid
)
call utils\cecho.cmd 0 12 "%~nx0: Invalid or unsupported CMake generator string passed: '`"!GENERATOR!`'". Cannot proceed, aborting!"
echo Supported CMake generator strings:
FOR /l %%i in (0,1,%LAST_GENERATOR_IDX%) DO (
echo !GENERATORS[%%i]!
)
exit /b 1
:GeneratorValid
:: Figure out the build configuration from the CMake generator string.
:: Are we building 32-bit or 64-bit version.
set ARCH_BITS=32
set TARGET_ARCH=x86
:: Visual Studio platform name, Win32 (i.e. x86) or x64.
set VS_PLATFORM=Win32
:: Find out VS version, VC versions and are we doing 64-bit or not.
:: VS_VER and VC_VER are convenience variables used f.ex. for filenames.
set GENERATOR_NO_DOUBLEQUOTES=%GENERATOR:"=%
set GENERATOR_SPLIT=%GENERATOR_NO_DOUBLEQUOTES: =,%
FOR %%i IN (%GENERATOR_SPLIT%) DO (
call :StrLength LEN %%i
IF !LEN!==1 set VC_VER=%%i
IF !LEN!==2 set VC_VER=%%i
IF !LEN!==4 set VS_VER=%%i
REM Are going to perform a 64-bit build?
IF %%i==Win64 (
set ARCH_BITS=64
set TARGET_ARCH=x64
set VS_PLATFORM=x64
)
)
:: Check CMake version and convert possible new format (>= 3.0) generator names to the old versions if using older CMake for VS <= 2013,
:: see http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
FOR /f "delims=" %%i in ('where cmake') DO set CMAKE_PATH=%%i
IF NOT "%CMAKE_PATH%"=="" (
FOR /f "delims=" %%i in ('cmake --version ^| findstr /C:"cmake version 3"') DO GOTO :CMake3AndNewer
)
:: CMake older than 3.0.0: convert new format generators to the old format (simple brute force for simplicity)
set GENERATOR=%GENERATOR: 2013=%
set GENERATOR=%GENERATOR: 2012=%
set GENERATOR=%GENERATOR: 2010=%
:CMake3AndNewer
:: VS project file extension is different on older VS versions
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, aborting!"
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%;%~dp0\utils
:: Fetch and build the dependencies to a dedicated directory depending on the used VS version and target architecture.
:: NOTE For IfcOpenShell we can build all of our deps both x86 and x64 using different VS versions in the same directories
:: so no need for -%VS_VER%-%TARGET_ARCH% postfix.
:: set DEPS_DIR=%CD%\deps-%VS_VER%-%TARGET_ARCH%
pushd ..
set DEPS_DIR=%CD%\deps
set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-installed
REM set INSTALL_DIR=%CD%\deps-vs%VS_VER%-%TARGET_ARCH%-%DEBUG_OR_RELEASE_LOWERCASE%-installed
:: BUILD_DIR is a relative build directory used for CMake-based projects
set BUILD_DIR=build-vs%VS_VER%-%TARGET_ARCH%
popd
GOTO :EOF
:: http://geekswithblogs.net/SoftwareDoneRight/archive/2010/01/30/useful-dos-batch-functions-substring-and-length.aspx
:StrLength
set #=%2%
set length=0
:stringLengthLoop
if defined # (set #=%#:~1%&set /A length += 1&goto stringLengthLoop)
::echo the string is %length% characters long!
set "%~1=%length%"
GOTO :EOF