Merge branch 'test_macos_action'

This commit is contained in:
2024-10-19 15:41:40 -04:00
5 changed files with 151 additions and 25 deletions

View File

@@ -19,8 +19,22 @@ if [ -f "$path_system_details" ]; then
CoreCount_Physical=$(grep "PhysicalCores" "$path_system_details" | cut -d'=' -f2)
CoreCount_Logical=$(grep "LogicalCores" "$path_system_details" | cut -d'=' -f2)
else
CoreCount_Physical=$(nproc --all)
CoreCount_Logical=$(nproc)
OS=$(uname -s)
case "$OS" in
Darwin*)
CoreCount_Physical=$(sysctl -n hw.physicalcpu)
CoreCount_Logical=$(sysctl -n hw.logicalcpu)
;;
Linux*)
CoreCount_Physical=$(nproc --all)
CoreCount_Logical=$(nproc)
;;
*)
echo "Unsupported operating system: $OS"
CoreCount_Physical=1
CoreCount_Logical=1
;;
esac
echo "[CPU]" > "$path_system_details"
echo "PhysicalCores=$CoreCount_Physical" >> "$path_system_details"
@@ -47,7 +61,19 @@ update_git_repo "$path_sokol" "$url_sokol" "$sokol_build_clibs_command"
update_git_repo "$path_harfbuzz" "$url_harfbuzz" "./scripts/build.sh"
pushd "$path_thirdparty" > /dev/null
path_harfbuzz_dlls="$path_harfbuzz/lib/linux64"
case "$OS" in
Darwin*)
path_harfbuzz_dlls="$path_harfbuzz/lib/osx"
;;
Linux*)
path_harfbuzz_dlls="$path_harfbuzz/lib/linux64"
;;
*)
echo "Unsupported operating system: $OS"
CoreCount_Physical=1
CoreCount_Logical=1
;;
esac
if ls "$path_harfbuzz_dlls"/*.so 1> /dev/null 2>&1; then
cp "$path_harfbuzz_dlls"/*.so "$path_build/"
else

View File

@@ -36,27 +36,45 @@ fi
pushd "$path_sokol"
check_and_install() {
if ! dpkg -s $1 &> /dev/null; then
echo "$1 not found. Attempting to install..."
sudo apt update && sudo apt install -y $1
if [ $? -ne 0 ]; then
echo "Failed to install $1. Please install manually and try again."
exit 1
fi
fi
}
OS=$(uname -s)
case "$OS" in
Linux*)
echo "Detected Linux operating system"
# Check for OpenGL and X11 development libraries
check_and_install() {
if ! dpkg -s $1 &> /dev/null; then
echo "$1 not found. Attempting to install..."
sudo apt update && sudo apt install -y $1
if [ $? -ne 0 ]; then
echo "Failed to install $1. Please install manually and try again."
exit 1
fi
fi
}
# Uncomment these lines if you need to install these dependencies
# check_and_install libgl1-mesa-dev
# check_and_install libx11-dev
# check_and_install libxcursor-dev
# check_and_install libxrandr-dev
# check_and_install libxinerama-dev
# check_and_install libxi-dev
# check_and_install libasound2-dev # ALSA development library
# Check for OpenGL and X11 development libraries
# check_and_install libgl1-mesa-dev
# check_and_install libx11-dev
# check_and_install libxcursor-dev
# check_and_install libxrandr-dev
# check_and_install libxinerama-dev
# check_and_install libxi-dev
# check_and_install libasound2-dev # ALSA development library
# Run the build script
./build_clibs_linux.sh
echo "Running Linux build script..."
./build_clibs_linux.sh
;;
Darwin*)
echo "Detected macOS operating system"
echo "Running macOS build script..."
ls -al
./build_clibs_macos.sh
;;
*)
echo "Unsupported operating system: $OS"
exit 1
;;
esac
popd
echo "Build process completed."

View File

@@ -1,12 +1,28 @@
#!/bin/bash
OS=$(uname -s)
path_root="$(git rev-parse --show-toplevel)"
path_backend="$path_root/backend"
path_scripts="$path_root/scripts"
path_thirdparty="$path_root/thirdparty"
path_sokol_tools="$path_thirdparty/sokol-tools"
sokol_shdc="$path_sokol_tools/bin/linux/sokol-shdc"
case "$OS" in
Darwin*)
sokol_shdc="$path_sokol_tools/bin/osx/sokol-shdc"
;;
Linux*)
sokol_shdc="$path_sokol_tools/bin/linux/sokol-shdc"
;;
*)
echo "Unsupported operating system: $OS"
CoreCount_Physical=1
CoreCount_Logical=1
;;
esac
echo "Using sokol-shdc: $sokol_shdc"
chmod +x "$sokol_shdc"
path_backend_sokol="$path_backend/sokol"
@@ -42,4 +58,6 @@ pushd "$path_backend_sokol" > /dev/null
"$flag_target_lang" "glsl410:glsl300es:hlsl4:metal_macos:wgsl" \
"$flag_format_odin" "$flag_module=draw_text"
echo "Built sokol shaders"
popd > /dev/null

View File

@@ -67,6 +67,7 @@ update_git_repo() {
echo "Building $url"
pushd "$path" > /dev/null
chmod +x "$build_command"
eval "$build_command"
popd > /dev/null
@@ -92,6 +93,7 @@ update_git_repo() {
echo "Building $url"
pushd "$path" > /dev/null
chmod +x "$build_command"
eval "$build_command"
popd > /dev/null