Skip to content

Commit

Permalink
add scripts to build astcenc
Browse files Browse the repository at this point in the history
  • Loading branch information
matyalatte committed Mar 22, 2024
1 parent be430e2 commit b995e64
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ htmlcov
# scripts
*.bat
*.sh
!external/build*.*

# textures
*.dds
Expand All @@ -30,4 +31,4 @@ htmlcov

# doc
*.txt
!changelog.txt
!changelog.txt
25 changes: 25 additions & 0 deletions external/build_astcenc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off

REM Builds texconv.dll with CMake and Visual Studio.
REM texconv.dll will be generated in ..\

set VS_VERSION=Visual Studio 17 2022

@pushd %~dp0\astc-encoder\
mkdir build
cd build

cmake -G "%VS_VERSION%"^
-A x64^
-D CMAKE_CONFIGURATION_TYPES=Release^
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL^
-D ASTCENC_CLI=OFF^
-D ASTCENC_ISA_SSE2=ON^
-D ASTCENC_SHAREDLIB=ON^
../

cmake --build . --config Release
copy Source\Release\astcenc-sse2-shared.dll ..\
@popd

pause
17 changes: 17 additions & 0 deletions external/build_astcenc_Linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Builds astc-encoder with cmake on Linux.
# libastc-sse2-shared.so will be generated in ./astc-encoder/

pushd $(dirname "$0")/astc-encoder/
mkdir build
cd build
cmake \
-D CMAKE_BUILD_TYPE=Release\
-D CMAKE_POSITION_INDEPENDENT_CODE=ON\
-D ASTCENC_CLI=OFF\
-D ASTCENC_ISA_SSE2=ON\
-D ASTCENC_SHAREDLIB=ON\
../
cmake --build .
cp Source/libastcenc-sse2-shared.so ../
popd
13 changes: 13 additions & 0 deletions external/build_astcenc_macOS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Builds astc-encoder with cmake on macOS.
# libastc-shared.dylib will be generated in ./astc-encoder/

pushd $(dirname "$0")/astc-encoder/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_POSITION_INDEPENDENT_CODE=ON -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15 -D ASTCENC_CLI=OFF -D ASTCENC_SHAREDLIB=ON ../
cmake --build .
cd Source
lipo -create -output libastcenc-shared.dylib -arch x86_64 libastcenc-sse4.1-shared.dylib -arch x86_64h libastcenc-avx2-shared.dylib -arch arm64 libastcenc-neon-shared.dylib
cp libastcenc-shared.dylib ../../
popd

0 comments on commit b995e64

Please sign in to comment.