1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0027380: cmake should not try to link against 3rd-party libs when configuring a static OCCT build

Linking against 3rd-party libs when configuring a static OCCT build is eliminated.

math library is not linked if build is static

also: an info message is expanded by several words describing using of only header files of 3rdparties

Removed unnecessary for static build CMake gui variables
This commit is contained in:
ski 2016-04-13 12:38:17 +03:00 committed by bugmaster
parent f7ac9097ee
commit 3321f6847d
10 changed files with 857 additions and 792 deletions

View File

@ -26,6 +26,7 @@ if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
set (BUILD_SHARED_LIBS ON) set (BUILD_SHARED_LIBS ON)
else() else()
unset (BUILD_SHARED_LIBS) unset (BUILD_SHARED_LIBS)
message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
endif() endif()
# the name of the project # the name of the project
@ -579,7 +580,7 @@ endif()
# include <cmake binary folder>/inc # include <cmake binary folder>/inc
include_directories (${CMAKE_BINARY_DIR}/inc) include_directories (${CMAKE_BINARY_DIR}/inc)
if (3RDPARTY_LIBRARY_DIRS) if (3RDPARTY_LIBRARY_DIRS AND BUILD_SHARED_LIBS)
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS) list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}") string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}") message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")

View File

@ -8,7 +8,7 @@ set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG) macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEBUG)
if (NOT DEFINED INSTALL_${PRODUCT_NAME}) if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}") set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
endif() endif()
@ -37,6 +37,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE PATH "the path of ${HEADER_NAME}") set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE PATH "the path of ${HEADER_NAME}")
endif() endif()
if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}") 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) set (3RDPARTY_${PRODUCT_NAME}_LIBRARY "" CACHE FILEPATH "${PRODUCT_NAME} library" FORCE)
endif() endif()
@ -56,10 +57,12 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library") set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library")
endif() endif()
endif() endif()
endif()
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR # check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY FILEPATH "the path to ${PRODUCT_NAME} library")
if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}") if (3RDPARTY_${PRODUCT_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
@ -76,11 +79,11 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH) 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) set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library" FORCE)
else() else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR PATH "The directory containing ${PRODUCT_NAME} shared library")
endif() endif()
endif() endif()
endif() endif()
endif()
# header # header
if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}") if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
@ -109,6 +112,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE) set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE)
endif() endif()
if (BUILD_SHARED_LIBS)
# library # library
if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}") if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib) set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
@ -259,6 +263,7 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
endif() endif()
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL) mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
endif()
endmacro() endmacro()
macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME) macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
@ -272,6 +277,7 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE) set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
endif() endif()
if (BUILD_SHARED_LIBS)
# library dir # library dir
set (DOES_PATH_CONTAIN FALSE) set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}") if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
@ -292,7 +298,9 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
endif() endif()
endif() endif()
endif() endif()
endif()
if (BUILD_SHARED_LIBS)
# check library # check library
set (DOES_PATH_CONTAIN FALSE) set (DOES_PATH_CONTAIN FALSE)
if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}") if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
@ -316,4 +324,5 @@ macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE) set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
endif() endif()
endif() endif()
endif()
endmacro() endmacro()

View File

