@@ -22,9 +22,19 @@ add_executable(organizer)
2222set_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+
2636mo2_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
2939target_link_libraries (organizer PRIVATE
3040 Shlwapi Bcrypt
@@ -34,30 +44,63 @@ target_link_libraries(organizer PRIVATE
3444 Qt6::WebEngineWidgets Qt6::WebSockets Version Dbghelp )
3545
3646install (FILES "${CMAKE_CURRENT_SOURCE_DIR} /dlls.manifest.qt6"
37- DESTINATION bin /dlls
47+ DESTINATION ${_bin} /dlls
3848 CONFIGURATIONS Release RelWithDebInfo
3949 RENAME dlls.manifest)
4050install (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
61104mo2_add_filter (NAME src/application GROUPS
62105 iuserinterface
63106 commandline
0 commit comments