mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Update win build script and cmake for HDF5 library
This commit is contained in:
+27
-3
@@ -23,6 +23,7 @@ project (IfcOpenShell)
|
||||
|
||||
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
|
||||
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
|
||||
OPTION(HDF5_SUPPORT "Enable HDF5 support (requires HDF5, zlib)" 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)
|
||||
@@ -46,6 +47,8 @@ UNIFY_ENVVARS_AND_CACHE(ICU_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(ICU_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(OPENCOLLADA_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(HDF5_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(PCRE_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(PYTHON_EXECUTABLE)
|
||||
|
||||
@@ -187,6 +190,27 @@ IF(COLLADA_SUPPORT)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
if(HDF5_SUPPORT)
|
||||
IF("${HDF5_INCLUDE_DIR}" STREQUAL "")
|
||||
MESSAGE(STATUS "No HDF5 include directory specified")
|
||||
ElSE()
|
||||
SET(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR}" CACHE FILEPATH "HDF5 header files")
|
||||
ENDIF()
|
||||
|
||||
IF("${HDF5_LIBRARY_DIR}" STREQUAL "")
|
||||
MESSAGE(STATUS "No HDF5 library directory specified")
|
||||
ElSE()
|
||||
SET(HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR}" CACHE FILEPATH "HDF5 library files")
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
# An additional lib- prefix is added by HDF5 to denote static libraries
|
||||
SET(HDF5_LIBRARIES libhdf5_cpp libhdf5 libzlib)
|
||||
ELSE()
|
||||
SET(HDF5_LIBRARIES hdf5_cpp hdf5 zlib)
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
# TODO Are these needed on other platforms still or can these be removed for good?
|
||||
IF (NOT WIN32)
|
||||
INCLUDE(CheckIncludeFileCXX)
|
||||
@@ -269,7 +293,7 @@ ElSE()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
||||
${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}
|
||||
${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} /usr/inc /usr/local/inc /usr/local/include/oce)
|
||||
@@ -382,7 +406,7 @@ ADD_LIBRARY(IfcGeom STATIC ${IFCGEOM_FILES})
|
||||
TARGET_LINK_LIBRARIES(IfcGeom IfcParse)
|
||||
|
||||
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR}
|
||||
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS}
|
||||
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} ${HDF5_LIBRARY_DIR}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
LINK_DIRECTORIES(${LINK_DIRECTORIES} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
|
||||
@@ -401,7 +425,7 @@ if("${libTKernelExt}" STREQUAL ".a")
|
||||
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} rt dl)
|
||||
endif()
|
||||
|
||||
TARGET_LINK_LIBRARIES(IfcConvert IfcParse IfcGeom ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(IfcConvert IfcParse IfcGeom ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES} ${HDF5_LIBRARIES})
|
||||
|
||||
# IfcGeomServer
|
||||
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "../ifcparse/IfcHdf5File.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <H5pubconf.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "IfcHdf5File.h"
|
||||
|
||||
#include "H5pubconf.h"
|
||||
|
||||
#ifndef H5_HAVE_FILTER_DEFLATE
|
||||
#pragma message("warning: HDF5 compression support is recommended")
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#define SORT_ON_NAME
|
||||
|
||||
#include "H5Cpp.h"
|
||||
#include <H5Cpp.h>
|
||||
|
||||
#include "../ifcparse/Hdf5Settings.h"
|
||||
#include "../ifcparse/IfcUtil.h"
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace IfcParse {
|
||||
virtual const simple_type* as_simple_type() const { return static_cast<simple_type*>(0); }
|
||||
virtual const aggregation_type* as_aggregation_type() const { return static_cast<aggregation_type*>(0); }
|
||||
|
||||
virtual bool is(const std::string& name) const { return false; }
|
||||
virtual bool is(IfcSchema::Type::Enum name) const { return false; }
|
||||
virtual bool is(const std::string& /*name*/) const { return false; }
|
||||
virtual bool is(IfcSchema::Type::Enum /*name*/) const { return false; }
|
||||
};
|
||||
|
||||
class named_type : public parameter_type {
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
const std::vector<IfcUtil::IfcBaseClass*>& from = *outer;
|
||||
typename std::vector<U*> to;
|
||||
for (inner_it inner = from.begin(); inner != from.end(); ++ inner) {
|
||||
if (all || (*inner)->is(U::Class())) to.push_back((U*)*inner);
|
||||
if (all || (*inner)->declaration().is(U::Class())) to.push_back((U*)*inner);
|
||||
}
|
||||
r->push(to);
|
||||
}
|
||||
|
||||
+30
-1
@@ -131,6 +131,35 @@ 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.
|
||||
:HDF5
|
||||
set HDF5_VERSION=1.8.19
|
||||
set HDF5_VERSION_MAJOR=1.8
|
||||
set HDF5_CMAKE_ZIP=CMake-hdf5-%HDF5_VERSION%.zip
|
||||
set HDF5_INSTALL_ZIP_NAME=HDF5-%HDF5_VERSION%-win%ARCH_BITS%
|
||||
if "%ARCH_BITS%"==64. set ARCH_BITS_64=64
|
||||
|
||||
call :DownloadFile http://support.hdfgroup.org/ftp/HDF5/releases/hdf5-%HDF5_VERSION_MAJOR%/hdf5-%HDF5_VERSION%/src/CMake-hdf5-%HDF5_VERSION%.zip "%DEPS_DIR%" %HDF5_CMAKE_ZIP%
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
call :ExtractArchive %HDF5_CMAKE_ZIP% "%DEPS_DIR%" "%DEPS_DIR%\CMake-hdf5-%HDF5_VERSION%"
|
||||
IF NOT %ERRORLEVEL%==0 GOTO :Error
|
||||
pushd "%DEPS_DIR%\CMake-hdf5-%HDF5_VERSION%"
|
||||
copy /y "%~dp0patches\HDF5config.cmake" HDF5config.cmake
|
||||
copy /y "%~dp0patches\hdf5-src-CMakeLists.txt" hdf5-%HDF5_VERSION%\CMakeLists.txt
|
||||
REM This will build ZLIB initially linking against dynamic runtime
|
||||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS%VS_VER%%ARCH_BITS_64% -C %BUILD_CFG% -V -O hdf5.log
|
||||
call :ExtractArchive %HDF5_INSTALL_ZIP_NAME%.zip "%INSTALL_DIR%" "%INSTALL_DIR%\%HDF5_INSTALL_ZIP_NAME%"
|
||||
pushd build\ZLIB-prefix\src\ZLIB
|
||||
copy /y "%~dp0patches\hdf5-zlib-CMakeLists.txt" CMakeLists.txt
|
||||
pushd ..\ZLIB-build
|
||||
cmake ..\ZLIB "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%\%HDF5_INSTALL_ZIP_NAME%"
|
||||
cmake --build . --config %BUILD_CFG% --target INSTALL
|
||||
popd
|
||||
popd
|
||||
echo HDF5_VERSION=%HDF5_VERSION%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
popd
|
||||
|
||||
goto :Finish
|
||||
|
||||
:Boost
|
||||
set BOOST_VERSION=1.59.0
|
||||
:: DEPENDENCY_NAME is used for logging and DEPENDENCY_DIR for saving from some redundant typing
|
||||
@@ -264,7 +293,7 @@ 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 PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
echo PYTHONHOME=%PYTHONHOME%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt"
|
||||
|
||||
cd "%DEPS_DIR%"
|
||||
|
||||
@@ -52,6 +52,8 @@ set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce
|
||||
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib
|
||||
set OPENCOLLADA_INCLUDE_DIR=%INSTALL_DIR%\OpenCOLLADA\include\opencollada
|
||||
set OPENCOLLADA_LIBRARY_DIR=%INSTALL_DIR%\OpenCOLLADA\lib\opencollada
|
||||
set HDF5_INCLUDE_DIR=%INSTALL_DIR%\HDF5-%HDF5_VERSION%-win%ARCH_BITS%\include
|
||||
set HDF5_LIBRARY_DIR=%INSTALL_DIR%\HDF5-%HDF5_VERSION%-win%ARCH_BITS%\lib
|
||||
if not defined PY_VER_MAJOR_MINOR set PY_VER_MAJOR_MINOR=34
|
||||
if not defined PYTHONHOME set PYTHONHOME=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR%
|
||||
set PYTHON_INCLUDE_DIR=%PYTHONHOME%\include
|
||||
@@ -75,6 +77,8 @@ 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 HDF5_INCLUDE_DIR = %HDF5_INCLUDE_DIR%
|
||||
echo HDF5_LIBRARY_DIR = %HDF5_LIBRARY_DIR%
|
||||
echo PYTHONHOME = %PYTHONHOME%
|
||||
echo PYTHON_INCLUDE_DIR = %PYTHON_INCLUDE_DIR%
|
||||
echo PYTHON_LIBRARY = %PYTHON_LIBRARY%
|
||||
|
||||
Reference in New Issue
Block a user