@ -1,6 +1,6 @@
# freetype # freetype
if (NOT DEFINED INSTALL_FREETYPE) if (NOT DEFINED INSTALL_FREETYPE AND BUILD_SHARED_LIBS)
set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}") set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}")
endif() endif()
@ -37,30 +37,33 @@ if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2") set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
endif() endif()
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}") if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "freetype library" FORCE)
endif() endif()
if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR) if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library") set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library")
endif() endif()
if (WIN32) if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}") if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE) set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
endif() endif()
endif() endif()
if (WIN32) if (WIN32)
if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR) if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library") set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library")
endif() endif()
endif()
endif() endif()
# check 3RDPARTY_FREETYPE_ paths for consistency with specified 3RDPARTY_FREETYPE_DIR # check 3RDPARTY_FREETYPE_ paths for consistency with specified 3RDPARTY_FREETYPE_DIR
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}") if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
@ -77,10 +80,10 @@ if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH) get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE) set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
else() else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
endif() endif()
endif() endif()
endif()
endif() endif()
# the FIRST step in search for freetype library and header folders (built-in search engine) # the FIRST step in search for freetype library and header folders (built-in search engine)
@ -118,8 +121,10 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}") if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
endif() endif()
endif()
# assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables # assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}") if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
@ -134,6 +139,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
endif() endif()
endif() endif()
if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}") if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
@ -146,6 +152,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
else() else()
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
endif() endif()
endif()
endif() endif()
# the SECOND step in search for freetype library and header folders (additional search algorithms) # the SECOND step in search for freetype library and header folders (additional search algorithms)
@ -211,7 +218,8 @@ else()
endif() endif()
# freetype library # freetype library
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib) set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
set (FREETYPE_PATH_SUFFIXES lib) set (FREETYPE_PATH_SUFFIXES lib)
@ -240,18 +248,18 @@ if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
else() else()
set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
endif() endif()
endif() endif()
if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}") if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}") list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_LIBRARY_DIR)
set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
endif() endif()
# freetype shared library # freetype shared library
if (WIN32) if (WIN32)
if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}") if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll) set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
@ -284,11 +292,10 @@ if (WIN32)
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_DLL_DIR)
endif() endif()
endif() endif()
# install instructions
# install instructions if (INSTALL_FREETYPE)
if (INSTALL_FREETYPE)
OCCT_MAKE_OS_WITH_BITNESS() OCCT_MAKE_OS_WITH_BITNESS()
if (WIN32) if (WIN32)
@ -330,13 +337,14 @@ if (INSTALL_FREETYPE)
endif() endif()
set (USED_3RDPARTY_FREETYPE_DIR "") set (USED_3RDPARTY_FREETYPE_DIR "")
else() else()
# the library directory for using by the executable # the library directory for using by the executable
if (WIN32) if (WIN32)
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR}) set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
else() else()
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR}) set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
endif() endif()
endif()
endif() endif()
# unset all redundant variables # unset all redundant variables
@ -344,4 +352,12 @@ OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2) OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY) OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL) if (BUILD_SHARED_LIBS)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
else()
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL_DIR)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY)
OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET(INSTALL_FREETYPE)
endif()

View File

@ -10,7 +10,7 @@ if (NOT DEFINED USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL) OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
endif() endif()
if (USE_TCL) if (USE_TCL AND BUILD_SHARED_LIBS)
if ("${3RDPARTY_TCL_LIBRARY_VERSION}" STREQUAL "") if ("${3RDPARTY_TCL_LIBRARY_VERSION}" STREQUAL "")
message (STATUS "Warning: TCL version has not been specified by CSF_TclLibs defining thus it will be used as 8.6") message (STATUS "Warning: TCL version has not been specified by CSF_TclLibs defining thus it will be used as 8.6")
set (3RDPARTY_TCL_LIBRARY_VERSION "8.6") set (3RDPARTY_TCL_LIBRARY_VERSION "8.6")

View File

@ -104,10 +104,6 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
elseif(NOT WIN32) elseif(NOT WIN32)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
endif() endif()
else()
if (NOT ANDROID AND NOT MINGW)
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
endif()
endif() endif()
endif() endif()

View File

@ -216,4 +216,6 @@ if (APPLE)
endif() endif()
endif() endif()
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}) if (BUILD_SHARED_LIBS)
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
endif()

View File

@ -1,6 +1,6 @@
# tbb # tbb
if (NOT DEFINED INSTALL_TBB) if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}") set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif() endif()
@ -9,7 +9,7 @@ if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb") set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif() endif()
if (MSVC) if (MSVC AND BUILD_SHARED_LIBS)
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE) add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE) add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
endif() endif()
@ -275,18 +275,18 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL) mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
endmacro() endmacro()
if (BUILD_SHARED_LIBS)
TBB_PRODUCT_SEARCH (TBB)
TBB_PRODUCT_SEARCH (TBBMALLOC)
TBB_PRODUCT_SEARCH (TBB) if (INSTALL_TBB)
TBB_PRODUCT_SEARCH (TBBMALLOC)
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "") set (USED_3RDPARTY_TBB_DIR "")
else() else()
# the library directory for using by the executable # the library directory for using by the executable
if (WIN32) if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR}) set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else() else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR}) set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif() endif()
endif()
endif() endif()

