cmake: Auto-create user directory for portable mode

Suggested-by: dr.stug@citron-emu.org
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-10-08 16:21:14 +10:00
parent c1a6f2d47b
commit c98d253040
3 changed files with 28 additions and 1 deletions

View File

@@ -497,6 +497,12 @@ endif()
if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6)
set(CITRON_EXE_DIR "$<TARGET_FILE_DIR:citron>")
add_custom_command(TARGET citron POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} "${CITRON_EXE_DIR}/citron.exe" --dir "${CITRON_EXE_DIR}" --libdir "${CITRON_EXE_DIR}" --plugindir "${CITRON_EXE_DIR}/plugins" --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --no-translations --verbose 0)
# Create the "user" directory for portable mode
add_custom_command(TARGET citron POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CITRON_EXE_DIR}/user"
COMMENT "Creating portable user directory"
)
endif()
if (CITRON_USE_BUNDLED_QT)
@@ -525,7 +531,12 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
endif()
if (CITRON_USE_PRECOMPILED_HEADERS)
target_precompile_headers(citron PRIVATE precompiled_headers.h)
# Disable PCH for MSVC 14.44+ due to __builtin_assume_aligned conflict
if (NOT (MSVC AND MSVC_VERSION GREATER_EQUAL 1944))
target_precompile_headers(citron PRIVATE precompiled_headers.h)
else()
message(STATUS "Precompiled headers disabled for citron due to MSVC 14.44+ compatibility issue")
endif()
endif()
create_target_directory_groups(citron)

View File

@@ -81,6 +81,14 @@ if (MSVC)
copy_citron_SDL_deps(citron-cmd)
endif()
# Create the "user" directory for portable mode on Windows
if(WIN32)
add_custom_command(TARGET citron-cmd POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:citron-cmd>/user"
COMMENT "Creating portable user directory for citron-cmd"
)
endif()
if (CITRON_USE_PRECOMPILED_HEADERS)
target_precompile_headers(citron-cmd PRIVATE precompiled_headers.h)
endif()

View File

@@ -46,6 +46,14 @@ if(UNIX AND NOT APPLE)
install(TARGETS citron-room)
endif()
# Create the "user" directory for portable mode on Windows
if(WIN32)
add_custom_command(TARGET citron-room POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:citron-room>/user"
COMMENT "Creating portable user directory for citron-room"
)
endif()
if (CITRON_USE_PRECOMPILED_HEADERS)
target_precompile_headers(citron-room PRIVATE precompiled_headers.h)
endif()