From 75e6889366e5891a22c29684338389abc21cc4c9 Mon Sep 17 00:00:00 2001 From: Laurens Voerman Date: Fri, 24 Feb 2017 16:34:30 +0100 Subject: [PATCH] fix OpenCascade library list for use with shared libs; added list and options for static lib --- CMakeModules/FindOpenCascade.cmake | 51 +++++++++++++++++++++++ src/osgPlugins/OpenCASCADE/CMakeLists.txt | 4 ++ 2 files changed, 55 insertions(+) diff --git a/CMakeModules/FindOpenCascade.cmake b/CMakeModules/FindOpenCascade.cmake index 57d6d1750..22338f828 100644 --- a/CMakeModules/FindOpenCascade.cmake +++ b/CMakeModules/FindOpenCascade.cmake @@ -111,6 +111,18 @@ FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXmlXCAF TKXmlXCAF) FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXSBase TKXSBase) FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXSDRAW TKXSDRAW) +set (OPENCASCADE_LIBRARY_TYPE_DESCR +"Specifies the type of library to be used. 'Shared' libraries +are linked dynamically and loaded at runtime. 'Static' libraries +are archives of object files for use when linking other targets") + +# set type of OCCT libraries +if (NOT OPENCASCADE_LIBRARY_TYPE) + set (OPENCASCADE_LIBRARY_TYPE "Static" CACHE STRING "${OPENCASCADE_LIBRARY_TYPE_DESCR}" FORCE) + SET_PROPERTY(CACHE OPENCASCADE_LIBRARY_TYPE PROPERTY STRINGS Shared Static) +endif() + +if ("${OPENCASCADE_LIBRARY_TYPE}" STREQUAL "Shared") SET(OPENCASCADE_LIBRARY ${OPENCASCADE_LIBRARY} ${OPENCASCADE_TKernel} @@ -124,7 +136,46 @@ SET(OPENCASCADE_LIBRARY ${OPENCASCADE_LIBRARY} ${OPENCASCADE_TKXDESTEP} ${OPENCASCADE_TKIGES} ${OPENCASCADE_TKXDEIGES} + ${OPENCASCADE_TKLCAF} + ${OPENCASCADE_TKBRep} + ${OPENCASCADE_TKMesh} + ${OPENCASCADE_TKTopAlgo} + ${OPENCASCADE_TKShHealing} ) +else ("${OPENCASCADE_LIBRARY_TYPE}" STREQUAL "Shared") +SET(OPENCASCADE_LIBRARY ${OPENCASCADE_LIBRARY} + ${OPENCASCADE_TKBO} + ${OPENCASCADE_TKBool} + ${OPENCASCADE_TKBRep} + ${OPENCASCADE_TKCAF} + ${OPENCASCADE_TKCDF} + ${OPENCASCADE_TKDCAF} + ${OPENCASCADE_TKernel} + ${OPENCASCADE_TKG2d} + ${OPENCASCADE_TKG3d} + ${OPENCASCADE_TKGeomAlgo} + ${OPENCASCADE_TKGeomBase} + ${OPENCASCADE_TKHLR} + ${OPENCASCADE_TKIGES} + ${OPENCASCADE_TKLCAF} + ${OPENCASCADE_TKMath} + ${OPENCASCADE_TKMesh} + ${OPENCASCADE_TKPrim} + ${OPENCASCADE_TKService} + ${OPENCASCADE_TKShHealing} + ${OPENCASCADE_TKSTEP} + ${OPENCASCADE_TKSTEP209} + ${OPENCASCADE_TKSTEPAttr} + ${OPENCASCADE_TKSTEPBase} + ${OPENCASCADE_TKTopAlgo} + ${OPENCASCADE_TKV3d} + ${OPENCASCADE_TKVCAF} + ${OPENCASCADE_TKXCAF} + ${OPENCASCADE_TKXDEIGES} + ${OPENCASCADE_TKXDESTEP} + ${OPENCASCADE_TKXSBase} +) +endif ("${OPENCASCADE_LIBRARY_TYPE}" STREQUAL "Shared") SET(OPENCASCADE_FOUND "NO") IF(OPENCASCADE_LIBRARY AND OPENCASCADE_INCLUDE_DIR) diff --git a/src/osgPlugins/OpenCASCADE/CMakeLists.txt b/src/osgPlugins/OpenCASCADE/CMakeLists.txt index be97e5274..28862ae9c 100644 --- a/src/osgPlugins/OpenCASCADE/CMakeLists.txt +++ b/src/osgPlugins/OpenCASCADE/CMakeLists.txt @@ -13,5 +13,9 @@ SET(TARGET_LIBRARIES_VARS OPENCASCADE_LIBRARY) # requires CMake 3.1 to do the following: set (CMAKE_CXX_STANDARD 11) +if (NOT "${OPENCASCADE_LIBRARY_TYPE}" STREQUAL "Shared") +ADD_DEFINITIONS(-DHAVE_NO_DLL) +endif (NOT "${OPENCASCADE_LIBRARY_TYPE}" STREQUAL "Shared") + #### end var setup ### SETUP_PLUGIN(opencascade)