-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] base setup for basis universal
- Loading branch information
1 parent
66e4b34
commit edda5bf
Showing
10 changed files
with
1,255 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ DerivedData | |
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
cpp/basisu | ||
|
||
# Android/IJ | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "externals/basis_universal"] | ||
path = externals/basis_universal | ||
url = https://github.com/BinomialLLC/basis_universal.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule basis_universal
added at
6775d3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const { $, cd } = require('zx'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const serializeCMakeArgs = (args: Record<string, string>) => { | ||
return Object.keys(args) | ||
.map((key) => `-D${key}=${args[key]}`) | ||
.join(' '); | ||
}; | ||
|
||
const CMAKE_ARGS = { | ||
CMAKE_BUILD_TYPE: 'RELEASE', | ||
// CMAKE_TOOLCHAIN_FILE: `${__dirname}/apple.toolchain.cmake`, | ||
}; | ||
|
||
const PLATFORM_MAP: Record<string, string> = { | ||
arm64_iphoneos: 'OS64', | ||
arm64_iphonesimulator: 'SIMULATORARM64', | ||
x86_64_iphonesimulator: 'SIMULATOR64', | ||
}; | ||
|
||
const apple = { | ||
arm64: ['iphonesimulator', 'iphoneos'], | ||
x86_64: ['iphonesimulator'], | ||
}; | ||
|
||
const buildStaticLibs = async (platform: string) => { | ||
const baseDir = 'externals/basis_universal/out'; | ||
const dirPath = path.join(baseDir, platform); | ||
fs.mkdirSync(dirPath, { recursive: true }); | ||
cd(`${__dirname}/../externals/basis_universal/out/${platform}`); | ||
await $`cmake -S ../.. -G Ninja -DPLATFORM=${PLATFORM_MAP[platform]} ${serializeCMakeArgs(CMAKE_ARGS)} && ninja`; | ||
}; | ||
|
||
const copyHeaders = async () => { | ||
cd(`${__dirname}/..`); | ||
fs.mkdirSync('cpp/basisu/encoder', { recursive: true }); | ||
fs.mkdirSync('cpp/basisu/transcoder', { recursive: true }); | ||
$`cp -r externals/basis_universal/encoder/*.h cpp/basisu/encoder`; | ||
$`cp -r externals/basis_universal/transcoder/*.h cpp/basisu/transcoder`; | ||
}; | ||
|
||
const main = () => { | ||
for (const [arch, platforms] of Object.entries(apple)) { | ||
for (const platform of platforms) { | ||
const platformName = `${arch}_${platform}`; | ||
buildStaticLibs(platformName); | ||
} | ||
} | ||
copyHeaders(); | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters