Build soh.o2r in CI without libultraship or soh

SOH_TOOLS_ONLY returns from the root CMakeLists once the asset tools are
declared, before libultraship and soh are added, so a configure that only
needs soh-o2r-packer never reaches LUS's find_package(SDL2 REQUIRED).

That lets generate-soh-otr drop building SDL2 from source, SDL2_net, and
the deps cache that existed to hold the SDL2 tarball -- eleven steps down
to six. Verified a tools-only build produces the archive with all 1,042
entries matching.

The tool targets move above the sub-projects so the early return can sit
between them; they only ever needed torch. The packer creates its output
directory, which previously came for free from soh's build directory.
This commit is contained in:
briaguya
2026-07-25 03:55:59 -04:00
parent 3addd51bbc
commit 5730fdb73d
3 changed files with 31 additions and 49 deletions
+1 -28
View File
@@ -26,40 +26,13 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y $(cat linux-build-deps/apt.txt)
- name: Restore Cached deps folder
uses: actions/cache/restore@v5
with:
key: ${{ runner.os }}-deps-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-deps-${{ github.ref }}-
${{ runner.os }}-deps-
path: deps
- name: Create deps folder
run: mkdir -p deps
- name: Add ccache to PATH
run: |
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
echo "/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH"
- name: Install latest SDL
run: |
if [ ! -d "deps/SDL2-2.30.3" ]; then
wget https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-2.30.3.tar.gz
tar -xzf SDL2-2.30.3.tar.gz -C deps
fi
cd deps/SDL2-2.30.3
./configure --enable-hidapi-libusb
make -j 10
sudo make install
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- uses: ./.github/actions/install-sdl2-net
- name: Copy SDL libs to multiarch dir
run: sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- name: Remove distro tinyxml2
run: sudo apt-get remove libtinyxml2-dev
- uses: ./.github/actions/install-tinyxml2
- name: Generate soh.o2r
run: |
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DSOH_TOOLS_ONLY=ON
cmake --build build-cmake --config Release --target GenerateSohOtr -j3
- name: Upload soh.o2r
uses: actions/upload-artifact@v7
+29 -21
View File
@@ -216,27 +216,6 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(torch)
################################################################################
# Sub-projects
################################################################################
add_subdirectory(libultraship ${CMAKE_BINARY_DIR}/libultraship)
target_compile_options(libultraship PRIVATE "${WARNING_OVERRIDE}")
target_compile_definitions(libultraship PUBLIC INCLUDE_MPQ_SUPPORT)
add_subdirectory(soh)
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES)
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.desktop")
set_property(TARGET soh PROPERTY APPIMAGE_ICON_FILE "${CMAKE_BINARY_DIR}/sohIcon.png")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
install(FILES "${CMAKE_BINARY_DIR}/soh/soh.o2r" DESTINATION . COMPONENT ship)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/soh/assets/yml/" DESTINATION ./assets COMPONENT ship)
endif()
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/soh/assets/yml/" DESTINATION ./assets COMPONENT ship)
endif()
# Build-time ROM extraction. soh links torch as a static library, which compiles out torch's
# own CLI, so this supplies an entry point around the same code the game runs.
add_executable(soh-torch
@@ -301,6 +280,35 @@ add_custom_target(
# ExtractAssets produced soh.o2r as well as the rom archives, so keep doing that.
add_dependencies(ExtractAssets GenerateSohOtr)
# The asset tools only need torch, so a tools-only configure can skip libultraship and soh
# entirely -- that is all CI needs to produce soh.o2r.
option(SOH_TOOLS_ONLY "Configure only the asset tools, skipping libultraship and soh" OFF)
if(SOH_TOOLS_ONLY)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/soh)
return()
endif()
################################################################################
# Sub-projects
################################################################################
add_subdirectory(libultraship ${CMAKE_BINARY_DIR}/libultraship)
target_compile_options(libultraship PRIVATE "${WARNING_OVERRIDE}")
target_compile_definitions(libultraship PUBLIC INCLUDE_MPQ_SUPPORT)
add_subdirectory(soh)
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES)
set_property(TARGET soh PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/scripts/linux/appimage/soh.desktop")
set_property(TARGET soh PROPERTY APPIMAGE_ICON_FILE "${CMAKE_BINARY_DIR}/sohIcon.png")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
install(FILES "${CMAKE_BINARY_DIR}/soh/soh.o2r" DESTINATION . COMPONENT ship)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/soh/assets/yml/" DESTINATION ./assets COMPONENT ship)
endif()
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/soh/assets/yml/" DESTINATION ./assets COMPONENT ship)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(ImageMagick COMPONENTS convert)
if (ImageMagick_FOUND)
+1
View File
@@ -67,6 +67,7 @@ int main(int argc, char** argv) {
fs::copy_file(path, stage / rel, fs::copy_options::overwrite_existing);
}
fs::create_directories(outPath.parent_path(), ec);
fs::remove(outPath, ec);
Companion::Pack(stage.string(), outPath.string(), ArchiveType::O2R, version);
fs::remove_all(stage, ec);