View File

@ -1,6 +1,6 @@
# tcl # tcl
if (NOT DEFINED INSTALL_TCL) if (NOT DEFINED INSTALL_TCL AND BUILD_SHARED_LIBS)
set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}") set (INSTALL_TCL OFF CACHE BOOL "${INSTALL_TCL_DESCR}")
endif() endif()
@ -14,26 +14,28 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl") set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
endif() endif()
# tcl library file (with absolute path) if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR) # tcl library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE) set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library" FORCE)
endif() endif()
# tcl library directory # tcl library directory
if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR) if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library") set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
endif() endif()
# tcl shared library (with absolute path) # tcl shared library (with absolute path)
if (WIN32) if (WIN32)
if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR) if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE) set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "tcl shared library" FORCE)
endif() endif()
endif() endif()
# tcl shared library directory # tcl shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR) if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library") set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
endif()
endif() endif()
# search for tcl in user defined directory # search for tcl in user defined directory
@ -62,8 +64,9 @@ if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
endif() endif()
endif() endif()
# tcl dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TCL_LIBRARY) # tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}") if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE) set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
@ -72,10 +75,10 @@ if (NOT 3RDPARTY_TCL_LIBRARY)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE) set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif() endif()
endif() endif()
endif() endif()
if (WIN32) if (WIN32)
if (NOT 3RDPARTY_TCL_DLL) if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll) set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
@ -94,12 +97,14 @@ if (WIN32)
PATHS "${DLL_FOLDER_FOR_SEARCH}" PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
endif() endif()
endif()
endif() endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TCL) COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
# tcl dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TCL_LIBRARY) # tcl dir and library
if (NOT 3RDPARTY_TCL_LIBRARY)
set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE) set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85 find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
PATHS "${3RDPARTY_TCL_LIBRARY_DIR}" PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
@ -119,10 +124,10 @@ if (NOT 3RDPARTY_TCL_LIBRARY)
get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH) get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE) set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
endif() endif()
endif() endif()
set (3RDPARTY_TCL_LIBRARY_VERSION "") set (3RDPARTY_TCL_LIBRARY_VERSION "")
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}") if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME) get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}") string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
@ -131,16 +136,16 @@ if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TCL version isn't found") message (STATUS "Info: TCL version isn't found")
endif() endif()
endif() endif()
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "") set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TCL_LIBRARY_VERSION) if (3RDPARTY_TCL_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}") string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}") string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}") set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
endif() endif()
if (WIN32) if (WIN32)
if (NOT 3RDPARTY_TCL_DLL) if (NOT 3RDPARTY_TCL_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll) set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
@ -167,31 +172,31 @@ if (WIN32)
get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH) get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE) set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
endif() endif()
endif() endif()
# include found paths to common variables # include found paths to common variables
if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}") if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}") list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
endif() endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}") if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}") list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR}) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
endif() endif()
if (WIN32) if (WIN32)
if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}") if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}") list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
endif() endif()
endif() endif()
# install tcl # install tcl
if (INSTALL_TCL) if (INSTALL_TCL)
# include occt macros. compiler_bitness, os_wiht_bit, compiler # include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
@ -245,16 +250,17 @@ if (INSTALL_TCL)
endif() endif()
set (USED_3RDPARTY_TCL_DIR "") set (USED_3RDPARTY_TCL_DIR "")
else() else()
# the library directory for using by the executable # the library directory for using by the executable
if (WIN32) if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR}) set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
else() else()
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR}) set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
endif() endif()
endif() endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL) mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
endif()
if (TK_FOUND AND 3RDPARTY_TCL_DIR) if (TK_FOUND AND 3RDPARTY_TCL_DIR)
@ -278,3 +284,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
OCCT_CHECK_AND_UNSET (TK_LIBRARY) OCCT_CHECK_AND_UNSET (TK_LIBRARY)
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH) OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
OCCT_CHECK_AND_UNSET (TK_WISH) OCCT_CHECK_AND_UNSET (TK_WISH)
if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
endif()

