Skip to content

Commit

Permalink
cmake link condition
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya-ai committed May 2, 2024
1 parent 6d74ab8 commit 77664d0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,55 @@ jobs:
name: soh-linux
path: build-cmake/src/*.a
if-no-files-found: error
build-linux-no-mpq:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.11
with:
key: ${{ matrix.os }}-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.os }}-ccache-${{ github.ref }}
${{ matrix.os }}-ccache-
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://www.libsdl.org/release/SDL2-2.24.1.tar.gz
tar -xzf SDL2-2.24.1.tar.gz
cd SDL2-2.24.1
./configure
make -j 10
sudo make install
- name: Install latest tinyxml2
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
cd tinyxml2-10.0.0
mkdir build
cd build
cmake ..
make
sudo make install
- name: Build libultraship
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DEXCLUDE_MPQ_SUPPORT=TRUE
cmake --build build-cmake --config Release --parallel 10
env:
CC: gcc-10
CXX: g++-10
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: soh-linux
path: build-cmake/src/*.a
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
Expand Down
12 changes: 7 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ target_include_directories(libultraship
)

#=================== Linking ===================

if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(libultraship PUBLIC "$<LINK_LIBRARY:WHOLE_ARCHIVE,storm>")
else()
target_link_libraries(libultraship PUBLIC storm)
if(NOT EXCLUDE_MPQ_SUPPORT)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_link_libraries(libultraship PUBLIC "$<LINK_LIBRARY:WHOLE_ARCHIVE,storm>")
else()
target_link_libraries(libultraship PUBLIC storm)
endif()
endif()

target_link_libraries(libultraship
PRIVATE StrHash64
PUBLIC ImGui
Expand Down

0 comments on commit 77664d0

Please sign in to comment.