Skip to content

Commit b3167cf

Browse files
committed
build script simplification
1 parent 44f785c commit b3167cf

2 files changed

Lines changed: 25 additions & 39 deletions

File tree

cmake/CMakeLists.txt

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ IF(NOT IS_ABSOLUTE ${LIBDIR})
6060
ENDIF()
6161
MESSAGE(STATUS "LIBDIR: ${LIBDIR}")
6262

63-
set(IFCDIRS "") # for *nix rpaths
63+
set(IFCOPENSHELL_LIBARY_DIR "") # for *nix rpaths
6464

6565
if (BUILD_SHARED_LIBS)
6666
add_definitions(-DBUILD_SHARED_LIBS)
@@ -70,7 +70,7 @@ if (BUILD_SHARED_LIBS)
7070
# There will be couple hundreds of these so suppress them away, https://msdn.microsoft.com/en-us/library/esew7y1w.aspx
7171
add_definitions(-wd4251)
7272
endif()
73-
set(IFCDIRS "${LIBDIR}")
73+
set(IFCOPENSHELL_LIBARY_DIR "${LIBDIR}")
7474
endif()
7575

7676
# Create cache entries if absent for environment variables
@@ -432,8 +432,7 @@ if(NOT WIN32)
432432
LINK_DIRECTORIES(${LINK_DIRECTORIES} /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64)
433433
endif()
434434

435-
SET(IFCLIBS "")
436-
SET(IFCBINS "")
435+
SET(IFCOPENSHELL_LIBRARIES IfcParse IfcGeom)
437436