View File

@ -1,6 +1,6 @@
# tk # tk
if (NOT DEFINED INSTALL_TK) if (NOT DEFINED INSTALL_TK AND BUILD_SHARED_LIBS)
set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}") set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}")
endif() endif()
@ -18,26 +18,28 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk") set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
endif() endif()
# tk library file (with absolute path) if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR) # tk library file (with absolute path)
if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE) set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
endif() endif()
# tk library directory # tk library directory
if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR) if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library") set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
endif() endif()
# tk shared library (with absolute path) # tk shared library (with absolute path)
if (WIN32) if (WIN32)
if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR) if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE) set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
endif() endif()
endif() endif()
# tk shared library directory # tk shared library directory
if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR) if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library") set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
endif()
endif() endif()
# search for tk in user defined directory # search for tk in user defined directory
@ -66,8 +68,9 @@ if (NOT 3RDPARTY_TK_INCLUDE_DIR)
endif() endif()
endif() endif()
# tk dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TK_LIBRARY) # tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}") if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE) set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
@ -76,10 +79,10 @@ if (NOT 3RDPARTY_TK_LIBRARY)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE) set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
endif() endif()
endif() endif()
endif() endif()
if (WIN32) if (WIN32)
if (NOT 3RDPARTY_TK_DLL) if (NOT 3RDPARTY_TK_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
@ -98,12 +101,14 @@ if (WIN32)
PATHS "${DLL_FOLDER_FOR_SEARCH}" PATHS "${DLL_FOLDER_FOR_SEARCH}"
NO_DEFAULT_PATH) NO_DEFAULT_PATH)
endif() endif()
endif()
endif() endif()
COMPLIANCE_PRODUCT_CONSISTENCY(TK) COMPLIANCE_PRODUCT_CONSISTENCY(TK)
# tk dir and library if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_TK_LIBRARY) # tk dir and library
if (NOT 3RDPARTY_TK_LIBRARY)
set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE) set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85 find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
PATHS "${3RDPARTY_TK_LIBRARY_DIR}" PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
@ -123,10 +128,10 @@ if (NOT 3RDPARTY_TK_LIBRARY)
get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH) get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE) set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
endif() endif()
endif() endif()
set (3RDPARTY_TK_LIBRARY_VERSION "") set (3RDPARTY_TK_LIBRARY_VERSION "")
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}") if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME) get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}") string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
@ -135,16 +140,16 @@ if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
message (STATUS "Info: TK version isn't found") message (STATUS "Info: TK version isn't found")
endif() endif()
endif() endif()
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "") set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
if (3RDPARTY_TK_LIBRARY_VERSION) if (3RDPARTY_TK_LIBRARY_VERSION)
string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}") string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}") string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}") set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
endif() endif()
if (WIN32) if (WIN32)
if (NOT 3RDPARTY_TK_DLL) if (NOT 3RDPARTY_TK_DLL)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
@ -171,6 +176,7 @@ if (WIN32)
get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH) get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE) set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
endif() endif()
endif()
endif() endif()
# include found paths to common variables # include found paths to common variables
@ -180,22 +186,23 @@ else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR)
endif() endif()
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}") if (BUILD_SHARED_LIBS)
if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}") list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR}) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
endif() endif()
if (WIN32) if (WIN32)
if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}") if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}") list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
endif() endif()
endif() endif()
# install tk # install tk
if (INSTALL_TK) if (INSTALL_TK)
# include occt macros. compiler_bitness, os_wiht_bit, compiler # include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
@ -248,16 +255,17 @@ if (INSTALL_TK)
endif() endif()
set (USED_3RDPARTY_TK_DIR "") set (USED_3RDPARTY_TK_DIR "")
else() else()
# the library directory for using by the executable # the library directory for using by the executable
if (WIN32) if (WIN32)
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR}) set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
else() else()
set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR}) set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
endif() endif()
endif() endif()
mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL) mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
endif()
# unset all redundant variables # unset all redundant variables
#TCL #TCL
@ -268,3 +276,11 @@ OCCT_CHECK_AND_UNSET (TCL_TCLSH)
OCCT_CHECK_AND_UNSET (TK_LIBRARY) OCCT_CHECK_AND_UNSET (TK_LIBRARY)
OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH) OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
OCCT_CHECK_AND_UNSET (TK_WISH) OCCT_CHECK_AND_UNSET (TK_WISH)
if (NOT BUILD_SHARED_LIBS)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_LIBRARY_DIR)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
OCCT_CHECK_AND_UNSET (INSTALL_TK)
endif()

