From 2823db915ad427d52a9207781d14460da28c991a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Mon, 20 Mar 2017 17:50:17 +0000 Subject: [PATCH] Update to pybind11 v2.1.1 --- CMakeLists.txt | 6 +++--- src/main.cpp | 13 +++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91ba1ae..3828bd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,9 @@ configure_file("${CMAKE_SOURCE_DIR}/src/wrapper_version.cpp.in" "${CMAKE_BINARY_ # pybind11 ####################################### -set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v1.8.1.tar.gz") -set(PYBIND11_DOWNLOAD_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-1.8.1.tar.gz") -set(PYBIND11_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-1.8.1") +set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v2.1.1.tar.gz") +set(PYBIND11_DOWNLOAD_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-2.1.1.tar.gz") +set(PYBIND11_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-2.1.1") if (NOT EXISTS ${PYBIND11_DOWNLOAD_PATH}) file(DOWNLOAD ${PYBIND11_URL} ${PYBIND11_DOWNLOAD_PATH}) diff --git a/src/main.cpp b/src/main.cpp index b6d8a64..e71ca47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,8 +28,6 @@ #include "wrapper_version.h" -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - PYBIND11_PLUGIN(loot_api) { using loot::CreateDatabase; using loot::DatabaseInterface; @@ -47,8 +45,7 @@ PYBIND11_PLUGIN(loot_api) { using pybind11::arg; using pybind11::enum_; using pybind11::class_; - - const std::string emptyString; + using pybind11::metaclass; pybind11::module module("loot_api", "A Python module that wraps the LOOT API, generated by pybind11."); @@ -99,14 +96,14 @@ PYBIND11_PLUGIN(loot_api) { .def_readwrite("removed", &PluginTags::removed) .def_readwrite("userlist_modified", &PluginTags::userlist_modified); - class_(module, "Version") + class_(module, "Version", metaclass()) .def_readonly_static("major", &LootVersion::major) .def_readonly_static("minor", &LootVersion::minor) .def_readonly_static("patch", &LootVersion::patch) .def_readonly_static("revision", &LootVersion::revision) .def_static("string", LootVersion::string); - class_(module, "WrapperVersion") + class_(module, "WrapperVersion", metaclass()) .def_readonly_static("major", &WrapperVersion::major) .def_readonly_static("minor", &WrapperVersion::minor) .def_readonly_static("patch", &WrapperVersion::patch) @@ -114,7 +111,7 @@ PYBIND11_PLUGIN(loot_api) { .def_static("string", WrapperVersion::string); class_>(module, "DatabaseInterface") - .def("load_lists", &DatabaseInterface::LoadLists, arg("masterlist_path"), arg("userlist_path") = emptyString) + .def("load_lists", &DatabaseInterface::LoadLists, arg("masterlist_path"), arg("userlist_path") = "") .def("eval_lists", &DatabaseInterface::EvalLists) .def("sort_plugins", &DatabaseInterface::SortPlugins) .def("update_masterlist", &DatabaseInterface::UpdateMasterlist) @@ -126,7 +123,7 @@ PYBIND11_PLUGIN(loot_api) { module.def("is_compatible", &IsCompatible); - module.def("create_database", &CreateDatabase, arg("game"), arg("game_path") = emptyString, arg("game_local_path") = emptyString); + module.def("create_database", &CreateDatabase, arg("game"), arg("game_path") = "", arg("game_local_path") = ""); return module.ptr(); }