Skip to content

Commit 6c3e792

Browse files
committed
Full standalone build.
1 parent ce5c2b7 commit 6c3e792

7 files changed

Lines changed: 127 additions & 36 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,47 @@ on:
66
pull_request:
77
types: [opened, synchronize, reopened]
88

9+
env:
10+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
11+
912
jobs:
1013
build:
1114
runs-on: windows-2022
1215
steps:
13-
- name: Build ModOrganizer 2
14-
uses: ModOrganizer2/build-with-mob-action@master
16+
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
17+
- name: Export GitHub Actions cache environment variables
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
22+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
23+
24+
- name: Install Qt
25+
uses: jurplel/install-qt-action@v3
26+
with:
27+
version: 6.7.0
28+
modules:
29+
cache: true
30+
31+
- uses: actions/checkout@v4
32+
33+
- name: "Set environmental variables"
34+
shell: bash
35+
run: |
36+
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
37+
38+
- name: Configure ModOrganizer
39+
shell: pwsh
40+
run: |
41+
cmake --preset vs2022-windows-standalone `
42+
"-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" `
43+
"-DCMAKE_INSTALL_PREFIX=install"
44+
45+
- name: Build ModOrganizer
46+
run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL
47+
48+
- name: Package ModOrganizer
49+
uses: actions/upload-artifact@master
1550
with:
16-
qt-modules: qtpositioning qtwebchannel qtwebengine qtwebsockets
17-
mo2-third-parties:
18-
7z zlib gtest libbsarch libloot openssl bzip2 python lz4 spdlog
19-
boost boost-di sip pyqt pybind11 ss licenses explorerpp DirectXTex
20-
mo2-dependencies: usvfs cmake_common uibase githubpp bsatk esptk archive lootcli game_gamebryo
51+
name: modorganizer
52+
path: ./install

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON)
55

66
project(organizer)
77

8+
# if MO2_INSTALL_IS_BIN is set, this means that we should install directly into the
9+
# installation prefix, without the bin/ subfolder, typically for a standalone build
10+
# to update an existing install
11+
if (MO2_INSTALL_IS_BIN)
12+
set(_bin ".")
13+
else()
14+
set(_bin bin)
15+
endif()
16+
817
add_subdirectory(src)
918

10-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION bin)
19+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION ${_bin})

CMakePresets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
"VCPKG_MANIFEST_FEATURES": {
4646
"type": "STRING",
4747
"value": "standalone"
48+
},
49+
"MO2_INSTALL_IS_BIN": {
50+
"type": "BOOL",
51+
"value": "ON"
4852
}
4953
},
5054
"inherits": "vs2022-windows",

src/CMakeLists.txt

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@ add_executable(organizer)
2222
set_target_properties(organizer PROPERTIES
2323
OUTPUT_NAME "ModOrganizer"
2424
WIN32_EXECUTABLE TRUE)
25-
mo2_configure_target(organizer WARNINGS OFF)
25+
26+
# disable translations because we want to be able to install somewhere else if
27+
# required
28+
mo2_configure_target(organizer WARNINGS 4 TRANSLATIONS OFF)
29+
30+
# we add translations "manually" to handle MO2_INSTALL_IS_BIN
31+
mo2_add_translations(organizer
32+
INSTALL_RELEASE
33+
INSTALL_DIRECTORY "${_bin}/translations"
34+
SOURCES ${CMAKE_CURRENT_SOURCE_DIR})
35+
2636
mo2_set_project_to_run_from_install(
27-
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/ModOrganizer.exe)
37+
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${_bin}/ModOrganizer.exe)
2838

2939
target_link_libraries(organizer PRIVATE
3040
Shlwapi Bcrypt
@@ -34,30 +44,63 @@ target_link_libraries(organizer PRIVATE
3444
Qt6::WebEngineWidgets Qt6::WebSockets Version Dbghelp)
3545

3646
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt6"
37-
DESTINATION bin/dlls
47+
DESTINATION ${_bin}/dlls
3848
CONFIGURATIONS Release RelWithDebInfo
3949
RENAME dlls.manifest)
4050
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.debug.qt6"
41-
DESTINATION bin/dlls
51+
DESTINATION ${_bin}/dlls
4252
CONFIGURATIONS Debug
4353
RENAME dlls.manifest)
4454

45-
install(DIRECTORY
46-
"${CMAKE_CURRENT_SOURCE_DIR}/stylesheets"
47-
"${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
48-
DESTINATION bin)
55+
if (NOT MO2_SKIP_STYLESHEETS_INSTALL)
56+
install(
57+
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/stylesheets"
58+
DESTINATION ${_bin})
59+
endif()
4960

