Поддержка САПР

This commit is contained in:
Andrei Astafev 2022-11-02 09:51:53 +03:00
parent 96cdd184fa
commit 3a5d9d874d
9 changed files with 65 additions and 8 deletions

View File

@ -57,6 +57,7 @@ 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)

View File

@ -1,4 +1,4 @@
set(MYX_CMAKE_PACKAGE_VERSION "2.1.93")
set(MYX_CMAKE_PACKAGE_VERSION "2.1.94")
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

View File

@ -0,0 +1,56 @@
#[=======================================================================[.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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
# Сборка позиционно-независимых объектных файлов нужна
# для создания динамической библиотеки
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()
set(SAPR_BLOCK_TARGET_EXISTS ON)
endfunction()

View File

@ -6,7 +6,7 @@
include_guard(GLOBAL)
if(NOT TARGET uninstall)
if((NOT TARGET uninstall) AND (NOT SAPR_BLOCK_TARGET_EXISTS))
configure_file(${CMAKE_CURRENT_LIST_DIR}/uninstall.cmake.in
${CMAKE_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)

View File

@ -3,7 +3,7 @@
## Установка
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
[архив](../../../releases/download/2.1.93/myx-cmake-local-2.1.93.tar.xz ).
[архив](../../../releases/download/2.1.94/myx-cmake-local-2.1.94.tar.xz ).
## Использование

View File

@ -1 +1 @@
2.1.93
2.1.94

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
project(myx-cmake VERSION 2.1.93 LANGUAGES)
project(myx-cmake VERSION 2.1.94 LANGUAGES)
include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
myx-cmake (2.1.93) unstable; urgency=medium
myx-cmake (2.1.94) unstable; urgency=medium
* New version.

View File

@ -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.93 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
find_package(MyxCMake 2.1.94 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.93 REQUIRED)
find_package(MyxCMake 2.1.94 REQUIRED)
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)