Skip to content

Commit 3524703

Browse files
committed
Enable BC7 texture compression with cross compiled ISPC
1 parent 31695b5 commit 3524703

File tree

9 files changed

+256
-28
lines changed

9 files changed

+256
-28
lines changed

.github/workflows/apple.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ jobs:
2929
uses: ASzc/change-string-case-action@v1
3030
with:
3131
string: ${{ matrix.platform }}
32-
- name: Download cctools
32+
- name: Download cctools and ISPC
3333
run: |
3434
cd /opt
3535
wget https://github.com/supertuxkart/dependencies/releases/download/cctools/cctools-14.1.tar.xz
3636
tar xf cctools-14.1.tar.xz
3737
rm cctools-14.1.tar.xz
38+
wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz
39+
tar xf ispc-cross-1.26.0.tar.xz
40+
rm ispc-cross-1.26.0.tar.xz
3841
- name: Restore timestamps
3942
run: |
4043
wget https://github.com/MestreLion/git-tools/archive/refs/heads/main.zip
@@ -86,7 +89,8 @@ jobs:
8689
mkdir -p build
8790
cd build
8891
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_ARCH=${{ matrix.arch }} -DCCTOOLS_PLATFORM=${{ matrix.platform }} \
89-
-DRT=/opt/cctools/darwin/libclang_rt.${{ env.rt }}.a -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cctools.cmake -DCHECK_ASSETS=OFF
92+
-DRT=/opt/cctools/darwin/libclang_rt.${{ env.rt }}.a -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cctools.cmake -DCHECK_ASSETS=OFF \
93+
-DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc
9094
- name: Build
9195
run: |
9296
cd build
@@ -132,26 +136,25 @@ jobs:
132136
echo "${{ env.release_pre }}"
133137
- name: Download binaries
134138
uses: actions/download-artifact@v4
135-
- name: Mask developer name
136-
run: |
137-
echo "::add-mask::${{ secrets.MAC_DEVELOPER_NAME }}"
138-
- name: Import certificates
139-
if: ${{ env.release_tag != '' }}
140-
uses: apple-actions/import-codesign-certs@v1
141-
with:
142-
p12-file-base64: ${{ secrets.MAC_DEVELOPER_ID_P12_FILE }}
143-
p12-password: ${{ secrets.MAC_DEVELOPER_ID_P12_PASSWORD }}
139+
#- name: Mask developer name
140+
# run: |
141+
# echo "::add-mask::${{ secrets.MAC_DEVELOPER_NAME }}"
142+
#- name: Import certificates
143+
# if: ${{ env.release_tag != '' }}
144+
# uses: apple-actions/import-codesign-certs@v1
145+
# with:
146+
# p12-file-base64: ${{ secrets.MAC_DEVELOPER_ID_P12_FILE }}
147+
# p12-password: ${{ secrets.MAC_DEVELOPER_ID_P12_PASSWORD }}
144148
- name: Run dylibbundler and sign STK
145149
if: ${{ env.release_tag != '' }}
146-
env:
147-
developer_id: "Developer ID Application: ${{ secrets.MAC_DEVELOPER_NAME }} (${{ secrets.MAC_DEVELOPER_TEAM }})"
150+
# env:
151+
# developer_id: "Developer ID Application: ${{ secrets.MAC_DEVELOPER_NAME }} (${{ secrets.MAC_DEVELOPER_TEAM }})"
148152
run: |
149153
wget https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-macosx.tar.xz
150154
tar xf dependencies-macosx.tar.xz
151155
HOMEBREW_NO_AUTO_UPDATE=1 brew install dylibbundler
152156
lipo -create ./macosx-x86_64/supertuxkart.app/Contents/MacOS/supertuxkart ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -output ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart
153157
chmod 755 ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart
154-
install_name_tool -change libcurl.4.dylib @rpath/libcurl.4.dylib ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart
155158
install_name_tool -delete_rpath @loader_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib
156159
install_name_tool -delete_rpath @executable_path/Frameworks ./dependencies-macosx/lib/libSDL2.dylib
157160
dylibbundler -od -b -x ./macosx-arm64/supertuxkart.app/Contents/MacOS/supertuxkart -d ./macosx-arm64/supertuxkart.app/Contents/libs/ -p @executable_path/../libs/ -s ./dependencies-macosx/lib -ns
@@ -163,16 +166,19 @@ jobs:
163166
rm stk-assets-full.zip
164167
cd ../../../../..
165168
mv ./macosx-arm64/supertuxkart.app SuperTuxKart.app
166-
codesign --force --sign "$developer_id" SuperTuxKart.app/Contents/libs/*.dylib
167-
codesign --force --options=runtime --deep --sign "$developer_id" SuperTuxKart.app
168-
- name: "Notarize release build"
169-
if: ${{ env.release_tag != '' && github.ref != 'refs/heads/master' }}
170-
run: |
171-
ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app tmp.zip
172-
xcrun notarytool submit tmp.zip --apple-id ${{ secrets.STK_NOTARIZATION_USERNAME }} \
173-
--password ${{ secrets.STK_NOTARIZATION_PASSWORD }} \
174-
--team-id ${{ secrets.MAC_DEVELOPER_TEAM }} --wait
175-
xcrun stapler staple SuperTuxKart.app
169+
# Use Ad Hoc certificate for now, previous certificate has been expired.
170+
codesign --force -s - SuperTuxKart.app/Contents/libs/*.dylib
171+
codesign --force --deep -s - SuperTuxKart.app
172+
#codesign --force --sign "$developer_id" SuperTuxKart.app/Contents/libs/*.dylib
173+
#codesign --force --options=runtime --deep --sign "$developer_id" SuperTuxKart.app
174+
#- name: "Notarize release build"
175+
# if: ${{ env.release_tag != '' && github.ref != 'refs/heads/master' }}
176+
# run: |
177+
# ditto -c -k --sequesterRsrc --keepParent SuperTuxKart.app tmp.zip
178+
# xcrun notarytool submit tmp.zip --apple-id ${{ secrets.STK_NOTARIZATION_USERNAME }} \
179+
# --password ${{ secrets.STK_NOTARIZATION_PASSWORD }} \
180+
# --team-id ${{ secrets.MAC_DEVELOPER_TEAM }} --wait
181+
# xcrun stapler staple SuperTuxKart.app
176182
- name: Archive
177183
if: ${{ env.release_tag != '' }}
178184
run: |

.github/workflows/windows.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ jobs:
7878
run: |
7979
${{ env.wget }} https://github.com/supertuxkart/dependencies/releases/download/preview/dependencies-win-${{ matrix.arch }}.zip
8080
${{ env.unzip }} dependencies-win-${{ matrix.arch }}.zip
81+
- name: Download ISPC for MinGW
82+
if: ${{ matrix.os == 'ubuntu-latest' }}
83+
run: |
84+
cd /opt
85+
wget https://github.com/supertuxkart/dependencies/releases/download/preview/ispc-cross-1.26.0.tar.xz
86+
tar xf ispc-cross-1.26.0.tar.xz
87+
rm ispc-cross-1.26.0.tar.xz
8188
- name: Install MinGW for i686 or x86_64
8289
if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'i686' || matrix.arch == 'x86_64' ) }}
8390
run: |
@@ -108,6 +115,7 @@ jobs:
108115
echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake
109116
echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake
110117
echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake
118+
echo 'set(ISPC_ARCH "x86")' >> toolchain.cmake
111119
- name: Set up MinGW Toolchain for x86_64
112120
if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64' }}
113121
run: |
@@ -119,6 +127,7 @@ jobs:
119127
echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake
120128
echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)" >> toolchain.cmake
121129
echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake
130+
echo 'set(ISPC_ARCH "x86-64")' >> toolchain.cmake
122131
# Manually specify CMAKE_SYSTEM_PROCESSOR, it can only be set together with -DDCMAKE_SYSTEM_NAME
123132
- name: Configure bulid for MSVC
124133
if: ${{ matrix.os == 'windows-latest' }}
@@ -131,13 +140,13 @@ jobs:
131140
run: |
132141
mkdir -p build
133142
cd build
134-
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON
143+
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc
135144
- name: Configure bulid for MinGW (armv7 or aarch64)
136145
if: ${{ matrix.os == 'ubuntu-latest' && ( matrix.arch == 'armv7' || matrix.arch == 'aarch64' ) }}
137146
run: |
138147
mkdir -p build
139148
cd build
140-
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON
149+
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=/llvm-mingw -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCHECK_ASSETS=OFF -DUSE_DIRECTX=ON -DBC7_ISPC=ON -DCMAKE_ISPC_COMPILER=/opt/ispc/bin/ispc
141150
- name: Build for MSVC
142151
if: ${{ matrix.os == 'windows-latest' }}
143152
working-directory: build

cmake/Toolchain-cctools.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,11 @@ set(USE_WIIUSE FALSE CACHE BOOL "")
4646
set(USE_SQLITE3 FALSE CACHE BOOL "")
4747
set(IOS TRUE CACHE BOOL "")
4848
endif()
49+
50+
if(CCTOOLS_ARCH MATCHES "x86_64")
51+
set(ISPC_ARCH "x86-64")
52+
elseif(CCTOOLS_ARCH MATCHES "arm64")
53+
set(ISPC_ARCH "aarch64")
54+
else()
55+
set(ISPC_ARCH unknown)
56+
endif()

cmake/Toolchain-llvm-mingw.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@ SET(CMAKE_FIND_ROOT_PATH ${LLVM_PREFIX}/generic-w64-mingw32 ${LLVM_PREFIX}/${LLV
2626
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
2727
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
2828
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
29+
30+
if(LLVM_ARCH MATCHES "i686")
31+
set(ISPC_ARCH x86)
32+
elseif(LLVM_ARCH MATCHES "x86_64")
33+
set(ISPC_ARCH "x86-64")
34+
elseif(LLVM_ARCH MATCHES "armv7")
35+
# ISPC doesn't support armv7 windows
36+
set(ISPC_ARCH unknown)
37+
else()
38+
set(ISPC_ARCH ${LLVM_ARCH})
39+
endif()

cmake/Toolchain-mingw-64bit.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /usr/x86_64-w64-mingw32/lib /us
2121
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
2222
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
2323
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
24+
25+
set(ISPC_ARCH "x86-64")

cmake/Toolchain-mingw.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/i686-w64-mingw32/lib /usr/li
2121
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
2222
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
2323
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
24+
25+
set(ISPC_ARCH "x86")

lib/graphics_engine/CMakeLists.txt

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,56 @@ if(NOT APPLE OR DLOPEN_MOLTENVK)
105105
endif()
106106

107107
option(BC7_ISPC "Enable BC7 (BPTC) support (requires ispc and cmake >= 3.19)" OFF)
108-
if(BC7_ISPC)
108+
if(BC7_ISPC AND NOT ISPC_ARCH MATCHES "unknown")
109109
add_definitions(-DBC7_ISPC)
110110
enable_language(ISPC)
111111
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --opt=fast-math --opt=disable-assertions --pic")
112+
if(ISPC_ARCH)
113+
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --arch=${ISPC_ARCH}")
114+
endif()
115+
if(WIN32)
116+
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --target-os=windows")
117+
elseif(IOS)
118+
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --target-os=ios")
119+
elseif(APPLE)
120+
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --target-os=macos")
121+
else()
122+
set(CMAKE_ISPC_FLAGS "${CMAKE_ISPC_FLAGS} --target-os=linux")
123+
endif()
112124
set(GE_SOURCES
113125
${GE_SOURCES}
114126
src/bc7e.ispc
115127
)
128+
if (MINGW AND NOT ISPC_ARCH MATCHES "aarch64")
129+
enable_language(ASM)
130+
set(GE_SOURCES
131+
${GE_SOURCES}
132+
src/libchkstk.S)
133+
if(LLVM_PREFIX)
134+
set_source_files_properties(src/libchkstk.S PROPERTIES COMPILE_FLAGS "-DCHKSTK")
135+
else()
136+
set_source_files_properties(src/libchkstk.S PROPERTIES COMPILE_FLAGS "-DCHKSTK -Wa,--no-pad-sections")
137+
endif()
138+
set_source_files_properties(src/libchkstk.S PROPERTIES LANGUAGE ASM)
139+
endif()
116140
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
117141
endif()
118142

119143
add_library(graphics_engine STATIC ${GE_SOURCES})
120144
if(BC7_ISPC)
121-
set_property(TARGET graphics_engine PROPERTY ISPC_INSTRUCTION_SETS avx2)
145+
if(ISPC_ARCH MATCHES "aarch64")
146+
set_property(TARGET graphics_engine PROPERTY ISPC_INSTRUCTION_SETS neon)
147+
else()
148+
set_property(TARGET graphics_engine PROPERTY ISPC_INSTRUCTION_SETS avx2)
149+
endif()
122150
endif()
123151

124152
target_link_libraries(graphics_engine ${SQUISH_LIBRARY})
125153

154+
if(BC7_ISPC AND LLVM_PREFIX AND NOT ISPC_ARCH MATCHES "unknown")
155+
target_link_libraries(graphics_engine ntdllcrt)
156+
endif()
157+
126158
if(ENABLE_LIBASTCENC)
127159
target_link_libraries(graphics_engine ${LIBASTCENC_LIBRARY})
128160
endif()

lib/graphics_engine/src/libchkstk.S

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#if 0
2+
# Implementations of ___chkstk_ms (GCC) and __chkstk (MSVC). Unlike
3+
# libgcc, no work happens if the stack is already committed. Execute
4+
# this source with a shell to build libchkstk.a.
5+
# This is free and unencumbered software released into the public domain.
6+
set -ex
7+
${CC:-cc} -c -DCHKSTK_MS -Wa,--no-pad-sections -o chkstk_ms.o $0
8+
${CC:-cc} -c -DCHKSTK -Wa,--no-pad-sections -o chkstk.o $0
9+
rm -f "${DESTDIR}libchkstk.a"
10+
${AR:-ar} r "${DESTDIR}libchkstk.a" chkstk_ms.o chkstk.o
11+
rm chkstk_ms.o chkstk.o
12+
exit 0
13+
#endif
14+
15+
#if __amd64
16+
// On x64, ___chkstk_ms and __chkstk have identical semantics. Unlike
17+
// x86 __chkstk, neither adjusts the stack pointer. This implementation
18+
// preserves all registers.
19+
//
20+
// The frame size is passed in rax, and this function ensures that
21+
// enough of the stack is committed for the frame. It commits stack
22+
// pages by writing to the guard page, one page at a time.
23+
# if CHKSTK_MS
24+
.globl ___chkstk_ms
25+
___chkstk_ms:
26+
# elif CHKSTK
27+
.globl __chkstk
28+
__chkstk:
29+
# endif
30+
push %rax
31+
push %rcx
32+
mov %gs:(0x10), %rcx // rcx = stack low address
33+
neg %rax // rax = frame low address
34+
add %rsp, %rax // "
35+
jb 1f // frame low address overflow?
36+
xor %eax, %eax // overflowed: frame low address = null
37+
0: sub $0x1000, %rcx // extend stack into guard page
38+
test %eax, (%rcx) // commit page (two instruction bytes)
39+
1: cmp %rax, %rcx
40+
ja 0b
41+
pop %rcx
42+
pop %rax
43+
ret
44+
#endif // __amd64
45+
46+
#if __i386
47+
# if CHKSTK_MS
48+
// Behaves exactly like x64 ___chkstk_ms.
49+
.globl ___chkstk_ms
50+
___chkstk_ms:
51+
push %eax
52+
push %ecx
53+
mov %fs:(0x08), %ecx // ecx = stack low address
54+
neg %eax // eax = frame low address
55+
add %esp, %eax // "
56+
jb 1f // frame low address overflow?
57+
xor %eax, %eax // overflowed: frame low address = null
58+
0: sub $0x1000, %ecx // extend stack into guard page
59+
test %eax, (%ecx) // commit page (two instruction bytes)
60+
1: cmp %eax, %ecx
61+
ja 0b
62+
pop %ecx
63+
pop %eax
64+
ret
65+
# elif CHKSTK
66+
// On x86, __chkstk allocates the new stack frame. This implementation
67+
// clobbers eax. MSVC only seems to care about ebp and ecx (this).
68+
.globl __chkstk
69+
__chkstk:
70+
push %ecx // preserve ecx
71+
mov %fs:(0x08), %ecx // ecx = stack low address
72+
neg %eax // eax = frame low address
73+
lea 8(%esp,%eax), %eax // "
74+
cmp %esp, %eax // frame low address overflow?
75+
jb 1f // "
76+
xor %eax, %eax // overflowed: frame low address = null
77+
0: sub $0x1000, %ecx // extend stack into guard page
78+
test %eax, (%ecx) // commit page (two instruction bytes)
79+
1: cmp %eax, %ecx
80+
ja 0b
81+
pop %ecx // restore ecx
82+
xchg %eax, %esp // allocate frame
83+
jmp *(%eax) // return
84+
# endif
85+
#endif // __i386

tools/build-cross-ispc.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
# Tested in Ubuntu Server 24.04.2 LTS
3+
4+
patch_file=$(mktemp)
5+
cat << 'EOF' > "$patch_file"
6+
diff --git a/CMakeLists.txt b/CMakeLists.txt
7+
index af9769a..3279caf 100644
8+
--- a/CMakeLists.txt
9+
+++ b/CMakeLists.txt
10+
@@ -131,9 +131,7 @@ if (ISPC_CROSS)
11+
message(STATUS "Using iOS SDK path ${ISPC_IOS_SDK_PATH}")
12+
endif()
13+
else()
14+
- set(ISPC_WINDOWS_TARGET OFF)
15+
set(ISPC_PS_TARGET OFF)
16+
- set(ISPC_IOS_TARGET OFF)
17+
if (ISPC_MACOS_TARGET AND NOT ISPC_MACOS_SDK_PATH)
18+
message (FATAL_ERROR "Set ISPC_MACOS_SDK_PATH variable for cross compilation to MacOS e.g. /iusers/MacOSX10.14.sdk")
19+
endif()
20+
diff --git a/builtins/builtins-c-cpu.cpp b/builtins/builtins-c-cpu.cpp
21+
index 140419c..65b4f8e 100644
22+
--- a/builtins/builtins-c-cpu.cpp
23+
+++ b/builtins/builtins-c-cpu.cpp
24+
@@ -39,11 +39,11 @@
25+
// In unistd.h we need the definition of sysconf and _SC_NPROCESSORS_ONLN used as its arguments.
26+
// We should include unistd.h, but it doesn't really work well for cross compilation, as
27+
// requires us to carry around unistd.h, which is not available on Windows out of the box.
28+
-#include <unistd.h>
29+
+//#include <unistd.h>
30+
31+
// Just for the reference: these lines are eventually included from unistd.h
32+
-// #define _SC_NPROCESSORS_ONLN 58
33+
-// long sysconf(int);
34+
+ #define _SC_NPROCESSORS_ONLN 58
35+
+ long sysconf(int);
36+
#endif // !_MSC_VER
37+
38+
#endif // !WASM
39+
diff --git a/cmake/GenerateBuiltins.cmake b/cmake/GenerateBuiltins.cmake
40+
index f403b16..56961d6 100644
41+
--- a/cmake/GenerateBuiltins.cmake
42+
+++ b/cmake/GenerateBuiltins.cmake
43+
@@ -253,6 +253,10 @@ function (get_target_flags os arch out)
44+
if (${os} STREQUAL "macos")
45+
# -isystem/iusers/MacOSX10.14.sdk.tar/MacOSX10.14.sdk/usr/include
46+
set(include -isystem${ISPC_MACOS_SDK_PATH}/usr/include)
47+
+ elseif (${os} STREQUAL "ios")
48+
+ set(include -isystem${ISPC_IOS_SDK_PATH}/usr/include)
49+
+ elseif (${os} STREQUAL "windows")
50+
+ set(include -I/usr/include)
51+
elseif(NOT ${debian_triple} STREQUAL "")
52+
# When compiling on Linux, there are two way to support cross targets:
53+
# - add "foreign" architecture to the set of supported architectures and install corresponding toolchain.
54+
EOF
55+
56+
apt-get update
57+
apt install -y build-essential llvm cmake clang m4 bison flex libtbb-dev libclang-18-dev libclang-cpp-dev gcc-multilib g++-multilib
58+
cd /opt
59+
wget https://github.com/supertuxkart/dependencies/releases/download/cctools/cctools-14.1.tar.xz
60+
tar xf cctools-14.1.tar.xz
61+
rm cctools-14.1.tar.xz
62+
cd
63+
git clone --branch v1.26.0 --depth=1 https://github.com/ispc/ispc
64+
cd ispc
65+
patch -p1 < "$patch_file"
66+
rm "$patch_file"
67+
mkdir build
68+
cd build
69+
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ispc -DISPC_CROSS=ON -DISPC_MACOS_TARGET=ON -DISPC_MACOS_SDK_PATH=/opt/cctools/sdk/MacOSX13.0.sdk -DISPC_IOS_SDK_PATH=/opt/cctools/sdk/iPhoneOS16.1.sdk -DISPC_INCLUDE_TESTS=OFF -DISPC_INCLUDE_EXAMPLES=OFF
70+
make -j18
71+
make install
72+
cd /opt
73+
tar -cJvf /ispc-cross-1.26.0.tar.xz ispc

0 commit comments

Comments
 (0)