Тест для САПР
This commit is contained in:
parent
153715dee0
commit
4c1e54173d
@ -56,6 +56,7 @@ 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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.2.0")
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.2.1")
|
||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
@ -53,8 +53,15 @@ function(myx_add_sapr_block TARGET_NAME)
|
||||
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} PRIVATE ${Python3_INCLUDE_DIRS})
|
||||
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}
|
||||
|
57
MyxCMake/lib/AddSaprTest.cmake
Normal file
57
MyxCMake/lib/AddSaprTest.cmake
Normal file
@ -0,0 +1,57 @@
|
||||
#[=======================================================================[.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 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/thirdparty/sapr>)
|
||||
|
||||
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()
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Установка
|
||||
|
||||
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
||||
[архив](../../../releases/download/2.2.0/myx-cmake-local-2.2.0.tar.xz ).
|
||||
[архив](../../../releases/download/2.2.1/myx-cmake-local-2.2.1.tar.xz ).
|
||||
|
||||
## Использование
|
||||
|
||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||
project(myx-cmake VERSION 2.2.0 LANGUAGES)
|
||||
project(myx-cmake VERSION 2.2.1 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
myx-cmake (2.2.0) unstable; urgency=medium
|
||||
myx-cmake (2.2.1) unstable; urgency=medium
|
||||
|
||||
* New version.
|
||||
|
||||
|
@ -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.0 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
find_package(MyxCMake 2.2.1 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.0 REQUIRED)
|
||||
find_package(MyxCMake 2.2.1 REQUIRED)
|
||||
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
|
||||
else()
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||
|
Loading…
Reference in New Issue
Block a user