Skip to content

Commit

Permalink
Use MO2_INSTALL_BIN from mo2-cmake instead of custom CMake variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Oct 20, 2024
1 parent 17a2e5e commit ee6624f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
13 changes: 3 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON)

project(organizer)

set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
find_package(mo2-cmake CONFIG REQUIRED)

# if MO2_INSTALL_IS_BIN is set, this means that we should install directly into the
# installation prefix, without the bin/ subfolder, typically for a standalone build
# to update an existing install
if (MO2_INSTALL_IS_BIN)
set(_bin ".")
else()
set(_bin bin)
endif()
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)

add_subdirectory(src)
add_subdirectory(themes)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT organizer)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION ${_bin})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION ${MO2_INSTALL_BIN})
24 changes: 12 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ mo2_configure_target(organizer WARNINGS 4 TRANSLATIONS OFF)
# we add translations "manually" to handle MO2_INSTALL_IS_BIN
mo2_add_translations(organizer
INSTALL_RELEASE
INSTALL_DIRECTORY "${_bin}/translations"
INSTALL_DIRECTORY "${MO2_INSTALL_BIN}/translations"
SOURCES ${CMAKE_CURRENT_SOURCE_DIR})

mo2_set_project_to_run_from_install(
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${_bin}/ModOrganizer.exe)
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${MO2_INSTALL_BIN}/ModOrganizer.exe)

target_link_libraries(organizer PRIVATE
Shlwapi Bcrypt
Expand All @@ -44,30 +44,30 @@ target_link_libraries(organizer PRIVATE
Qt6::WebEngineWidgets Qt6::WebSockets Version Dbghelp)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt6"
DESTINATION ${_bin}/dlls
DESTINATION ${MO2_INSTALL_BIN}/dlls
CONFIGURATIONS Release RelWithDebInfo
RENAME dlls.manifest)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.debug.qt6"
DESTINATION ${_bin}/dlls
DESTINATION ${MO2_INSTALL_BIN}/dlls
CONFIGURATIONS Debug
RENAME dlls.manifest)

if (NOT MO2_SKIP_TUTORIALS_INSTALL)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
DESTINATION ${_bin})
DESTINATION ${MO2_INSTALL_BIN})
endif()

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html"
DESTINATION ${_bin}/resources)
DESTINATION ${MO2_INSTALL_BIN}/resources)

# install ModOrganizer.exe itself
install(FILES $<TARGET_FILE:organizer> DESTINATION ${_bin})
install(FILES $<TARGET_FILE:organizer> DESTINATION ${MO2_INSTALL_BIN})

# install dependencies DLLs
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION ${MO2_INSTALL_BIN}/dlls)
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION ${MO2_INSTALL_BIN}/dlls)
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION ${MO2_INSTALL_BIN}/dlls)

# this may copy over the ones from uibase/usvfs
# - when building with mob, this should not matter as the files should be identical
Expand All @@ -83,15 +83,15 @@ install(FILES
$<TARGET_FILE:usvfs_x86::usvfs_dll>
$<TARGET_FILE:usvfs_x64::usvfs_proxy>
$<TARGET_FILE:usvfs_x86::usvfs_proxy>
DESTINATION ${_bin})
DESTINATION ${MO2_INSTALL_BIN})

# do not install PDB if CMAKE_INSTALL_PREFIX is "bin"
if (NOT MO2_INSTALL_IS_BIN)
install(FILES $<TARGET_PDB_FILE:organizer> DESTINATION pdb)
endif()

mo2_deploy_qt(
DIRECTORY ${_bin}
DIRECTORY ${MO2_INSTALL_BIN}
BINARIES ModOrganizer.exe $<TARGET_FILE_NAME:mo2::uibase>)

# set source groups for VS
Expand Down

0 comments on commit ee6624f

Please sign in to comment.