Skip to content

Commit 77664d0

Browse files
committed
cmake link condition
1 parent 6d74ab8 commit 77664d0

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

.github/workflows/build-validation.yml

+49
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,55 @@ jobs:
104104
name: soh-linux
105105
path: build-cmake/src/*.a
106106
if-no-files-found: error
107+
build-linux-no-mpq:
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v2
111+
- name: Install dependencies
112+
run: |
113+
sudo apt-get update
114+
sudo apt-get install -y $(cat .github/workflows/apt-deps.txt)
115+
- name: ccache
116+
uses: hendrikmuhs/[email protected]
117+
with:
118+
key: ${{ matrix.os }}-ccache-${{ github.ref }}-${{ github.sha }}
119+
restore-keys: |
120+
${{ matrix.os }}-ccache-${{ github.ref }}
121+
${{ matrix.os }}-ccache-
122+
- name: Install latest SDL
123+
run: |
124+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
125+
wget https://www.libsdl.org/release/SDL2-2.24.1.tar.gz
126+
tar -xzf SDL2-2.24.1.tar.gz
127+
cd SDL2-2.24.1
128+
./configure
129+
make -j 10
130+
sudo make install
131+
- name: Install latest tinyxml2
132+
run: |
133+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
134+
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
135+
tar -xzf 10.0.0.tar.gz
136+
cd tinyxml2-10.0.0
137+
mkdir build
138+
cd build
139+
cmake ..
140+
make
141+
sudo make install
142+
- name: Build libultraship
143+
run: |
144+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
145+
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DEXCLUDE_MPQ_SUPPORT=TRUE
146+
cmake --build build-cmake --config Release --parallel 10
147+
env:
148+
CC: gcc-10
149+
CXX: g++-10
150+
- name: Upload build
151+
uses: actions/upload-artifact@v3
152+
with:
153+
name: soh-linux
154+
path: build-cmake/src/*.a
155+
if-no-files-found: error
107156
build-windows:
108157
runs-on: windows-latest
109158
steps:

src/CMakeLists.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,14 @@ target_include_directories(libultraship
167167
)
168168

169169
#=================== Linking ===================
170-
171-
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
172-
target_link_libraries(libultraship PUBLIC "$<LINK_LIBRARY:WHOLE_ARCHIVE,storm>")
173-
else()
174-
target_link_libraries(libultraship PUBLIC storm)
170+
if(NOT EXCLUDE_MPQ_SUPPORT)
171+
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
172+
target_link_libraries(libultraship PUBLIC "$<LINK_LIBRARY:WHOLE_ARCHIVE,storm>")
173+
else()
174+
target_link_libraries(libultraship PUBLIC storm)
175+
endif()
175176
endif()
177+
176178
target_link_libraries(libultraship
177179
PRIVATE StrHash64
178180
PUBLIC ImGui

0 commit comments

Comments
 (0)