438437
# IfcParse
439438
file(GLOB IFCPARSE_H_FILES ../src/ifcparse/*.h)
@@ -449,16 +448,7 @@ endforeach()
449448

450449
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
451450

452-
if (BUILD_SHARED_LIBS)
453-
add_library(IfcParse SHARED ${IFCPARSE_FILES})
454-
set(IFCBINS "${IFCBINS};IfcParse")
455-
if (MSVC)
456-
set(IFCLIBS "${IFCLIBS};IfcParse") # import lib for the DLL
457-
endif()
458-
else()
459-
add_library(IfcParse STATIC ${IFCPARSE_FILES})
460-
set(IFCLIBS "${IFCLIBS};IfcParse")
461-
endif()
451+
add_library(IfcParse ${IFCPARSE_FILES})
462452
set_target_properties(IfcParse PROPERTIES COMPILE_FLAGS -DIfcParse_EXPORTS)
463453

464454
IF(UNICODE_SUPPORT)
@@ -470,17 +460,10 @@ file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/*.h)
470460
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/*.cpp)
471461
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES})
472462
IF(BUILD_SHARED_LIBS)
473-
if (MSVC)
474-
message(WARNING "Building IfcGeom as DLL not currently supported on Windows/MSVC!")
463+
message(WARNING "Building IfcGeom as shared library not currently supported")
475464
add_library(IfcGeom STATIC ${IFCGEOM_FILES})
476-
set(IFCLIBS "${IFCLIBS};IfcGeom")
477-
else()
478-
add_library(IfcGeom SHARED ${IFCGEOM_FILES})
479-
set(IFCBINS "${IFCBINS};IfcGeom")
480-
endif()
481465
ELSE()
482-
ADD_LIBRARY(IfcGeom STATIC ${IFCGEOM_FILES})
483-
set(IFCLIBS "${IFCLIBS};IfcGeom")
466+
add_library(IfcGeom ${IFCGEOM_FILES})
484467
ENDIF()
485468

486469
TARGET_LINK_LIBRARIES(IfcGeom IfcParse)
@@ -493,7 +476,6 @@ ADD_EXECUTABLE(IfcConvert ${IFCCONVERT_FILES})
493476
if (IFCCONVERT_DOUBLE_PRECISION)
494477
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS -DIFCCONVERT_DOUBLE_PRECISION)
495478
endif()
496-
set(IFCBINS "${IFCBINS};IfcConvert")
497479

498480
# Make sure cross-referenced symbols between static OCC libraries get
499481
# resolved. Also add thread and rt libraries.
@@ -506,21 +488,20 @@ if("${libTKernelExt}" STREQUAL ".a")
506488
set(OPENCASCADE_LIBRARIES ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${LIB_RT} dl)
507489
endif()
508490

509-
TARGET_LINK_LIBRARIES(IfcConvert ${IFCLIBS} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
491+
TARGET_LINK_LIBRARIES(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
510492
if (NOT WIN32)
511-
SET_INSTALL_RPATHS(IfcConvert "${IFCDIRS};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${OPENCOLLADA_LIBRARY_DIR};${ICU_LIBRARY_DIR}")
493+
SET_INSTALL_RPATHS(IfcConvert "${IFCOPENSHELL_LIBARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${OPENCOLLADA_LIBRARY_DIR};${ICU_LIBRARY_DIR}")
512494
endif()
513495

514496
# IfcGeomServer
515497
file(GLOB CPP_FILES ../src/ifcgeomserver/*.cpp)
516498
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
517499
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
518500
ADD_EXECUTABLE(IfcGeomServer ${SOURCE_FILES})
519-
TARGET_LINK_LIBRARIES(IfcGeomServer ${IFCLIBS} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES})
501+
TARGET_LINK_LIBRARIES(IfcGeomServer ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES})
520502
if (NOT WIN32)
521-
SET_INSTALL_RPATHS(IfcGeomServer "${IFCDIRS};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${ICU_LIBRARY_DIR}")
503+
SET_INSTALL_RPATHS(IfcGeomServer "${IFCOPENSHELL_LIBARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS};${ICU_LIBRARY_DIR}")
522504
endif()
523-
set(IFCBINS "${IFCBINS};IfcGeomServer")
524505

525506
IF(BUILD_IFCPYTHON)
526507
ADD_SUBDIRECTORY(../src/ifcwrap ifcwrap)
@@ -535,7 +516,16 @@ IF(BUILD_IFCMAX)
535516
ENDIF()
536517

537518
# CMake installation targets
538-
INSTALL(FILES ${IFCPARSE_H_FILES} DESTINATION ${INCLUDEDIR}/ifcparse)
539-
INSTALL(FILES ${IFCGEOM_H_FILES} DESTINATION ${INCLUDEDIR}/ifcgeom)
540-
INSTALL(TARGETS ${IFCBINS} RUNTIME DESTINATION ${BINDIR})
541-
INSTALL(TARGETS ${IFCLIBS} ARCHIVE DESTINATION ${LIBDIR})
519+
INSTALL(FILES ${IFCPARSE_H_FILES}
520+
DESTINATION ${INCLUDEDIR}/ifcparse
521+
)
522+
523+
INSTALL(FILES ${IFCGEOM_H_FILES}
524+
DESTINATION ${INCLUDEDIR}/ifcgeom
525+
)
526+
527+
INSTALL(TARGETS IfcParse IfcGeom IfcConvert IfcGeomServer
528+
ARCHIVE DESTINATION ${LIBDIR}
529+
LIBRARY DESTINATION ${LIBDIR}
530+
RUNTIME DESTINATION ${BINDIR}
531+
)

src/examples/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
################################################################################
1919

2020
ADD_EXECUTABLE(IfcParseExamples IfcParseExamples.cpp)
21-
IF(BUILD_SHARED_LIBS)
22-
TARGET_LINK_LIBRARIES(IfcParseExamples ${IFCLIBS})
23-
ELSE()
24-
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
25-
ENDIF()
21+
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
2622
set_target_properties(IfcParseExamples PROPERTIES FOLDER Examples)
2723

2824
ADD_EXECUTABLE(IfcOpenHouse IfcOpenHouse.cpp)
29-
TARGET_LINK_LIBRARIES(IfcOpenHouse ${IFCLIBS} ${OPENCASCADE_LIBRARIES})
25+
TARGET_LINK_LIBRARIES(IfcOpenHouse ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES})
3026
set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples)

0 commit comments

Comments
 (0)