2022-05-02 18:56:44 +02:00
|
|
|
cmake_minimum_required(VERSION 3.22)
|
2022-05-02 17:09:36 +02:00
|
|
|
|
2022-05-02 18:56:44 +02:00
|
|
|
# setting-up the tests for the runner is a bit complex because we need a tons of
|
|
|
|
|
# things
|
|
|
|
|
|
|
|
|
|
# first we configure the tests as with other tests
|
2022-05-06 17:40:11 +02:00
|
|
|
add_executable(runner-tests EXCLUDE_FROM_ALL)
|
2024-07-09 20:42:56 +02:00
|
|
|
mo2_default_source_group()
|
|
|
|
|
mo2_target_sources(runner-tests
|
|
|
|
|
FOLDER src
|
|
|
|
|
PRIVATE
|
|
|
|
|
test_diagnose.cpp
|
|
|
|
|
test_filemapper.cpp
|
|
|
|
|
test_game.cpp
|
|
|
|
|
test_installer.cpp
|
|
|
|
|
test_iplugin.cpp
|
|
|
|
|
test_lifetime.cpp
|
|
|
|
|
)
|
|
|
|
|
mo2_target_sources(runner-tests
|
|
|
|
|
FOLDER src/mocks
|
|
|
|
|
PRIVATE
|
|
|
|
|
../mocks/DummyFileTree.h
|
|
|
|
|
../mocks/MockOrganizer.h
|
|
|
|
|
)
|
|
|
|
|
mo2_target_sources(runner-tests
|
|
|
|
|
FOLDER src/plugins
|
|
|
|
|
PRIVATE
|
|
|
|
|
plugins/dummy-diagnose.py
|
|
|
|
|
plugins/dummy-filemapper.py
|
|
|
|
|
plugins/dummy-game.py
|
|
|
|
|
plugins/dummy-installer.py
|
|
|
|
|
plugins/dummy-iplugin.py
|
|
|
|
|
)
|
|
|
|
|
mo2_configure_tests(runner-tests NO_SOURCES WARNINGS 4)
|
2022-05-02 18:56:44 +02:00
|
|
|
|
2022-05-08 11:14:01 +02:00
|
|
|
set_target_properties(runner-tests PROPERTIES FOLDER tests/runner)
|
|
|
|
|
|
2024-06-22 08:27:42 +02:00
|
|
|
# link to runner
|
|
|
|
|
target_link_libraries(runner-tests PUBLIC runner)
|
|
|
|
|
|
|
|
|
|
# linking to Python - this is not required to get proper linking but required so that
|
|
|
|
|
# CMake generator variables will lookup appropriate DLLs for Python and update PATH
|
|
|
|
|
# accordingly thanks to mo2_configure_tests
|
|
|
|
|
target_link_libraries(runner-tests PUBLIC Python::Python)
|
|
|
|
|
|
2022-05-02 18:56:44 +02:00
|
|
|
# add mocks
|
2022-05-06 17:40:11 +02:00
|
|
|
target_include_directories(runner-tests
|
2022-05-02 17:09:36 +02:00
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../mocks)
|
2022-05-02 18:56:44 +02:00
|
|
|
|
|
|
|
|
set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
|
2022-05-06 17:40:11 +02:00
|
|
|
mo2_python_pip_install(runner-tests
|
2022-05-02 18:56:44 +02:00
|
|
|
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pylibs
|
2024-07-09 20:42:56 +02:00
|
|
|
PACKAGES
|
|
|
|
|
pytest
|
|
|
|
|
PyQt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION}
|
|
|
|
|
PyQt${MO2_QT_VERSION_MAJOR}-Qt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION})
|
2022-05-02 18:56:44 +02:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
add_dependencies(runner-tests mobase)
|
2022-05-02 18:56:44 +02:00
|
|
|
|
2024-07-09 20:42:56 +02:00
|
|
|
set(PYTHONPATH "${PYLIB_DIR}\\;$<TARGET_FILE_DIR:mobase>\\;${Python_DLL_DIR}\\;${Python_LIB_DIR}")
|
2022-05-02 18:56:44 +02:00
|
|
|
|
2022-05-06 17:40:11 +02:00
|
|
|
set_tests_properties(${runner-tests_gtests}
|
2022-05-02 18:56:44 +02:00
|
|
|
PROPERTIES
|
2024-06-22 08:27:42 +02:00
|
|
|
ENVIRONMENT "PLUGIN_DIR=${CMAKE_CURRENT_SOURCE_DIR}/plugins;PYTHONPATH=${PYTHONPATH}"
|
2024-06-09 12:26:39 +02:00
|
|
|
)
|