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
+32 -9
View File
@@ -5,8 +5,33 @@ cmake_minimum_required(VERSION 3.22)
# first we configure the tests as with other tests
add_executable(runner-tests EXCLUDE_FROM_ALL)
mo2_configure_tests(runner-tests WARNINGS OFF)
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)
set_target_properties(runner-tests PROPERTIES FOLDER tests/runner)
@@ -25,16 +50,14 @@ target_include_directories(runner-tests
set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
mo2_python_pip_install(runner-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})
PACKAGES
pytest
PyQt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION}
PyQt${MO2_QT_VERSION_MAJOR}-Qt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION})
add_dependencies(runner-tests mobase)
set(pythoncore "${PYTHON_ROOT}/PCbuild/amd64/pythoncore")
set(pythoncorezip "${pythoncore}/python${Python_VERSION_SHORT}.zip")
set(PYTHONPATH "${PYLIB_DIR}\\;$<TARGET_FILE_DIR:mobase>\\;${pythoncore}\\;${pythoncorezip}")
set(PYTHONPATH "${PYLIB_DIR}\\;$<TARGET_FILE_DIR:mobase>\\;${Python_DLL_DIR}\\;${Python_LIB_DIR}")
set_tests_properties(${runner-tests_gtests}
PROPERTIES
+3 -2
View File
@@ -5,9 +5,10 @@
#include <QCoreApplication>
#include <uibase/iplugindiagnose.h>
#include <uibase/iplugingame.h>
#include "MockOrganizer.h"
#include "iplugindiagnose.h"
#include "iplugingame.h"
using namespace MOBase;
+3 -2
View File
@@ -5,9 +5,10 @@
#include <QCoreApplication>
#include <uibase/ipluginfilemapper.h>
#include <uibase/iplugingame.h>
#include "MockOrganizer.h"
#include "ipluginfilemapper.h"
#include "iplugingame.h"
using namespace MOBase;
+2 -1
View File
@@ -5,8 +5,9 @@
#include <QCoreApplication>
#include <uibase/iplugingame.h>
#include "MockOrganizer.h"
#include "iplugingame.h"
using namespace MOBase;
+2 -1
View File
@@ -1,8 +1,9 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <uibase/iplugininstallersimple.h>
#include "MockOrganizer.h"
#include "iplugininstallersimple.h"
#include "pythonrunner.h"
#include <QCoreApplication>
+5 -4
View File
@@ -1,8 +1,9 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <uibase/iplugin.h>
#include "MockOrganizer.h"
#include "iplugin.h"
#include "pythonrunner.h"
#include <QCoreApplication>
@@ -34,7 +35,7 @@ TEST(IPlugin, Basic)
EXPECT_EQ(settings.size(), 1);
EXPECT_EQ(settings[0].key, "a setting");
EXPECT_EQ(settings[0].description, "the setting description");
EXPECT_EQ(settings[0].defaultValue.userType(), QVariant::Type::Int);
EXPECT_EQ(settings[0].defaultValue.userType(), QMetaType::Type::Int);
EXPECT_EQ(settings[0].defaultValue.toInt(), 12);
// no translation, no custom implementation -> name()