Skip to content

Commit 7e462a4

Browse files
committed
Refactor CMake stuff after mo2-cmake updates for sources management.
1 parent dc265df commit 7e462a4

File tree

9 files changed

+120
-21
lines changed

9 files changed

+120
-21
lines changed

src/mobase/CMakeLists.txt

+25-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,35 @@ find_package(Qt6 COMPONENTS Core)
44
find_package(mo2-uibase CONFIG REQUIRED)
55

66
pybind11_add_module(mobase MODULE)
7+
mo2_default_source_group()
78
mo2_configure_target(mobase
8-
SOURCE_TREE
9+
NO_SOURCES
910
WARNINGS 4
1011
EXTERNAL_WARNINGS 4
1112
AUTOMOC ON
1213
TRANSLATIONS OFF
1314
)
15+
mo2_target_sources(mobase
16+
FOLDER src
17+
PRIVATE
18+
deprecation.cpp
19+
deprecation.h
20+
mobase.cpp
21+
pybind11_all.h
22+
)
23+
mo2_target_sources(mobase
24+
FOLDER src/wrappers
25+
PRIVATE
26+
./wrappers/basic_classes.cpp
27+
./wrappers/game_features.cpp
28+
./wrappers/known_folders.h
29+
./wrappers/pyfiletree.cpp
30+
./wrappers/pyfiletree.h
31+
./wrappers/pyplugins.cpp
32+
./wrappers/pyplugins.h
33+
./wrappers/utils.cpp
34+
./wrappers/widgets.cpp
35+
./wrappers/wrappers.cpp
36+
./wrappers/wrappers.h
37+
)
1438
target_link_libraries(mobase PRIVATE pybind11::qt pybind11::utils mo2::uibase Qt6::Core)

src/proxy/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ find_package(mo2-uibase CONFIG REQUIRED)
44

55
set(PLUGIN_NAME "plugin_python")
66

7-
add_library(proxy SHARED)
7+
add_library(proxy SHARED proxypython.cpp proxypython.h)
88
mo2_configure_plugin(proxy
9+
NO_SOURCES
910
WARNINGS 4
1011
EXTERNAL_WARNINGS 4
1112
TRANSLATIONS OFF
1213
EXTRA_TRANSLATIONS
1314
${CMAKE_CURRENT_SOURCE_DIR}/../runner
1415
${CMAKE_CURRENT_SOURCE_DIR}/../mobase
1516
${CMAKE_CURRENT_SOURCE_DIR}/../pybind11-qt)
17+
mo2_default_source_group()
1618
target_link_libraries(proxy PRIVATE runner mo2::uibase)
1719
set_target_properties(proxy PROPERTIES OUTPUT_NAME ${PLUGIN_NAME})
1820
mo2_install_plugin(proxy FOLDER)

src/proxy/resource.h

-6
This file was deleted.

src/pybind11-qt/CMakeLists.txt

+29-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,37 @@ mo2_find_python_executable(PYTHON_EXE)
66