View File

@ -31,24 +31,28 @@ if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK") set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE PATH "The directory containing headers of VTK")
endif() endif()
# vtk library directory if (BUILD_SHARED_LIBS)
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR) # vtk library directory
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries") set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE PATH "The directory containing VTK libraries")
endif() endif()
# vtk dll directory # vtk dll directory
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR) if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries") set (3RDPARTY_VTK_DLL_DIR "" CACHE PATH "The directory containing VTK shared libraries")
endif()
endif() endif()
# check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR # check 3RDPARTY_VTK_ paths for consistency with specified 3RDPARTY_VTK_DIR
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}") if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_INCLUDE_DIR PATH "The directory containing headers of VTK") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_INCLUDE_DIR PATH "The directory containing headers of VTK")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_LIBRARY_DIR PATH "The directory containing VTK libraries")
if (WIN32) if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_VTK_DIR 3RDPARTY_VTK_DLL_DIR PATH "The directory containing VTK shared library")
endif() endif()
endif()
endif() endif()
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}") if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
@ -70,8 +74,11 @@ if (VTK_FOUND)
if (VTK_LIBRARIES) if (VTK_LIBRARIES)
set (3RDPARTY_VTK_INCLUDE_DIRS) set (3RDPARTY_VTK_INCLUDE_DIRS)
if (BUILD_SHARED_LIBS)
set (3RDPARTY_VTK_LIBRARY_DIRS) set (3RDPARTY_VTK_LIBRARY_DIRS)
set (3RDPARTY_VTK_DLL_DIRS) set (3RDPARTY_VTK_DLL_DIRS)
endif()
foreach (VTK_LIBRARY ${VTK_LIBRARIES}) foreach (VTK_LIBRARY ${VTK_LIBRARIES})
string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY}) string (REGEX MATCH "^vtk" IS_VTK_LIBRARY ${VTK_LIBRARY})
@ -149,6 +156,7 @@ if (VTK_FOUND)
endif() endif()
endif() endif()
endif() endif()
endif()
endforeach() endforeach()
endif() endif()
@ -160,6 +168,7 @@ if (VTK_FOUND)
set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE) set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_INCLUDE_DIR}" CACHE PATH "The directory containing headers of VTK" FORCE)
endif() endif()
if (BUILD_SHARED_LIBS)
if (3RDPARTY_VTK_LIBRARY_DIRS) if (3RDPARTY_VTK_LIBRARY_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS) list (REMOVE_DUPLICATES 3RDPARTY_VTK_LIBRARY_DIRS)
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS}) list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIRS})
@ -177,7 +186,7 @@ if (VTK_FOUND)
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE) set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DLL_DIR}" CACHE PATH "The directory containing VTK shared libraries" FORCE)
endif() endif()
endif() endif()
endif() endif()
if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}") if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR}) list (APPEND 3RDPARTY_INCLUDE_DIRS ${3RDPARTY_VTK_INCLUDE_DIR})
@ -185,18 +194,20 @@ else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
endif() endif()
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}") if (BUILD_SHARED_LIBS)
if (3RDPARTY_VTK_LIBRARY_DIR AND EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR}) list (APPEND 3RDPARTY_LIBRARY_DIRS ${3RDPARTY_VTK_LIBRARY_DIR})
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_LIBRARY_DIR)
endif() endif()
if (WIN32) if (WIN32)
if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}") if (3RDPARTY_VTK_DLL_DIR OR EXISTS "${3RDPARTY_VTK_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR}) list (APPEND 3RDPARTY_DLL_DIRS ${3RDPARTY_VTK_DLL_DIR})
else() else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_DLL_DIR)
endif() endif()
endif()
endif() endif()
# the library directory for using by the executable # the library directory for using by the executable