2.1.99
This commit is contained in:
parent
714a5561f7
commit
fba519c288
@ -55,6 +55,7 @@ include(${MYX_CMAKE_LIB_DIR}/Toolchains.cmake)
|
|||||||
unset(MYX_CMAKE_TOOLCHAINS_DIR)
|
unset(MYX_CMAKE_TOOLCHAINS_DIR)
|
||||||
|
|
||||||
include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
|
||||||
|
include(${MYX_CMAKE_LIB_DIR}/AddSaprBlock.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake)
|
||||||
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set(MYX_CMAKE_PACKAGE_VERSION "2.1.98")
|
set(MYX_CMAKE_PACKAGE_VERSION "2.1.99")
|
||||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
else()
|
else()
|
||||||
|
@ -41,11 +41,7 @@ function(myx_add_object_library TARGET_NAME)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Вызов стандартной функции `add_library()`
|
# Вызов стандартной функции `add_library()`
|
||||||
if(DEFINED ENV{SAPR_PREFIX})
|
|
||||||
add_library(${TARGET_NAME} SHARED ${ARG_UNPARSED_ARGUMENTS})
|
|
||||||
else()
|
|
||||||
add_library(${TARGET_NAME} OBJECT ${ARG_UNPARSED_ARGUMENTS})
|
add_library(${TARGET_NAME} OBJECT ${ARG_UNPARSED_ARGUMENTS})
|
||||||
endif()
|
|
||||||
|
|
||||||
string(TOUPPER ${TARGET_NAME} __project_name_upper)
|
string(TOUPPER ${TARGET_NAME} __project_name_upper)
|
||||||
# Опция для разрешения сборки динамической библиотеки
|
# Опция для разрешения сборки динамической библиотеки
|
||||||
@ -64,22 +60,6 @@ function(myx_add_object_library TARGET_NAME)
|
|||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_SAPR_BLOCK_MODE)
|
|
||||||
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 Interpreter Development)
|
|
||||||
find_package(pybind11 CONFIG)
|
|
||||||
target_include_directories(${TARGET_NAME}
|
|
||||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/thirdparty/sapr>)
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Сборка позиционно-независимых объектных файлов нужна
|
# Сборка позиционно-независимых объектных файлов нужна
|
||||||
# для создания динамической библиотеки
|
# для создания динамической библиотеки
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
62
MyxCMake/lib/AddSaprBlock.cmake
Normal file
62
MyxCMake/lib/AddSaprBlock.cmake
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#[=======================================================================[.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()
|
||||||
|
|
||||||
|
# Вызов стандартной функции `add_library()`
|
||||||
|
if(DEFINED ENV{SAPR_PREFIX})
|
||||||
|
add_library(${TARGET_NAME} SHARED ${ARG_UNPARSED_ARGUMENTS})
|
||||||
|
else()
|
||||||
|
add_library(${TARGET_NAME} STATIC ${ARG_UNPARSED_ARGUMENTS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Стандартные пути к заголовочным файлам
|
||||||
|
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(DEFINED ENV{SAPR_PREFIX})
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
|
||||||
|
target_include_directories(${TARGET_NAME} ${Python3_INCLUDE_DIRS})
|
||||||
|
find_package(pybind11 REQUIRED)
|
||||||
|
target_include_directories("${pybind11_INCLUDE_DIR}")
|
||||||
|
target_include_directories(${TARGET_NAME}
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/thirdparty/sapr>)
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -7,28 +7,33 @@ function(myx_qt5_target_setup TARGET_NAME)
|
|||||||
|
|
||||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
get_target_property(target_type ${TARGET_NAME} TYPE)
|
get_target_property(__target_type ${TARGET_NAME} TYPE)
|
||||||
|
|
||||||
foreach(iter ${ARG_COMPONENTS})
|
foreach(iter ${ARG_COMPONENTS})
|
||||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
if(target_type STREQUAL "EXECUTABLE" AND NOT iter STREQUAL "LinguistTools")
|
if(NOT iter STREQUAL "LinguistTools")
|
||||||
|
if(__target_type STREQUAL "EXECUTABLE")
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE "Qt5::${iter}")
|
target_link_libraries(${TARGET_NAME} PRIVATE "Qt5::${iter}")
|
||||||
endif()
|
endif()
|
||||||
|
if((__target_type STREQUAL "SHARED_LIBRARY") OR (__target_type STREQUAL "OBJECT_LIBRARY"))
|
||||||
|
target_link_libraries(${TARGET_NAME} PUBLIC "Qt5::${iter}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(iter ${ARG_PRIVATE})
|
foreach(iter ${ARG_PRIVATE})
|
||||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(target_type STREQUAL "EXECUTABLE")
|
if(__target_type STREQUAL "EXECUTABLE")
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE ${Qt5Core_EXECUTABLE_COMPILE_FLAGS})
|
target_compile_options(${TARGET_NAME} PRIVATE ${Qt5Core_EXECUTABLE_COMPILE_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -58,7 +63,7 @@ function(myx_qt5_target_setup TARGET_NAME)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Перечень файлов, подлежащих переводу
|
# Перечень файлов, подлежащих переводу
|
||||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
get_target_property(tr ${TARGET_NAME} INTERFACE_TR_FILES)
|
get_target_property(tr ${TARGET_NAME} INTERFACE_TR_FILES)
|
||||||
else()
|
else()
|
||||||
get_target_property(tr ${TARGET_NAME} TR_FILES)
|
get_target_property(tr ${TARGET_NAME} TR_FILES)
|
||||||
@ -87,7 +92,7 @@ function(myx_qt5_target_setup TARGET_NAME)
|
|||||||
target_sources(${TARGET_NAME} PRIVATE ${qrc_l10n})
|
target_sources(${TARGET_NAME} PRIVATE ${qrc_l10n})
|
||||||
endif()
|
endif()
|
||||||
unset(tr)
|
unset(tr)
|
||||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||||
target_sources(${TARGET_NAME} INTERFACE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp})
|
target_sources(${TARGET_NAME} INTERFACE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp})
|
||||||
else()
|
else()
|
||||||
target_sources(${TARGET_NAME} PRIVATE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp})
|
target_sources(${TARGET_NAME} PRIVATE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp})
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
## Установка
|
## Установка
|
||||||
|
|
||||||
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
||||||
[архив](../../../releases/download/2.1.98/myx-cmake-local-2.1.98.tar.xz ).
|
[архив](../../../releases/download/2.1.99/myx-cmake-local-2.1.99.tar.xz ).
|
||||||
|
|
||||||
## Использование
|
## Использование
|
||||||
|
|
||||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||||
project(myx-cmake VERSION 2.1.98 LANGUAGES)
|
project(myx-cmake VERSION 2.1.99 LANGUAGES)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
|||||||
myx-cmake (2.1.98) unstable; urgency=medium
|
myx-cmake (2.1.99) unstable; urgency=medium
|
||||||
|
|
||||||
* New version.
|
* New version.
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@ if(ENV{MYX_CMAKE_DIR})
|
|||||||
set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR})
|
set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR})
|
||||||
endif()
|
endif()
|
||||||
if(MYX_CMAKE_DIR)
|
if(MYX_CMAKE_DIR)
|
||||||
find_package(MyxCMake 2.1.98 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
find_package(MyxCMake 2.1.99 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||||
else()
|
else()
|
||||||
if(MYX_CMAKE_USE_SYSTEM)
|
if(MYX_CMAKE_USE_SYSTEM)
|
||||||
find_package(MyxCMake 2.1.98 REQUIRED)
|
find_package(MyxCMake 2.1.99 REQUIRED)
|
||||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||||
else()
|
else()
|
||||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||||
|
Loading…
Reference in New Issue
Block a user