Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
id: build-plugin-python
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-third-parties: fmt gtest python spdlog boost sip pyqt pybind11
mo2-third-parties: gtest python spdlog boost sip pyqt pybind11
mo2-dependencies: cmake_common uibase
mo2-cmake-command: -DPLUGIN_PYTHON_TESTS=1 ..
- name: Build Plugin Python Tests
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.16)

cmake_policy(SET CMP0144 NEW)

if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
Expand All @@ -14,9 +16,14 @@ set(PYTHON_BUILD_PATH ${PYTHON_ROOT}/PCBuild/amd64)
set(Python_USE_STATIC_LIBS False)
set(Python_INCLUDE_DIR ${PYTHON_ROOT}/Include)
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python.exe)
file(GLOB Python_LIBRARY ${PYTHON_BUILD_PATH}/python[0-9]+.lib)
file(GLOB Python_LIBRARY ${PYTHON_BUILD_PATH}/python[0-9][0-9]*.lib)
find_package(Python COMPONENTS Interpreter Development REQUIRED)

# pybind11 needs uppercase (at least EXECUTABLE and LIBRARY)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR})
set(PYTHON_LIBRARY ${Python_LIBRARY})

# useful for naming DLL, zip, etc. (3.10 -> 310)
set(Python_VERSION_SHORT ${Python_VERSION_MAJOR}${Python_VERSION_MINOR})

Expand Down
2 changes: 1 addition & 1 deletion src/mobase/mobase.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma warning(disable : 4100)
#pragma warning(disable : 4996)

#include <format>
#include <tuple>
#include <variant>

Expand All @@ -15,7 +16,6 @@
#include <QDir>
#include <QFile>
#include <QWidget>
#include <fmt/format.h>
#include <iplugin.h>
#include <iplugindiagnose.h>
#include <ipluginfilemapper.h>
Expand Down
8 changes: 2 additions & 6 deletions src/mobase/wrappers/basic_classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

#include "../pybind11_all.h"

#pragma warning(push)
#pragma warning(disable : 4459)
#include <fmt/format.h>
#include <fmt/xchar.h>
#pragma warning(pop)
#include <format>

#include <executableinfo.h>
#include <filemapping.h>
Expand Down Expand Up @@ -763,7 +759,7 @@ namespace mo2::python {
.def_readwrite("isDirectory", &Mapping::isDirectory)
.def_readwrite("createTarget", &Mapping::createTarget)
.def("__str__", [](Mapping const& m) {
return fmt::format(L"Mapping({}, {}, {}, {})", m.source.toStdWString(),
return std::format(L"Mapping({}, {}, {}, {})", m.source.toStdWString(),
m.destination.toStdWString(), m.isDirectory,
m.createTarget);
});
Expand Down
83 changes: 0 additions & 83 deletions src/plugin_python_en.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/runner/error.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef ERROR_H
#define ERROR_H

#include <format>

#include <QString>

#include <fmt/format.h>
#include <pybind11/pybind11.h>

#include <utility.h>
Expand All @@ -19,7 +20,7 @@ namespace pyexcept {
MissingImplementation(std::string const& className,
std::string const& methodName)
: Exception(QString::fromStdString(
fmt::format("Python class implementing \"{}\" has no "
std::format("Python class implementing \"{}\" has no "
"implementation of method \"{}\".",
className, methodName)))
{
Expand Down
2 changes: 1 addition & 1 deletion src/runner/pythonutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace mo2::python {
buffer_ << message;
if (buffer_.tellp() != 0 && buffer_.str().back() == '\n') {
const auto full_message = buffer_.str();
MOBase::log::log(level_,
MOBase::log::log(level_, "{}",
full_message.substr(0, full_message.length() - 1));
buffer_ = std::stringstream{};
}
Expand Down
1 change: 1 addition & 0 deletions tests/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.16)

# pytest
cmake_policy(SET CMP0144 NEW)
find_package(GTest REQUIRED)

set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
Expand Down