build: split the 1423-line root CMakeLists into per-directory files with shared target helpers

This commit is contained in:
2026-07-30 12:19:18 -04:00
parent 25c63fb807
commit d04045be69
21 changed files with 591 additions and 1378 deletions
+105
View File
@@ -0,0 +1,105 @@
# The REAPER extension — a loadable module REAPER dlopen()s, never linked against.
# Its source list spans app/ + shell/ + the handful of core TUs compiled straight in, so
# the paths below are rooted at src/ rather than being relative to this directory.
add_library(reaper_reasampler MODULE
${REASAMPLER_SRC_DIR}/app/main.cpp
${REASAMPLER_SRC_DIR}/shell/capture/capture.cpp
${REASAMPLER_SRC_DIR}/shell/capture/capture_orchestrator.cpp
${REASAMPLER_SRC_DIR}/shell/capture/capture_batch.cpp
${REASAMPLER_SRC_DIR}/shell/capture/scope_resolve.cpp
${REASAMPLER_SRC_DIR}/shell/capture/realtime_lifecycle.cpp
${REASAMPLER_SRC_DIR}/shell/capture/capture_realtime_shell.cpp
${REASAMPLER_SRC_DIR}/shell/capture/capture_realtime_finalize.cpp
${REASAMPLER_SRC_DIR}/core/capture/capture_realtime.cpp
${REASAMPLER_SRC_DIR}/shell/persist/session.cpp
${REASAMPLER_SRC_DIR}/shell/persist/ext_state_io.cpp
${REASAMPLER_SRC_DIR}/shell/persist/prune_fs.cpp
${REASAMPLER_SRC_DIR}/shell/bank_ops/bank_ops.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_audition.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_bank_ops.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_drag.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_input.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_layout.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_render.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_thumbnails.cpp
${REASAMPLER_SRC_DIR}/shell/panel/panel_window.cpp
# draw_kit is compiled into each module rather than being a static library — see root
# CMakeLists.txt's LICE_SRC comment for why.
${REASAMPLER_SRC_DIR}/shell/panel/draw_kit.cpp
${REASAMPLER_SRC_DIR}/core/view/mode_switch.cpp
${REASAMPLER_SRC_DIR}/core/ui/tab_strip.cpp
${REASAMPLER_SRC_DIR}/shell/capture/insert.cpp
${REASAMPLER_SRC_DIR}/core/capture/insert_plan.cpp
${LICE_SRC}
${REASAMPLER_SRC_DIR}/core/view/view_mode_model.cpp
${REASAMPLER_SRC_DIR}/core/view/view_tree.cpp
${REASAMPLER_SRC_DIR}/shell/view/view.cpp
${REASAMPLER_SRC_DIR}/shell/capture/track_guid.cpp
${REASAMPLER_SRC_DIR}/shell/capture/provenance_shell.cpp
${REASAMPLER_SRC_DIR}/core/view/guid_diff.cpp
${REASAMPLER_SRC_DIR}/core/view/lane_keys.cpp
${REASAMPLER_SRC_DIR}/shell/capture/item_read.cpp
${REASAMPLER_SRC_DIR}/shell/actions/action_registry.cpp
${REASAMPLER_SRC_DIR}/shell/actions/design_view_actions.cpp
${REASAMPLER_SRC_DIR}/shell/actions/bank_actions.cpp
${REASAMPLER_SRC_DIR}/shell/actions/prune_action.cpp
${REASAMPLER_SRC_DIR}/shell/actions/ingest.cpp
${REASAMPLER_SRC_DIR}/core/model/bank_book.cpp
${REASAMPLER_SRC_DIR}/core/model/bank_book_json.cpp
${REASAMPLER_SRC_DIR}/core/model/owned_manifest.cpp
${REASAMPLER_SRC_DIR}/shell/actions/drag_out_win.cpp
${REASAMPLER_SRC_DIR}/shell/actions/instrument_drop_win.cpp
${REASAMPLER_SRC_DIR}/core/ui/action_bar.cpp
${REASAMPLER_SRC_DIR}/core/ui/footer_bar.cpp
${REASAMPLER_SRC_DIR}/core/ui/overflow_menu.cpp
${REASAMPLER_SRC_DIR}/core/ui/mode_enable.cpp
${REASAMPLER_SRC_DIR}/core/ui/tooltip.cpp
${REASAMPLER_SRC_DIR}/core/ui/card_meta.cpp
${REASAMPLER_SRC_DIR}/core/ui/card_drag.cpp
${REASAMPLER_SRC_DIR}/shell/persist/usage_scan.cpp
)
target_link_libraries(reaper_reasampler PRIVATE json wire file_bytes bank_model capture_paths peaks bank_grid mode_switch tab_strip view_mode_model insert_plan render_settings batch_capture tail_control capture_realtime bank_book wav_codec owned_manifest prune_reconcile prune_button app_version provenance drag_out instrument_drop theme component_geometry action_bar footer_bar overflow_menu mode_enable tooltip card_meta card_drag assignment_request bank_sync bridge_marshal sample_usage)
target_include_directories(reaper_reasampler PRIVATE ${SDK_INC} ${WDL_INC})
# OUTPUT_NAME is channel-derived; the CMake target name stays "reaper_reasampler" for both
# configs, since REAPER dlopen's any reaper_* module and the two channels' artifacts load
# side-by-side. LIBRARY_OUTPUT_DIRECTORY pins the module to the top of the build tree even
# though this target is declared in a subdirectory — the install step copies it from there.
# ARCHIVE_OUTPUT_DIRECTORY pins the same for MODULE targets: CMake emits an import-lib
# sidecar (.lib/.exp on MSVC) keyed off ARCHIVE_OUTPUT_DIRECTORY, not LIBRARY_OUTPUT_DIRECTORY,
# so it needs pinning too even though nothing links against this import lib.
set_target_properties(reaper_reasampler PROPERTIES
PREFIX ""
OUTPUT_NAME "${REASAMPLER_OUTPUT_NAME}"
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
if(WIN32)
# Native Win32; REAPER provides nothing extra to link. The bank-panel dialog template
# is compiled from resource.rc by the platform RC compiler.
target_sources(reaper_reasampler PRIVATE ${REASAMPLER_SRC_DIR}/resource.rc)
elseif(APPLE)
# Use REAPER's OWN SWELL at runtime via the modstub. Do NOT build full SWELL —
# SWELL_PROVIDED_BY_APP routes calls to the host.
target_sources(reaper_reasampler PRIVATE ${SWELL}/swell-modstub.mm)
target_compile_definitions(reaper_reasampler PRIVATE SWELL_PROVIDED_BY_APP)
target_link_libraries(reaper_reasampler PRIVATE "-framework AppKit")
set_target_properties(reaper_reasampler PROPERTIES SUFFIX ".dylib")
# SWELL can't read a Win32 .rc directly. Run resgen once to turn resource.rc into a
# C++ source, then add it here:
# php ${WDL_INC}/swell/mac_resgen.php src/resource.rc
# target_sources(reaper_reasampler PRIVATE ${REASAMPLER_SRC_DIR}/resource.rc_mac_dlg.h)
else()
# Linux: REAPER's libSwell.so is used at runtime via the generic modstub. With
# SWELL_PROVIDED_BY_APP you can drop pkg-config / -lX11 entirely.
target_sources(reaper_reasampler PRIVATE ${SWELL}/swell-modstub-generic.cpp)
target_compile_definitions(reaper_reasampler PRIVATE SWELL_PROVIDED_BY_APP)
set_target_properties(reaper_reasampler PROPERTIES SUFFIX ".so")
# Reuse the macOS resgen output (see CLAUDE.md, SWELL dialog resources), then add the
# generated source:
# php ${WDL_INC}/swell/mac_resgen.php src/resource.rc
# target_sources(reaper_reasampler PRIVATE ${REASAMPLER_SRC_DIR}/resource.rc_mac_dlg.h)
endif()