Enhance CMake configuration for macOS and emulator build

- Added checks to conditionally set the DMG background image and DS Store setup script only if the files exist, improving robustness in packaging.
- Updated the emulator build configuration to skip unnecessary steps in minimal builds, ensuring cleaner builds and better resource management.
- Streamlined target include directories and linking for the emulator, maintaining modularity and clarity in the CMake setup.
This commit is contained in:
scawful
2025-09-26 17:37:49 -04:00
parent a53e759043
commit 9e3a5778aa
2 changed files with 40 additions and 33 deletions

View File

@@ -64,8 +64,12 @@ elseif(APPLE)
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-macos")
# macOS app bundle configuration
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/assets/dmg_background.png")
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/dmg_setup.scpt")
if(EXISTS "${CMAKE_SOURCE_DIR}/assets/dmg_background.png")
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/assets/dmg_background.png")
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/dmg_setup.scpt")
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/dmg_setup.scpt")
endif()
elseif(UNIX)
# Linux DEB/RPM configuration

View File

@@ -1,5 +1,5 @@
# Yaze Emulator Standalone Application
if (APPLE)
# Yaze Emulator Standalone Application (skip in minimal builds)
if (NOT YAZE_MINIMAL_BUILD AND APPLE)
add_executable(
yaze_emu
MACOSX_BUNDLE
@@ -16,7 +16,7 @@ if (APPLE)
${IMGUI_SRC}
)
target_link_libraries(yaze_emu PUBLIC ${COCOA_LIBRARY})
else()
elseif(NOT YAZE_MINIMAL_BUILD)
add_executable(
yaze_emu
app/rom.cc
@@ -32,34 +32,37 @@ else()
)
endif()
target_include_directories(
yaze_emu PUBLIC
${CMAKE_SOURCE_DIR}/src/lib/
${CMAKE_SOURCE_DIR}/src/app/
${CMAKE_SOURCE_DIR}/src/lib/asar/src
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
${CMAKE_SOURCE_DIR}/incl/
${CMAKE_SOURCE_DIR}/src/
${PNG_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
)
# Only configure emulator target if it was created
if(NOT YAZE_MINIMAL_BUILD)
target_include_directories(
yaze_emu PUBLIC
${CMAKE_SOURCE_DIR}/src/lib/
${CMAKE_SOURCE_DIR}/src/app/
${CMAKE_SOURCE_DIR}/src/lib/asar/src
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
${CMAKE_SOURCE_DIR}/incl/
${CMAKE_SOURCE_DIR}/src/
${PNG_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
)
target_link_libraries(
yaze_emu PUBLIC
${ABSL_TARGETS}
${SDL_TARGETS}
${PNG_LIBRARIES}
${CMAKE_DL_LIBS}
ImGui
asar-static
)
target_link_libraries(
yaze_emu PUBLIC
${ABSL_TARGETS}
${SDL_TARGETS}
${PNG_LIBRARIES}
${CMAKE_DL_LIBS}
ImGui
asar-static
)
# Conditionally link ImGui Test Engine
if(YAZE_ENABLE_UI_TESTS)
target_link_libraries(yaze_emu PUBLIC ImGuiTestEngine)
target_compile_definitions(yaze_emu PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
else()
target_compile_definitions(yaze_emu PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
# Conditionally link ImGui Test Engine
if(YAZE_ENABLE_UI_TESTS)
target_link_libraries(yaze_emu PUBLIC ImGuiTestEngine)
target_compile_definitions(yaze_emu PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=1)
else()
target_compile_definitions(yaze_emu PRIVATE YAZE_ENABLE_IMGUI_TEST_ENGINE=0)
endif()
endif()