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") set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-macos")
# macOS app bundle configuration # macOS app bundle configuration
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/assets/dmg_background.png") if(EXISTS "${CMAKE_SOURCE_DIR}/assets/dmg_background.png")
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/dmg_setup.scpt") 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) elseif(UNIX)
# Linux DEB/RPM configuration # Linux DEB/RPM configuration

View File

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