mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Possibility to customize layout of installation of OCCT is introduced by: - variable INSTALL_DIR_LAYOUT - select one of the two predefined layouts: either Windows (classic OCCT layout) or Unix (Linux standard) - variables INSTALL_DIR_* (BIN, LIB, INCLUDE, RESOURCE, DOC, TESTS, SCRIPT, SAMPLES, DATA) - specify locations of relevant components - variable INSTALL_DIR_WITH_VERSION (bool) - specifies whether full version of OCCT should be used in paths in Unix layout Files LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt are always installed. Environment is extended to support non-default layouts. For that, environment variables "CSF_OCCT*Path" are defined, corresponding to CMake variables INSTALL_DIR_* described above. Visual Studio environment, DRAW, tests, samples are amended to use these variables instead of (or as alternative to) CASROOT. Settings of Products-specific vars are removed from environment scripts. File genconf.bat was corrected to avoid error message for the case when path to TCL contains spaces. Product name in rc files changed to "Open CASCADE Technology".
293 lines
13 KiB
CMake
293 lines
13 KiB
CMake
# tbb
|
|
|
|
if (NOT DEFINED INSTALL_TBB)
|
|
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
|
|
endif()
|
|
|
|
# tbb directory
|
|
if (NOT DEFINED 3RDPARTY_TBB_DIR)
|
|
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
|
|
endif()
|
|
|
|
if (MSVC)
|
|
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
|
|
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
|
endif()
|
|
|
|
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
|
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
|
|
|
# specify TBB folder in connectin with 3RDPARTY_DIR
|
|
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
|
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb")
|
|
|
|
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}")
|
|
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
|
|
if (TBB_DIR_NAME)
|
|
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
|
|
endif()
|
|
endif()
|
|
else()
|
|
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
|
|
endif()
|
|
|
|
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
|
|
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
|
|
endif()
|
|
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR
|
|
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB")
|
|
endif()
|
|
|
|
# tbb.h
|
|
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
|
|
|
set (HEADER_NAMES tbb.h tbb/tbb.h)
|
|
|
|
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
|
|
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
|
|
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
|
PATHS ${3RDPARTY_TBB_DIR}
|
|
PATH_SUFFIXES include
|
|
CMAKE_FIND_ROOT_PATH_BOTH
|
|
NO_DEFAULT_PATH)
|
|
else()
|
|
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
|
|
PATH_SUFFIXES include
|
|
CMAKE_FIND_ROOT_PATH_BOTH)
|
|
endif()
|
|
endif()
|
|
|
|
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
|
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
|
|
else()
|
|
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
|
|
|
|
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
|
|
endif()
|
|
|
|
# common steps for tbb and tbbmalloc
|
|
macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
|
|
|
|
string (TOLOWER ${PRODUCT_NAME} lower_PRODUCT_NAME)
|
|
|
|
# define required tbb/tbbmalloc variables
|
|
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
|
|
endif()
|
|
|
|
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library")
|
|
endif()
|
|
|
|
if (WIN32)
|
|
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
if (WIN32 AND NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
|
|
endif()
|
|
|
|
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
|
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
|
else()
|
|
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR PATH "The directory containing ${PRODUCT_NAME} library")
|
|
endif()
|
|
|
|
if (WIN32)
|
|
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_DLL FILEPATH "the path to ${PRODUCT_NAME} shared library")
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
|
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
|
else()
|
|
|
|
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
OCCT_MAKE_COMPILER_SHORT_NAME()
|
|
OCCT_MAKE_COMPILER_BITNESS()
|
|
|
|
if (${COMPILER_BITNESS} EQUAL 32)
|
|
set (${PRODUCT_NAME}_ARCH_NAME ia32)
|
|
else()
|
|
set (${PRODUCT_NAME}_ARCH_NAME intel64)
|
|
endif()
|
|
|
|
# tbb/tbbmalloc library
|
|
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
|
|
|
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
|
|
set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME})
|
|
|
|
# set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
|
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER}")
|
|
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}")
|
|
file (GLOB ${PRODUCT_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${PRODUCT_NAME}_ARCH_NAME}/*")
|
|
if (${PRODUCT_NAME}_COMPILER_LIST)
|
|
list (GET ${PRODUCT_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
|
if (THE_MOST_FRESH_COMPILER_VERSION)
|
|
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
|
set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME} lib/${${PRODUCT_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
else()
|
|
set (PRODUCT_PATH_SUFFIXES lib ${lower_PRODUCT_NAME} lib/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER})
|
|
endif()
|
|
|
|
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${lower_PRODUCT_NAME}
|
|
PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
|
|
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
|
CMAKE_FIND_ROOT_PATH_BOTH
|
|
NO_DEFAULT_PATH)
|
|
else()
|
|
find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY ${lower_PRODUCT_NAME}
|
|
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
|
CMAKE_FIND_ROOT_PATH_BOTH)
|
|
endif()
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
|
|
get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
|
else()
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
|
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
|
|
else()
|
|
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR)
|
|
|
|
set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library" FORCE)
|
|
endif()
|
|
|
|
# tbb/tbbmalloc shared library
|
|
if (WIN32)
|
|
if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
|
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
|
set (PRODUCT_PATH_SUFFIXES bin)
|
|
|
|
# set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
|
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER}")
|
|
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}")
|
|
file (GLOB ${PRODUCT_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${PRODUCT_NAME}_ARCH_NAME}/*")
|
|
if (${PRODUCT_NAME}_COMPILER_LIST)
|
|
list (GET ${PRODUCT_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
|
|
if (THE_MOST_FRESH_COMPILER_VERSION)
|
|
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
|
|
set (PRODUCT_PATH_SUFFIXES bin bin/${${PRODUCT_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
else()
|
|
set (PRODUCT_PATH_SUFFIXES bin bin/${${PRODUCT_NAME}_ARCH_NAME}/${COMPILER})
|
|
endif()
|
|
|
|
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
|
|
find_library (3RDPARTY_${PRODUCT_NAME}_DLL ${lower_PRODUCT_NAME}
|
|
PATHS "${3RDPARTY_TBB_DIR}"
|
|
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
|
|
NO_DEFAULT_PATH)
|
|
else()
|
|
find_library (3RDPARTY_${PRODUCT_NAME}_DLL ${lower_PRODUCT_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
|
|
endif()
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_DLL AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL}")
|
|
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} library" FORCE)
|
|
else()
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
|
|
|
|
set (3RDPARTY_${PRODUCT_NAME}_DLL "" CACHE FILEPATH "${PRODUCT_NAME} shared library" FORCE)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
|
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
|
|
else()
|
|
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR)
|
|
endif()
|
|
endif()
|
|
|
|
# install tbb/tbbmalloc
|
|
if (INSTALL_${PRODUCT_NAME})
|
|
OCCT_MAKE_OS_WITH_BITNESS()
|
|
OCCT_MAKE_COMPILER_SHORT_NAME()
|
|
|
|
if (WIN32)
|
|
if (SINGLE_GENERATOR)
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL} DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
|
else()
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
|
|
CONFIGURATIONS Release
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
|
|
CONFIGURATIONS RelWithDebInfo
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}i")
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_DLL}
|
|
CONFIGURATIONS Debug
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}d")
|
|
endif()
|
|
else()
|
|
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${PRODUCT_NAME}_LIBRARY} NAME)
|
|
|
|
if (SINGLE_GENERATOR)
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
|
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
|
else()
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
|
|
CONFIGURATIONS Release
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}"
|
|
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
|
|
CONFIGURATIONS RelWithDebInfo
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}i"
|
|
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
|
install (FILES ${3RDPARTY_${PRODUCT_NAME}_LIBRARY}.2
|
|
CONFIGURATIONS Debug
|
|
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}d"
|
|
RENAME ${PRODUCT_LIBRARY_NAME}.2)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
|
|
endmacro()
|
|
|
|
|
|
TBB_PRODUCT_SEARCH (TBB)
|
|
TBB_PRODUCT_SEARCH (TBBMALLOC)
|
|
|
|
|
|
if (INSTALL_TBB)
|
|
set (USED_3RDPARTY_TBB_DIR "")
|
|
else()
|
|
# the library directory for using by the executable
|
|
if (WIN32)
|
|
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
|
else()
|
|
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
|
endif()
|
|
endif()
|