Move to VCPKG.

* Minor cleaning of CMakeLists.txt. Fix C++ warnings and Qt deprecation.
* Avoid using Python from virtual environment.
This commit is contained in:
Mikaël Capelle
2024-08-09 21:10:50 +02:00
parent e11d5ec00d
commit 7cca7018b3
45 changed files with 534 additions and 229 deletions
+21 -12
View File
@@ -2,17 +2,28 @@ cmake_minimum_required(VERSION 3.16)
# pytest
cmake_policy(SET CMP0144 NEW)
find_package(mo2-uibase CONFIG REQUIRED)
find_package(GTest REQUIRED)
set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
if (TARGET uibase)
set(UIBASE_PATH $<TARGET_FILE_DIR:uibase>)
else()
set(UIBASE_PATH "${MO2_INSTALL_PATH}/bin")
endif()
set(UIBASE_PATH $<TARGET_FILE_DIR:mo2::uibase>)
add_custom_target(python-tests)
target_sources(python-tests
PRIVATE
conftest.py
test_argument_wrapper.py
test_filetree.py
test_functional.py
test_guessed_string.py
test_organizer.py
test_path_wrappers.py
test_qt_widgets.py
test_qt.py
test_shared_cpp_owner.py
)
add_test(NAME pytest
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/pylibs/bin/pytest.exe ${CMAKE_CURRENT_SOURCE_DIR} -s
@@ -21,18 +32,16 @@ add_test(NAME pytest
set_tests_properties(pytest
PROPERTIES
DEPENDS python-tests
WORKING_DIRECTORY ${MO2_INSTALL_PATH}/bin
ENVIRONMENT_MODIFICATION
"PYTHONPATH=set:${PYLIB_DIR}\\;$<TARGET_FILE_DIR:mobase>;\
UIBASE_PATH=set:${UIBASE_PATH};\
QT_ROOT=set:${QT_ROOT}"
UIBASE_PATH=set:${UIBASE_PATH}"
)
mo2_python_pip_install(python-tests
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pylibs
PACKAGES pytest
PyQt${QT_MAJOR_VERSION}==${QT_VERSION}
PyQt${QT_MAJOR_VERSION}-Qt${QT_MAJOR_VERSION}==${QT_VERSION})
PyQt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION}
PyQt${MO2_QT_VERSION_MAJOR}-Qt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION})
add_dependencies(python-tests mobase)
set_target_properties(python-tests PROPERTIES FOLDER tests/python)
@@ -56,8 +65,8 @@ foreach (test_file ${test_files})
endforeach()
endif()
mo2_add_dependencies(${target} PRIVATE uibase Qt::Core Qt::Widgets)
target_link_libraries(${target} PRIVATE pybind11::qt pybind11::utils GTest::gmock)
target_link_libraries(${target} PRIVATE
mo2::uibase Qt6::Core Qt6::Widgets pybind11::qt pybind11::utils GTest::gmock)
target_include_directories(${target}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../mocks)