77
add_library(pybind11-qt STATIC)
88
mo2_configure_target(pybind11-qt
9-
SOURCE_TREE
9+
NO_SOURCES
1010
WARNINGS 4
1111
EXTERNAL_WARNINGS 4
1212
AUTOMOC OFF
1313
TRANSLATIONS OFF
1414
)
15+
mo2_default_source_group()
16+
target_sources(pybind11-qt
17+
PRIVATE
18+
./include/pybind11_qt/pybind11_qt_basic.h
19+
./include/pybind11_qt/pybind11_qt_containers.h
20+
./include/pybind11_qt/pybind11_qt_enums.h
21+
./include/pybind11_qt/pybind11_qt_holder.h
22+
./include/pybind11_qt/pybind11_qt_objects.h
23+
./include/pybind11_qt/pybind11_qt_qflags.h
24+
./include/pybind11_qt/pybind11_qt.h
25+
26+
pybind11_qt_basic.cpp
27+
pybind11_qt_sip.cpp
28+
pybind11_qt_utils.cpp
29+
30+
)
31+
mo2_target_sources(pybind11-qt
32+
FOLDER src/details
33+
PRIVATE
34+
./include/pybind11_qt/details/pybind11_qt_enum.h
35+
./include/pybind11_qt/details/pybind11_qt_qlist.h
36+
./include/pybind11_qt/details/pybind11_qt_qmap.h
37+
./include/pybind11_qt/details/pybind11_qt_sip.h
38+
./include/pybind11_qt/details/pybind11_qt_utils.h
39+
)
1540
target_link_libraries(pybind11-qt PUBLIC pybind11::pybind11 PRIVATE Qt6::Core Qt6::Widgets)
1641
target_include_directories(pybind11-qt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
1742

@@ -20,11 +45,12 @@ target_compile_definitions(pybind11-qt PUBLIC QT_NO_KEYWORDS)
2045

2146
# we need sip.h for pybind11-qt
2247
add_custom_target(PyQt6-siph DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sip.h")
48+
set_target_properties(PyQt6-siph PROPERTIES FOLDER autogen)
2349
add_custom_command(
2450
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sip.h"
2551
COMMAND
26-
${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_BINARY_DIR}/pylibs
27-
${CMAKE_BINARY_DIR}/pylibs/bin/sip-module.exe
52+
${CMAKE_COMMAND} -E env PYTHONPATH=${MO2_PYLIBS_DIR}
53+
${MO2_PYLIBS_DIR}/bin/sip-module.exe
2854
--sip-h PyQt${MO2_QT_VERSION_MAJOR}.sip
2955
--target-dir ${CMAKE_CURRENT_BINARY_DIR}
3056
)

src/pybind11-utils/CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
cmake_minimum_required(VERSION 3.16)
22

3-
add_library(pybind11-utils STATIC)
3+
add_library(pybind11-utils STATIC
4+
./include/pybind11_utils/functional.h
5+
./include/pybind11_utils/shared_cpp_owner.h
6+
./include/pybind11_utils/smart_variant_wrapper.h
7+
./include/pybind11_utils/smart_variant.h
8+
9+
functional.cpp
10+
)
411
mo2_configure_target(pybind11-utils
5-
SOURCE_TREE
12+
NO_SOURCES
613
WARNINGS 4
714
EXTERNAL_WARNINGS 4
815
AUTOMOC OFF
916
TRANSLATIONS OFF
1017
)
18+
mo2_default_source_group()
1119
target_link_libraries(pybind11-utils PUBLIC pybind11::pybind11)
1220
target_include_directories(pybind11-utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
1321

src/runner/CMakeLists.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ cmake_minimum_required(VERSION 3.16)
22

33
find_package(mo2-uibase CONFIG REQUIRED)
44

5-
add_library(runner SHARED)
5+
add_library(runner SHARED
6+
error.h
7+
pythonrunner.cpp
8+
pythonrunner.h
9+
pythonutils.h
10+
pythonutils.cpp
11+
)
612
mo2_configure_target(runner
7-
SOURCE_TREE
13+
NO_SOURCES
814
WARNINGS 4
915
EXTERNAL_WARNINGS 4
1016
AUTOMOC ON
1117
TRANSLATIONS OFF
1218
)
19+
mo2_default_source_group()
1320
target_link_libraries(runner PUBLIC mo2::uibase PRIVATE pybind11::embed pybind11::qt)
1421
target_include_directories(runner PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
1522
target_compile_definitions(runner PRIVATE RUNNER_BUILD)

tests/python/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
1111
set(UIBASE_PATH $<TARGET_FILE_DIR:mo2::uibase>)
1212

1313
add_custom_target(python-tests)
14+
target_sources(python-tests
15+
PRIVATE
16+
conftest.py
17+
test_argument_wrapper.py
18+
test_filetree.py
19+
test_functional.py
20+
test_guessed_string.py
21+
test_organizer.py
22+
test_path_wrappers.py
23+
test_qt_widgets.py
24+
test_qt.py
25+
test_shared_cpp_owner.py
26+
)
1427

1528
add_test(NAME pytest
1629
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/pylibs/bin/pytest.exe ${CMAKE_CURRENT_SOURCE_DIR} -s

tests/runner/CMakeLists.txt

+29-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,33 @@ cmake_minimum_required(VERSION 3.22)
55

66
# first we configure the tests as with other tests
77
add_executable(runner-tests EXCLUDE_FROM_ALL)
8-
9-
mo2_configure_tests(runner-tests WARNINGS OFF)
8+
mo2_default_source_group()
9+
mo2_target_sources(runner-tests
10+
FOLDER src
11+
PRIVATE
12+
test_diagnose.cpp
13+
test_filemapper.cpp
14+
test_game.cpp
15+
test_installer.cpp
16+
test_iplugin.cpp
17+
test_lifetime.cpp
18+
)
19+
mo2_target_sources(runner-tests
20+
FOLDER src/mocks
21+
PRIVATE
22+
../mocks/DummyFileTree.h
23+
../mocks/MockOrganizer.h
24+
)
25+
mo2_target_sources(runner-tests
26+
FOLDER src/plugins
27+
PRIVATE
28+
plugins/dummy-diagnose.py
29+
plugins/dummy-filemapper.py
30+
plugins/dummy-game.py
31+
plugins/dummy-installer.py
32+
plugins/dummy-iplugin.py
33+
)
34+
mo2_configure_tests(runner-tests NO_SOURCES WARNINGS 4)
1035

1136
set_target_properties(runner-tests PROPERTIES FOLDER tests/runner)
1237

@@ -25,8 +50,8 @@ target_include_directories(runner-tests
2550
set(PYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/pylibs)
2651
mo2_python_pip_install(runner-tests
2752
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pylibs
28-
PACKAGES
29-
pytest
53+
PACKAGES
54+
pytest
3055
PyQt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION}
3156
PyQt${MO2_QT_VERSION_MAJOR}-Qt${MO2_QT_VERSION_MAJOR}==${MO2_QT_VERSION})
3257

vcpkg.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
{
2121
"kind": "git",
2222
"repository": "https://github.com/Microsoft/vcpkg",
23-
"baseline": "f61a294e765b257926ae9e9d85f96468a0af74e7",
23+
"baseline": "2c0f34f7cfd36eec05faf7e47a390fbceabf16d2",
2424
"packages": ["boost*", "boost-*"]
2525
},
2626
{
2727
"kind": "git",
2828
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
29-
"baseline": "70c0aacd6962073dae6e46c2e810c91aa755d2e2",
29+
"baseline": "911c07c041c1b9f83b9a645d0eeb9bba2e5596e1",
3030
"packages": ["mo2-*", "pybind11", "spdlog"]
3131
}
3232
]

0 commit comments

Comments
 (0)