Skip to content

Commit 5be99e7

Browse files
committed
Move to VCPKG.
1 parent 6623e19 commit 5be99e7

39 files changed

+280
-162
lines changed

CMakeLists.txt

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,36 @@ cmake_minimum_required(VERSION 3.16)
22

33
cmake_policy(SET CMP0144 NEW)
44

5-
if(DEFINED DEPENDENCIES_DIR)
6-
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
7-
else()
8-
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
9-
endif()
5+
# remove MinSizeRel otherwise CMP0111 breaks everything
6+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo" CACHE STRING "" FORCE)
107

118
project(plugin_python CXX)
129

13-
set(PYTHON_BUILD_PATH ${PYTHON_ROOT}/PCBuild/amd64)
10+
find_package(mo2-cmake CONFIG REQUIRED)
1411

15-
# find Python - lots of "Hints" since we have a weird setup
16-
set(Python_USE_STATIC_LIBS False)
17-
set(Python_INCLUDE_DIR ${PYTHON_ROOT}/Include)
18-
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python.exe)
19-
if (EXISTS "${PYTHON_BUILD_PATH}/python_d.exe")
20-
set(Python_EXECUTABLE ${PYTHON_BUILD_PATH}/python_d.exe)
21-
endif()
22-
file(GLOB Python_LIBRARY ${PYTHON_BUILD_PATH}/python[0-9][0-9]*.lib)
23-
find_package(Python COMPONENTS Interpreter Development REQUIRED)
12+
find_package(Python 3.12 COMPONENTS Interpreter Development REQUIRED)
13+
find_package(pybind11 CONFIG REQUIRED)
2414

25-
# pybind11 needs uppercase (at least EXECUTABLE and LIBRARY)
26-
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
27-
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR})
28-
set(PYTHON_LIBRARY ${Python_LIBRARY})
15+
get_filename_component(Python_HOME ${Python_EXECUTABLE} PATH)
16+
set(Python_DLL_DIR "${Python_HOME}/DLLs")
17+
set(Python_LIB_DIR "${Python_HOME}/Lib")
18+
19+
add_custom_target(PyQt6)
20+
mo2_python_pip_install(PyQt6
21+
DIRECTORY ${CMAKE_BINARY_DIR}/pylibs/
22+
PACKAGES
23+
PyQt${Qt_VERSION_MAJOR}==${Qt_VERSION}
24+
sip==6.8.5)
2925

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

33-
# pybind11
34-
add_subdirectory(${MO2_BUILD_PATH}/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11)
35-
3629
# projects
3730
add_subdirectory(src)
38-
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT proxy)
3931

4032
# tests (if requested)
41-
set(PLUGIN_PYTHON_TESTS ${PLUGIN_PYTHON_TESTS} CACHE BOOL "build tests for plugin_python")
42-
if (PLUGIN_PYTHON_TESTS)
33+
set(PLUGIN_PYTHON_TESTING ${BUILD_TESTING} CACHE BOOL "build tests for plugin_python")
34+
if (PLUGIN_PYTHON_TESTING)
4335
enable_testing()
4436
add_subdirectory(tests)
4537
endif()

CMakePresets.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"configurePresets": [
3+
{
4+
"errors": {
5+
"deprecated": true
6+
},
7+
"hidden": true,
8+
"name": "cmake-dev",
9+
"warnings": {
10+
"deprecated": true,
11+
"dev": true
12+
}
13+
},
14+
{
15+
"cacheVariables": {
16+
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
17+
"type": "BOOL",
18+
"value": "ON"
19+
}
20+
},
21+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
22+
"hidden": true,
23+
"name": "vcpkg"
24+
},
25+
{
26+
"cacheVariables": {
27+
"VCPKG_MANIFEST_FEATURES": {
28+
"type": "STRING",
29+
"value": "testing"
30+
}
31+
},
32+
"hidden": true,
33+
"inherits": ["vcpkg"],
34+
"name": "vcpkg-dev"
35+
},
36+
{
37+
"binaryDir": "${sourceDir}/vsbuild",
38+
"architecture": {
39+
"strategy": "set",
40+
"value": "x64"
41+
},
42+
"cacheVariables": {
43+
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
44+
"VCPKG_TARGET_TRIPLET": {
45+
"type": "STRING",
46+
"value": "x64-windows-static-md"
47+
}
48+
},
49+
"generator": "Visual Studio 17 2022",
50+
"inherits": ["cmake-dev", "vcpkg-dev"],
51+
"name": "vs2022-windows",
52+
"toolset": "v143"
53+
}
54+
],
55+
"buildPresets": [
56+
{
57+
"name": "vs2022-windows",
58+
"resolvePackageReferences": "on",
59+
"configurePreset": "vs2022-windows"
60+
}
61+
],
62+
"version": 4
63+
}

src/mobase/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
find_package(Qt6 COMPONENTS Core)
4+
find_package(mo2-uibase CONFIG REQUIRED)
5+
36
pybind11_add_module(mobase MODULE)
47
mo2_configure_library(mobase
58
SOURCE_TREE
69
WARNINGS 4
710
EXTERNAL_WARNINGS 4
811
AUTOMOC ON
912
TRANSLATIONS OFF
10-
PRIVATE_DEPENDS uibase Qt::Core
1113
)
12-
target_link_libraries(mobase PRIVATE pybind11::qt pybind11::utils)
14+
target_link_libraries(mobase PRIVATE pybind11::qt pybind11::utils mo2::uibase Qt6::Core)

