diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fc8c33d352..7eefdbdf8a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -11,7 +11,7 @@ ELSE() MESSAGE(STATUS "Looking for opencascade include files in: ${OCC_INCLUDE_DIR}") ENDIF() -FIND_FILE(gp_Pnt_hxx "gp_Pnt.hxx" ${OCC_INCLUDE_DIR} /usr/inc /usr/local/inc) +FIND_FILE(gp_Pnt_hxx "gp_Pnt.hxx" ${OCC_INCLUDE_DIR} /usr/inc /usr/local/inc /usr/local/include/oce) IF(gp_Pnt_hxx) MESSAGE(STATUS "Header files found") ELSE() @@ -41,7 +41,7 @@ FIND_LIBRARY(icu "icuuc" /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64) IF(icu) MESSAGE(STATUS "ICU libraries found") ELSE() - MESSAGE(STATUS "Unable to find ICU library files, aborting") + MESSAGE(STATUS "Unable to find ICU library files, continuing") ADD_DEFINITIONS(-DHAVE_ICU) ENDIF() @@ -72,7 +72,7 @@ IF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE) ADD_DEFINITIONS(-fPIC -Wno-non-virtual-dtor) -INCLUDE_DIRECTORIES(${OCC_INCLUDE_DIR} /usr/inc /usr/local/inc) +INCLUDE_DIRECTORIES(${OCC_INCLUDE_DIR} /usr/inc /usr/local/inc /usr/local/include/oce) ADD_LIBRARY(IfcParse STATIC ../src/ifcparse/Ifc2x3.cpp ../src/ifcparse/IfcUtil.cpp @@ -91,7 +91,10 @@ ADD_LIBRARY(IfcGeom STATIC ../src/ifcgeom/IfcRegister.cpp ) -TARGET_LINK_LIBRARIES(IfcParse icuuc) +IF(icu) + TARGET_LINK_LIBRARIES(IfcParse icuuc) +ENDIF() + TARGET_LINK_LIBRARIES(IfcGeom IfcParse) LINK_DIRECTORIES (${IfcOpenShell_BINARY_DIR} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64) @@ -103,3 +106,36 @@ ADD_SUBDIRECTORY(../src/ifcwrap ifcwrap) # Build IfcParseExamples using separate CMakeLists.txt ADD_SUBDIRECTORY(../src/examples examples) + +# CMake installation targets +SET(include_files_geom + ../src/ifcgeom/IfcGeom.h + ../src/ifcgeom/IfcGeomObjects.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/IfcRegisterIsShapeCollection.h + ../src/ifcgeom/IfcRegisterPurgeCache.h + ../src/ifcgeom/IfcRegisterUndef.h + ../src/ifcgeom/IfcShapeList.h +) +SET(include_files_parse + ../src/ifcparse/Ifc2x3.h + ../src/ifcparse/Ifc2x3enum.h + ../src/ifcparse/IfcCharacterDecoder.h + ../src/ifcparse/IfcException.h + ../src/ifcparse/IfcFile.h + ../src/ifcparse/IfcParse.h + ../src/ifcparse/IfcUtil.h + ../src/ifcparse/SharedPointer.h +) +INSTALL(FILES ${include_files_geom} DESTINATION include/ifcgeom) +INSTALL(FILES ${include_files_parse} DESTINATION include/ifcparse) +INSTALL(TARGETS IfcObj DESTINATION bin) +INSTALL(TARGETS IfcParse IfcGeom DESTINATION lib) diff --git a/src/ifcwrap/CMakeLists.txt b/src/ifcwrap/CMakeLists.txt index bc63b957e4..b52c560fb3 100644 --- a/src/ifcwrap/CMakeLists.txt +++ b/src/ifcwrap/CMakeLists.txt @@ -1,7 +1,13 @@ -FIND_PACKAGE(SWIG REQUIRED) +FIND_PACKAGE(SWIG) + +IF(SWIG_FOUND) + INCLUDE(${SWIG_USE_FILE}) -FIND_PACKAGE(PythonLibs REQUIRED) +FIND_PACKAGE(PythonLibs) + +IF(PYTHONLIBS_FOUND) + INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) @@ -11,3 +17,20 @@ SET(CMAKE_SWIG_FLAGS "") SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(IfcImport python IfcPython.i) SWIG_LINK_LIBRARIES(IfcImport ${PYTHON_LIBRARIES} IfcParse IfcGeom TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO TKFillet) + +# To install IfcPython let's get the site-packackes dir from python +EXECUTE_PROCESS(COMMAND python -c "from distutils.sysconfig import get_python_lib as x; print (x())" + OUTPUT_VARIABLE python_package_dir) + +# Strip trailing whitespace from python print +STRING(REPLACE "\r" "" python_package_dir "${python_package_dir}") +STRING(REPLACE "\n" "" python_package_dir "${python_package_dir}") + +INSTALL(FILES + "${CMAKE_BINARY_DIR}/ifcwrap/IfcImport.py" + "${CMAKE_BINARY_DIR}/ifcwrap/_IfcImport.so" + DESTINATION "${python_package_dir}") + +ENDIF(PYTHONLIBS_FOUND) + +ENDIF(SWIG_FOUND) \ No newline at end of file