Update to pybind11 v2.1.1

This commit is contained in:
Oliver Hamlet
2017-05-13 08:19:30 +01:00
parent 70371b7647
commit 2823db915a
2 changed files with 8 additions and 11 deletions
+3 -3
View File
@@ -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})
+5 -8
View File
@@ -28,8 +28,6 @@
#include "wrapper_version.h"
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
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_<LootVersion>(module, "Version")
class_<LootVersion>(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_<WrapperVersion>(module, "WrapperVersion")
class_<WrapperVersion>(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_<DatabaseInterface, std::shared_ptr<DatabaseInterface>>(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();
}