From 785c69f707119f3787f46d44cd3744d9207ad546 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 28 Nov 2022 07:13:09 +0300 Subject: [PATCH] 2.2.4 --- MyxCMake/MyxCMakeConfig.cmake | 3 +- MyxCMake/MyxCMakeConfigVersion.cmake | 2 +- MyxCMake/lib/AddSaprBlock.cmake | 75 ---------------------------- MyxCMake/lib/AddSaprTest.cmake | 57 --------------------- MyxCMake/lib/macro/GTest.cmake | 30 +++++++++++ README.md | 2 +- VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- myx_setup.cmake | 4 +- 10 files changed, 38 insertions(+), 141 deletions(-) delete mode 100644 MyxCMake/lib/AddSaprBlock.cmake delete mode 100644 MyxCMake/lib/AddSaprTest.cmake create mode 100644 MyxCMake/lib/macro/GTest.cmake diff --git a/MyxCMake/MyxCMakeConfig.cmake b/MyxCMake/MyxCMakeConfig.cmake index c0e74aa..ee331a2 100644 --- a/MyxCMake/MyxCMakeConfig.cmake +++ b/MyxCMake/MyxCMakeConfig.cmake @@ -40,6 +40,7 @@ include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/CheckEnableCxxCompilerFlag.cmake) +include(${MYX_CMAKE_LIB_DIR}/macro/GTest.cmake) include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake) include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake) @@ -55,8 +56,6 @@ include(${MYX_CMAKE_LIB_DIR}/Toolchains.cmake) unset(MYX_CMAKE_TOOLCHAINS_DIR) include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake) -include(${MYX_CMAKE_LIB_DIR}/AddSaprBlock.cmake) -include(${MYX_CMAKE_LIB_DIR}/AddSaprTest.cmake) include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index 6efb31d..3cb0291 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.2.2") +set(MYX_CMAKE_PACKAGE_VERSION "2.2.4") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/AddSaprBlock.cmake b/MyxCMake/lib/AddSaprBlock.cmake deleted file mode 100644 index e636db6..0000000 --- a/MyxCMake/lib/AddSaprBlock.cmake +++ /dev/null @@ -1,75 +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() - - # Вызов стандартной функции `add_library()` - if(DEFINED ENV{SAPR_PREFIX}) - add_library(${TARGET_NAME} SHARED ${ARG_UNPARSED_ARGUMENTS}) - else() - add_library(${TARGET_NAME} STATIC ${ARG_UNPARSED_ARGUMENTS}) - set_target_properties(${TARGET_NAME} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) - endif() - - # Стандартные пути к заголовочным файлам - target_include_directories(${TARGET_NAME} - PUBLIC - $ - PRIVATE - $ - $ - ) - - # Сборка позиционно-независимых объектных файлов нужна - # для создания динамической библиотеки - 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() - if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - find_package(PythonInterp REQUIRED) - target_include_directories(${TARGET_NAME} PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${PYTHON_LIBRARIES}) - else() - find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - target_include_directories(${TARGET_NAME} PRIVATE ${Python3_INCLUDE_DIRS}) - endif() - find_package(pybind11 REQUIRED) - target_include_directories(${TARGET_NAME} PRIVATE ${pybind11_INCLUDE_DIR}) - target_include_directories(${TARGET_NAME} - PUBLIC $) - if(pybind11_VERSION VERSION_LESS "2.5.0") - target_link_libraries(${TARGET_NAME} PRIVATE pybind11::module) - else() - target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11) - endif() - endif() -endfunction() diff --git a/MyxCMake/lib/AddSaprTest.cmake b/MyxCMake/lib/AddSaprTest.cmake deleted file mode 100644 index 5644c07..0000000 --- a/MyxCMake/lib/AddSaprTest.cmake +++ /dev/null @@ -1,57 +0,0 @@ -#[=======================================================================[.rst: -myx_add_sapr_test ------------------ - -Вспомогательная функция для создания теста САПР:: - - myx_add_sapr_block(TARGET_NAME FILE_NAME) - -Обязательные параметры: `TARGET_NAME` - имя теста, `FILE_NAME` - имя файла. - -#]=======================================================================] - -include_guard(GLOBAL) - -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(MYX_CMAKE_LIB_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") -endif() - -function(myx_add_sapr_test TARGET_NAME FILE_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT}) - endif() - - add_executable(${TARGET_NAME} ${FILE_NAME}) - - target_include_directories(${TARGET_NAME} - PUBLIC $) - - find_package(GTest) - if(GTest_FOUND) - target_link_libraries(${TARGET_NAME} PRIVATE GTest::GTest GTest::Main) - else() - add_subdirectory(/usr/src/googletest/googletest ${CMAKE_BINARY_DIR}/gtest) - target_link_libraries(${TARGET_NAME} PRIVATE gtest gtest_main) - endif() - - if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - find_package(PythonInterp REQUIRED) - target_include_directories(${TARGET_NAME} PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(${TARGET_NAME} PRIVATE ${PYTHON_LIBRARIES}) - else() - find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - target_include_directories(${TARGET_NAME} PRIVATE ${Python3_INCLUDE_DIRS}) - endif() - - find_package(pybind11 REQUIRED) - target_include_directories(${TARGET_NAME} PRIVATE ${pybind11_INCLUDE_DIR}) - if(pybind11_VERSION VERSION_LESS "2.5.0") - target_link_libraries(${TARGET_NAME} PRIVATE pybind11::module) - else() - target_link_libraries(${TARGET_NAME} PRIVATE pybind11::headers pybind11::pybind11) - endif() - - add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) -endfunction() - diff --git a/MyxCMake/lib/macro/GTest.cmake b/MyxCMake/lib/macro/GTest.cmake new file mode 100644 index 0000000..9ff6b92 --- /dev/null +++ b/MyxCMake/lib/macro/GTest.cmake @@ -0,0 +1,30 @@ +include_guard(GLOBAL) + +macro(myx_add_gtest TARGET_NAME) + set(options) + set(oneValueArgs) + set(multiValueArgs) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + add_executable(${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS}) + + find_package(GTest) + if(GTest_FOUND) + target_link_libraries(${TARGET_NAME} PRIVATE GTest::GTest GTest::Main) + else() + if((NOT TARGET gtest) AND (NOT TARGET gtest_main)) + add_subdirectory(/usr/src/googletest/googletest ${CMAKE_BINARY_DIR}/gtest) + endif() + target_link_libraries(${TARGET_NAME} PRIVATE gtest gtest_main) + endif() + + add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) + foreach(__iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${__iter}) + endforeach() + unset(ARG_UNPARSED_ARGUMENTS) + unset(multiValueArgs) + unset(oneValueArgs) + unset(options) +endmacro() + diff --git a/README.md b/README.md index 4030be0..06bad8f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/2.2.2/myx-cmake-local-2.2.2.tar.xz ). +[архив](../../../releases/download/2.2.4/myx-cmake-local-2.2.4.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index b1b25a5..530cdd9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.2 +2.2.4 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index d37ce0f..cd8f5c5 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.2.2 LANGUAGES) +project(myx-cmake VERSION 2.2.4 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index f092610..c8bd51e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (2.2.2) unstable; urgency=medium +myx-cmake (2.2.4) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index 7cfcda2..cc3d1c2 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.2.2 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.2.4 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.2.2 REQUIRED) + find_package(MyxCMake 2.2.4 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)