Make runner a static lib. Update translation paths. Clean CMake stuff.

This commit is contained in:
Mikaël Capelle
2022-05-06 17:40:11 +02:00
parent 604c50d3b3
commit e6c5923bb1
19 changed files with 380 additions and 396 deletions
+10 -13
View File
@@ -4,37 +4,34 @@ cmake_minimum_required(VERSION 3.22)
# things
# first we configure the tests as with other tests
add_executable(pythonrunner-tests EXCLUDE_FROM_ALL)
mo2_configure_tests(pythonrunner-tests WARNINGS OFF)
add_executable(runner-tests EXCLUDE_FROM_ALL)
mo2_configure_tests(runner-tests WARNINGS OFF)
# add mocks
target_include_directories(pythonrunner-tests
target_include_directories(runner-tests
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../mocks)
# link to pythonrunner - we set PYTHONRUNNER_LIBRARY to not export the symbol but
# loads it directly, we are going to add the DLL path below
target_compile_definitions(pythonrunner-tests PUBLIC PYTHONRUNNER_LIBRARY)
target_link_libraries(pythonrunner-tests PUBLIC pythonrunner)
# link to runner
target_link_libraries(runner-tests PUBLIC runner)
set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
mo2_python_pip_install(pythonrunner-tests
mo2_python_pip_install(runner-tests
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pylibs
PACKAGES pytest PyQt6==6.3.0)
add_dependencies(pythonrunner-tests mobase)
add_dependencies(runner-tests mobase)
# we set multiple properties, including:
# - updated PATH for DLLs (Qt, etc.), Python and pythonrunner
# - updated PATH for DLLs (Qt, etc.), Python and runner
# - PYTHONPATH
set(pythoncore "${PYTHON_ROOT}/PCbuild/amd64/pythoncore")
file(GLOB pythoncorezip "${pythoncore}/python*.zip")
set(pythoncorezip "${pythoncore}/python${Python_VERSION_SHORT}.zip")
set(PYTHONPATH "${PYLIB_DIR}\\;$<TARGET_FILE_DIR:mobase>\\;${pythoncore}\\;${pythoncorezip}")
set(extra_paths "${MO2_INSTALL_PATH}/bin/dlls")
string(APPEND extra_paths "\\;${PYTHON_ROOT}/PCbuild/amd64")
string(APPEND extra_paths "\\;$<TARGET_FILE_DIR:pythonrunner>")
set_tests_properties(${pythonrunner-tests_gtests}
set_tests_properties(${runner-tests_gtests}
PROPERTIES
WORKING_DIRECTORY "${MO2_INSTALL_PATH}/bin"
ENVIRONMENT "PLUGIN_DIR=${CMAKE_CURRENT_SOURCE_DIR}/plugins"
+1 -1
View File
@@ -17,7 +17,7 @@ TEST(IPluginDiagnose, Simple)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
// load objects
+1 -1
View File
@@ -15,7 +15,7 @@ TEST(IPluginFileMapper, Simple)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
// load objects
+1 -1
View File
@@ -18,7 +18,7 @@ TEST(IPluginGame, Simple)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
// load objects
+1 -1
View File
@@ -15,7 +15,7 @@ TEST(IPluginInstaller, Simple)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
// load objects
+1 -1
View File
@@ -13,7 +13,7 @@ TEST(IPlugin, Basic)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
// load objects
+1 -1
View File
@@ -9,7 +9,7 @@ TEST(Lifetime, Plugins)
{
const auto plugins_folder = QString(std::getenv("PLUGIN_DIR"));
std::unique_ptr<IPythonRunner> runner(CreatePythonRunner());
auto runner = mo2::python::createPythonRunner();
runner->initialize();
{