50-
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html"
51-
DESTINATION bin/resources)
52-
53-
install(FILES $<TARGET_FILE:organizer> DESTINATION bin)
54-
install(FILES $<TARGET_PDB_FILE:organizer> DESTINATION pdb)
55-
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION bin/dlls)
56-
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION bin/dlls)
57-
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION bin/dlls)
58-
59-
mo2_deploy_qt(BINARIES ModOrganizer.exe $<TARGET_FILE_NAME:mo2::uibase>)
61+
if (NOT MO2_SKIP_TUTORIALS_INSTALL)
62+
install(
63+
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
64+
DESTINATION ${_bin})
65+
endif()
6066

67+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html"
68+
DESTINATION ${_bin}/resources)
69+
70+
# install ModOrganizer.exe itself
71+
install(FILES $<TARGET_FILE:organizer> DESTINATION ${_bin})
72+
73+
# install dependencies DLLs
74+
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION ${_bin}/dlls)
75+
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION ${_bin}/dlls)
76+
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION ${_bin}/dlls)
77+
78+
# this may copy over the ones from uibase/usvfs
79+
# - when building with mob, this should not matter as the files should be identical
80+
# - when building standalone, this should help having matching USVFS DLL between the
81+
# build and the installation
82+
# - this may cause issue with uibase in standalone mode if the installed version does
83+
# not match the one used for the build, but there would be other issue anyway (e.g.
84+
# different uibase.dll between modorganizer and plugins)
85+
#
86+
install(FILES
87+
$<TARGET_FILE:mo2::uibase>
88+
$<TARGET_FILE:usvfs_x64::usvfs_dll>
89+
$<TARGET_FILE:usvfs_x86::usvfs_dll>
90+
$<TARGET_FILE:usvfs_x64::usvfs_proxy>
91+
$<TARGET_FILE:usvfs_x86::usvfs_proxy>
92+
DESTINATION ${_bin})
93+
94+
# do not install PDB if CMAKE_INSTALL_PREFIX is "bin"
95+
if (NOT MO2_INSTALL_IS_BIN)
96+
install(FILES $<TARGET_PDB_FILE:organizer> DESTINATION pdb)
97+
endif()
98+
99+
mo2_deploy_qt(
100+
DIRECTORY ${_bin}
101+
BINARIES ModOrganizer.exe $<TARGET_FILE_NAME:mo2::uibase>)
102+
103+
# set source groups for VS
61104
mo2_add_filter(NAME src/application GROUPS
62105
iuserinterface
63106
commandline

src/selfupdater.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
2222

2323
#include <map>
2424

25-
#include <github.h>
2625
#include <uibase/versioninfo.h>
2726

2827
class Archive;
@@ -43,6 +42,8 @@ class QNetworkReply;
4342
class QProgressDialog;
4443
class Settings;
4544

45+
#include "github.h"
46+
4647
/**
4748
* @brief manages updates for Mod Organizer itself
4849
* This class is used to update the Mod Organizer

vcpkg-configuration.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
{
1515
"kind": "git",
1616
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
17-
"baseline": "e415ce268bc9502222f42372da415063bfd11c3e",
18-
"packages": ["mo2-*", "7zip"]
17+
"baseline": "976aa2c4e16c26fab776608029b2b47adf0854c5",
18+
"packages": ["mo2-*", "7zip", "usvfs"]
1919
}
2020
]
2121
}

vcpkg.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"dependencies": [
3-
"mo2-cmake",
4-
"mo2-libbsarch",
3+
"7zip",
54
"boost-accumulators",
65
"boost-assign",
76
"boost-date-time",
@@ -12,18 +11,21 @@
1211
"boost-signals2",
1312
"boost-thread",
1413
"boost-uuid",
15-
"7zip",
16-
"zlib",
17-
"lz4"
14+
"lz4",
15+
"mo2-cmake",
16+
"mo2-libbsarch",
17+
"zlib"
1818
],
1919
"features": {
2020
"standalone": {
2121
"description": "Build Standalone.",
2222
"dependencies": [
23-
"mo2-uibase",
23+
"mo2-archive",
2424
"mo2-bsatk",
2525
"mo2-esptk",
26-
"mo2-lootcli-header"
26+
"mo2-lootcli-header",
27+
"mo2-uibase",
28+
"usvfs"
2729
]
2830
}
2931
}

0 commit comments

Comments
 (0)