src/mobase/deprecation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <QCoreApplication>
99

10-
#include "log.h"
10+
#include <uibase/log.h>
1111

1212
namespace py = pybind11;
1313

src/mobase/mobase.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,6 @@
1212
#include "wrappers/pyfiletree.h"
1313
#include "wrappers/wrappers.h"
1414

15-
// TODO: remove these include (only for testing)
16-
#include <QDir>
17-
#include <QFile>
18-
#include <QWidget>
19-
#include <iplugin.h>
20-
#include <iplugindiagnose.h>
21-
#include <ipluginfilemapper.h>
22-
#include <iplugingame.h>
23-
#include <iplugininstaller.h>
24-
#include <iplugininstallersimple.h>
25-
#include <ipluginlist.h>
26-
#include <ipluginmodpage.h>
27-
#include <ipluginpreview.h>
28-
#include <iplugintool.h>
29-
#include <isavegame.h>
30-
#include <isavegameinfowidget.h>
31-
3215
using namespace MOBase;
3316
namespace py = pybind11;
3417

src/mobase/pybind11_all.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#include "pybind11_utils/shared_cpp_owner.h"
1717
#include "pybind11_utils/smart_variant_wrapper.h"
1818

19-
#include <game_feature.h>
20-
#include <isavegame.h>
21-
#include <pluginrequirements.h>
19+
#include <uibase/game_features/game_feature.h>
20+
#include <uibase/isavegame.h>
21+
#include <uibase/pluginrequirements.h>
2222

2323
namespace mo2::python {
2424

src/mobase/wrappers/basic_classes.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
#include <format>
66

7-
#include <executableinfo.h>
8-
#include <filemapping.h>
9-
#include <guessedvalue.h>
10-
#include <idownloadmanager.h>
11-
#include <igamefeatures.h>
12-
#include <iinstallationmanager.h>
13-
#include <imodinterface.h>
14-
#include <imodrepositorybridge.h>
15-
#include <imoinfo.h>
16-
#include <iplugin.h>
17-
#include <iplugindiagnose.h>
18-
#include <iplugingame.h>
19-
#include <ipluginlist.h>
20-
#include <pluginsetting.h>
21-
#include <versioninfo.h>
7+
#include <uibase/executableinfo.h>
8+
#include <uibase/filemapping.h>
9+
#include <uibase/game_features/igamefeatures.h>
10+
#include <uibase/guessedvalue.h>
11+
#include <uibase/idownloadmanager.h>
12+
#include <uibase/iinstallationmanager.h>
13+
#include <uibase/imodinterface.h>
14+
#include <uibase/imodrepositorybridge.h>
15+
#include <uibase/imoinfo.h>
16+
#include <uibase/iplugin.h>
17+
#include <uibase/iplugindiagnose.h>
18+
#include <uibase/iplugingame.h>
19+
#include <uibase/ipluginlist.h>
20+
#include <uibase/pluginsetting.h>
21+
#include <uibase/versioninfo.h>
2222

2323
#include "../deprecation.h"
2424
#include "pyfiletree.h"

src/mobase/wrappers/game_features.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
#include "../pybind11_all.h"
66

7-
#include <ipluginlist.h>
8-
#include <isavegameinfowidget.h>
9-
10-
#include <bsainvalidation.h>
11-
#include <dataarchives.h>
12-
#include <gameplugins.h>
13-
#include <igamefeatures.h>
14-
#include <localsavegames.h>
15-
#include <moddatachecker.h>
16-
#include <moddatacontent.h>
17-
#include <savegameinfo.h>
18-
#include <scriptextender.h>
19-
#include <unmanagedmods.h>
7+
#include <uibase/ipluginlist.h>
8+
#include <uibase/isavegameinfowidget.h>
9+
10+
#include <uibase/game_features/bsainvalidation.h>
11+
#include <uibase/game_features/dataarchives.h>
12+
#include <uibase/game_features/gameplugins.h>
13+
#include <uibase/game_features/igamefeatures.h>
14+
#include <uibase/game_features/localsavegames.h>
15+
#include <uibase/game_features/moddatachecker.h>
16+
#include <uibase/game_features/moddatacontent.h>
17+
#include <uibase/game_features/savegameinfo.h>
18+
#include <uibase/game_features/scriptextender.h>
19+
#include <uibase/game_features/unmanagedmods.h>
2020

2121
#include "pyfiletree.h"
2222

src/mobase/wrappers/pyfiletree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#include "../pybind11_all.h"
77

8-
#include <ifiletree.h>
9-
#include <log.h>
8+
#include <uibase/ifiletree.h>
9+
#include <uibase/log.h>
1010

1111
namespace py = pybind11;
1212
using namespace MOBase;

src/mobase/wrappers/pyfiletree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "../pybind11_all.h"
55

6-
#include <ifiletree.h>
6+
#include <uibase/ifiletree.h>
77

88
namespace pybind11 {
99
template <>

0 commit comments

Comments
 (0)