Skip to content

Commit 61121e8

Browse files
committed
with sdl3
1 parent ce70cc4 commit 61121e8

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

build-cmd.sh

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,121 @@ case "$AUTOBUILD_PLATFORM" in
164164
esac
165165
popd
166166

167+
# SDL3
168+
pushd "$TOP/SDL3"
169+
170+
case "$AUTOBUILD_PLATFORM" in
171+
windows*)
172+
load_vsvars
173+
174+
mkdir -p "$stage/include/SDL3"
175+
mkdir -p "$stage/lib/debug"
176+
mkdir -p "$stage/lib/release"
177+
178+
mkdir -p "build_debug"
179+
pushd "build_debug"
180+
cmake .. -G "Ninja" -DCMAKE_INSTALL_PREFIX=$(cygpath -m $stage)/debug
181+
182+
cmake --build . --config Debug
183+
cmake --install . --config Debug
184+
185+
# conditionally run unit tests
186+
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
187+
ctest -C Debug
188+
fi
189+
190+
cp $stage/debug/bin/*.dll $stage/lib/debug/
191+
cp $stage/debug/lib/*.lib $stage/lib/debug/
192+
popd
193+
194+
mkdir -p "build_release"
195+
pushd "build_release"
196+
cmake .. -G "Ninja" -DCMAKE_INSTALL_PREFIX=$(cygpath -m $stage)/release
197+
198+
cmake --build . --config Release
199+
cmake --install . --config Release
200+
201+
# conditionally run unit tests
202+
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
203+
ctest -C Release
204+
fi
205+
206+
cp $stage/release/bin/*.dll $stage/lib/release/
207+
cp $stage/release/lib/*.lib $stage/lib/release/
208+
cp $stage/release/include/SDL3/*.h $stage/include/SDL3/
209+
popd
210+
;;
211+
darwin*)
212+
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"
213+
214+
for arch in x86_64 arm64 ; do
215+
ARCH_ARGS="-arch $arch"
216+
opts="${TARGET_OPTS:-$ARCH_ARGS $LL_BUILD_RELEASE}"
217+
cc_opts="$(remove_cxxstd $opts)"
218+
ld_opts="$ARCH_ARGS"
219+
220+
mkdir -p "build_$arch"
221+
pushd "build_$arch"
222+
CFLAGS="$cc_opts" \
223+
CXXFLAGS="$opts" \
224+
LDFLAGS="$ld_opts" \
225+
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Release" \
226+
-DCMAKE_C_FLAGS="$cc_opts" \
227+
-DCMAKE_CXX_FLAGS="$opts" \
228+
-DCMAKE_OSX_ARCHITECTURES:STRING="$arch" \
229+
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
230+
-DCMAKE_MACOSX_RPATH=YES \
231+
-DCMAKE_INSTALL_PREFIX="$stage" \
232+
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release/$arch"
233+
234+
cmake --build . --config Release
235+
cmake --install . --config Release
236+
popd
237+
done
238+
239+
240+
# create universal libraries
241+
lipo -create -output ${stage}/lib/release/libSDL3.0.dylib ${stage}/lib/release/x86_64/libSDL3.0.dylib ${stage}/lib/release/arm64/libSDL3.0.dylib
242+
lipo -create -output ${stage}/lib/release/libSDL3.dylib ${stage}/lib/release/x86_64/libSDL3.dylib ${stage}/lib/release/arm64/libSDL3.dylib
243+
lipo -create -output ${stage}/lib/release/libSDL3_test.a ${stage}/lib/release/x86_64/libSDL3_test.a ${stage}/lib/release/arm64/libSDL3_test.a
244+
245+
pushd "${stage}/lib/release"
246+
install_name_tool -id "@rpath/libSDL3.dylib" "libSDL3.dylib"
247+
dsymutil libSDL3.dylib
248+
strip -x -S libSDL3.dylib
249+
popd
250+
;;
251+
linux*)
252+
# Default target per autobuild build --address-size
253+
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"
254+
255+
mkdir -p "$stage/include/SDL3"
256+
mkdir -p "$stage/lib/release"
257+
258+
PREFIX_RELEASE="$stage/temp_release"
259+
mkdir -p $PREFIX_RELEASE
260+
261+
mkdir -p "build_release"
262+
pushd "build_release"
263+
cmake .. -GNinja -DCMAKE_BUILD_TYPE="Release" \
264+
-DCMAKE_C_FLAGS="$(remove_cxxstd $opts)" \
265+
-DCMAKE_CXX_FLAGS="$opts" \
266+
-DCMAKE_INSTALL_PREFIX=$PREFIX_RELEASE
267+
268+
cmake --build . --config Release
269+
cmake --install . --config Release
270+
popd
271+
272+
cp -a $PREFIX_RELEASE/include/SDL3/*.* $stage/include/SDL3
273+
cp -a $PREFIX_RELEASE/lib/*.so* $stage/lib/release
274+
cp -a $PREFIX_RELEASE/lib/lib*.a $stage/lib/release
275+
;;
276+
277+
*)
278+
exit -1
279+
;;
280+
esac
281+
popd
282+
167283
mkdir -p "$stage/LICENSES"
168284
cp "$TOP/$SDL_SOURCE_DIR/LICENSE.txt" "$stage/LICENSES/SDL2.txt"

0 commit comments

Comments
 (0)