diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index efeaf08..464d514 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -57,7 +57,6 @@ unset(MYX_CMAKE_TOOLCHAINS_DIR) include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake) include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake) -include(${MYX_CMAKE_LIB_DIR}/AddSaprBlock.cmake) include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake) include(${MYX_CMAKE_LIB_DIR}/Qt5TargetSetup.cmake) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index 84be00f..26e5983 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.1.96") +set(MYX_CMAKE_PACKAGE_VERSION "2.1.97") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/AddObjectLibrary.cmake b/MyxCMake/lib/AddObjectLibrary.cmake index 2fc2443..26fcaa0 100644 --- a/MyxCMake/lib/AddObjectLibrary.cmake +++ b/MyxCMake/lib/AddObjectLibrary.cmake @@ -31,17 +31,25 @@ function(myx_add_object_library TARGET_NAME) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT}) endif() - set(options) + set(options SAPR) set(oneValueArgs OUTPUT_NAME EXPORT_FILE_NAME EXPORT_BASE_NAME) set(multiValueArgs) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(ENABLE_SAPR) + set(ARG_SAPR ON) + endif() + if(NOT ARG_OUTPUT_NAME) set(ARG_OUTPUT_NAME ${TARGET_NAME}) endif() # Вызов стандартной функции `add_library()` - add_library(${TARGET_NAME} OBJECT ${ARG_UNPARSED_ARGUMENTS}) + if(DEFINED ENV{SAPR_PREFIX}) + add_library(${TARGET_NAME} SHARED ${ARG_UNPARSED_ARGUMENTS}) + else() + add_library(${TARGET_NAME} OBJECT ${ARG_UNPARSED_ARGUMENTS}) + endif() string(TOUPPER ${TARGET_NAME} __project_name_upper) # Опция для разрешения сборки динамической библиотеки @@ -60,6 +68,22 @@ function(myx_add_object_library TARGET_NAME) $ ) + if(ARG_SAPR) + target_compile_definitions(${TARGET_NAME} PUBLIC BLOCK_TARGET_MARK) + if(DEFINED ENV{SAPR_PREFIX}) + if(NOT WIN32) + set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN") + endif() + return() + else() + find_package(Python COMPONENTS Interpeter Development) + find_package(pybind11 CONFIG) + target_include_directories(${TARGET_NAME} + PUBLIC $) + target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11) + endif() + endif() + # Сборка позиционно-независимых объектных файлов нужна # для создания динамической библиотеки set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/MyxCMake/lib/AddSaprBlock.cmake b/MyxCMake/lib/AddSaprBlock.cmake deleted file mode 100644 index dffb595..0000000 --- a/MyxCMake/lib/AddSaprBlock.cmake +++ /dev/null @@ -1,62 +0,0 @@ -#[=======================================================================[.rst: -myx_add_sapr_block ------------------- - -Вспомогательная функция для создания блока для САПР:: - - myx_add_sapr_block(TARGET_NAME) - -Обязательные параметры: `TARGET_NAME` - имя блока. -Все остальные параметры передаются в стандартную функцию `add_library()` - -#]=======================================================================] - -include_guard(GLOBAL) - -include(CMakePackageConfigHelpers) -include(GenerateExportHeader) - -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(MYX_CMAKE_LIB_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") -endif() - -function(myx_add_sapr_block TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT}) - endif() - - set(options) - set(oneValueArgs) - set(multiValueArgs) - cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # Вызов стандартной функции `add_library()` - add_library(${TARGET_NAME} SHARED ${ARG_UNPARSED_ARGUMENTS}) - - # Стандартные пути к заголовочным файлам - target_include_directories(${TARGET_NAME} - PUBLIC - $ - PRIVATE - $ - $ - ) - - if(NOT DEFINED ENV{SAPR_PREFIX}) - find_package(Python COMPONENTS Interpeter Development) - find_package(pybind11 CONFIG) - target_include_directories(${TARGET_NAME} - PUBLIC $) - target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11) - endif() - - # Сборка позиционно-независимых объектных файлов нужна - # для создания динамической библиотеки - set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) - - target_compile_definitions(${TARGET_NAME} PUBLIC BLOCK_TARGET_MARK) - - if (NOT WIN32) - set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN") - endif() -endfunction() diff --git a/README.md b/README.md index 5b89ba8..277e81e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/2.1.96/myx-cmake-local-2.1.96.tar.xz ). +[архив](../../../releases/download/2.1.97/myx-cmake-local-2.1.97.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index 613f02e..3611216 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.96 +2.1.97 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index 32d6059..d30b86e 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6 FATAL_ERROR) -project(myx-cmake VERSION 2.1.96 LANGUAGES) +project(myx-cmake VERSION 2.1.97 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index 723d0b2..d9e5574 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (2.1.96) unstable; urgency=medium +myx-cmake (2.1.97) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index d8cb845..7325486 100644 --- a/myx_setup.cmake +++ b/myx_setup.cmake @@ -20,11 +20,11 @@ if(ENV{MYX_CMAKE_DIR}) set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR}) endif() if(MYX_CMAKE_DIR) - find_package(MyxCMake 2.1.96 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.1.97 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() if(MYX_CMAKE_USE_SYSTEM) - find_package(MyxCMake 2.1.96 REQUIRED) + find_package(MyxCMake 2.1.97 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)