From 604c50d3b384ac9e6aac55379cde7e7a7162b9dd Mon Sep 17 00:00:00 2001 From: Mikael Capelle Date: Fri, 6 May 2022 08:31:10 +0200 Subject: [PATCH] Add README and intermediate CMake. --- CMakeLists.txt | 9 +-------- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 11 +++++++++++ 3 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 README.md create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 15bab9f..e2f247a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,15 +18,8 @@ add_subdirectory(${MO2_BUILD_PATH}/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11 project(plugin_python) -# order matters! -add_subdirectory(src/pybind11-qt) -add_subdirectory(src/pybind11-utils) -add_subdirectory(src/mobase) -add_subdirectory(src/runner) -add_subdirectory(src/proxy) +add_subdirectory(src) -# force plugin_python to build mobase -add_dependencies(plugin_python mobase) set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT plugin_python) set(PLUGIN_PYTHON_TESTS ${PLUGIN_PYTHON_TESTS} CACHE BOOL "build tests for plugin_python") diff --git a/README.md b/README.md new file mode 100644 index 0000000..6536263 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# ModOrganizer2 - Python Proxy + +This repository contains the Python proxy plugin for ModOrganizer2. +The proxy plugin allow developers to write Python plugins for ModOrganizer2. + +## Setup, build, tests + +This repository is part of MO2 main repositories and should usually be build using +[`mob`](https://github.com/ModOrganizer2/mob). + +## Organization + +This repositories contains 5 sub-projects in `src`. +The interface between Python and C++ is done using the +[`pybind11`](https://github.com/pybind/pybind11) library. + +- [`src/proxy`](src/proxy/) contains the actual proxy plugin. This project is a simple + interface between MO2 and the runner (see below). + - This project generates the `plugin_python.dll` library. + - TODO: this project generates the translation file (-> moved the file). + - TODO: this project install necessary files for the plugin (Python DLL, Python + libraries, etc), INCLUDING `mobase`. +- [`src/runner`](src/runner/) contains the Python runner. This is the project that + instantiates a Python interpreter and load/unload Python plugins. + - TODO: static library +- [`src/pybind11-qt](src/pybind11-qt/) contains many utility stuff to interface + pybind11 with Qt and PyQt. +- [`src/pybind11-utils`](src/pybind11-utils/) contains some utility stuff pybind11. + This project is header-only. +- [`src/mobase](src/mobase) contains the Python plugin interface. + - This projects generates the `mobase` Python library. + +Some (woefully incomplete) tests are available under `tests`, split in three +sub-directories: + +- [`tests/mocks`](tests/mocks/) simply contains mocks of `uibase` interfaces to be used + in the two other test projects. +- [`tests/python`](tests/python/) contains Python tests for `pytest`. + This project generates a bunch of Python test libraries that are then imported in + Python test files (`test_*.py`) and tested using `pytest`. + These tests mostly cover the pybind11 Qt and utility stuff, and some standalone + MO2 classes and functions (`IFileTree`, `GuessedString`, etc). +- [`tests/runner`](tests/runner/) contains C++ tests, using GTest + Tests in this project instantiate a Python runner and then use it to check that + plugins implemented in Python can be used properly on the C++ side. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..161cb0a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.16) + +# order matters +add_subdirectory(pybind11-qt) +add_subdirectory(pybind11-utils) +add_subdirectory(mobase) +add_subdirectory(runner) +add_subdirectory(proxy) + +# force plugin_python to build mobase +add_dependencies(plugin_python mobase)