1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0027351: Custom OCCT DLL name suffixes

Added generation of libraries with postfix.
This commit is contained in:
ski 2016-04-08 16:55:24 +03:00 committed by bugmaster
parent 3321f6847d
commit 46bd680a25
4 changed files with 50 additions and 0 deletions

View File

@ -24,9 +24,14 @@ endif()
if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
set (BUILD_SHARED_LIBS ON)
if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX)
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
endif()
else()
unset (BUILD_SHARED_LIBS)
message (STATUS "Info: Only 3rdparty's header files are used for building of static OCCT libraries")
unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
endif()
# the name of the project
@ -724,6 +729,11 @@ foreach(RESOURCE ${RESOURCES})
endif()
endforeach()
# patch installed DrawDefault file if BUILD_SHARED_LIBRARY_NAME_POSTFIX is changed
if (NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
OCCT_UPDATE_DRAW_DEFAULT_FILE()
endif()
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")

View File

@ -576,3 +576,26 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
set (OCCT_INSTALL_BIN_LETTER \"d\")
endif()")
endmacro()
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
install(CODE "cmake_policy(PUSH)
cmake_policy(SET CMP0007 NEW)
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
endforeach()
cmake_policy(POP)")
endmacro()
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
if (NOT WIN32)
install (CODE "if (EXISTS \"${LIBRARY_NAME}\")
execute_process (COMMAND ln -s \"${LIBRARY_NAME}\" \"${LINK_NAME}\")
endif()
")
endif()
endmacro()

View File

@ -152,11 +152,25 @@ else()
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
endif()
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
install (TARGETS ${PROJECT_NAME}
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
set (LINK_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}")
set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
endif()
endif()
endif()
if (CURRENT_MODULE)

View File

@ -22,6 +22,9 @@ set (BUILD_WITH_DEBUG_DESCR
"Enables extended messages of many OCCT algorithms, usually printed to cout.
These include messages on internal errors and special cases encountered, timing etc")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries")
# install variables
set (INSTALL_DIR_DESCR
"The place where built OCCT libraries, headers, test cases (INSTALL_TEST_CASES variable),