fix: macos path and dll problem (partially)

This commit is contained in:
Fumiya Funatsu 2025-05-06 09:04:36 +09:00
parent 6f19b9167e
commit 159f6157bf
9 changed files with 19 additions and 12 deletions

BIN
bin/macos/libhmm_dll_macos.so Normal file → Executable file

Binary file not shown.

BIN
bin/macos/libhmm_dll_macos_arm64.so Normal file → Executable file

Binary file not shown.

View File

@ -1,7 +1,7 @@
local ffi = require( "ffi" )
local libs = ffi_hmm_dll or {
OSX = { x64 = "hmm_dll" },
OSX = { x64 = "hmm_dll_macos.so", arm64 = "hmm_dll_macos_arm64.so" },
Windows = { x64 = "hmm_dll.dll" },
Linux = { x64 = "hmm_dll.so", arm = "hmm_dll.so" },
BSD = { x64 = "hmm_dll.so" },

View File

@ -4,7 +4,7 @@ local ffi = require( "ffi" )
local sokol_filename = _G.SOKOL_DLL or "sokol_dll"
local libs = ffi_sokol_app or {
OSX = { x64 = sokol_filename..".so" },
OSX = { x64 = sokol_filename.."_macos.so", arm64 = sokol_filename.."_macos_arm64.so" },
Windows = { x64 = sokol_filename..".dll" },
Linux = { x64 = "lib"..sokol_filename..".so", arm = "lib"..sokol_filename..".so" },
BSD = { x64 = sokol_filename..".so" },
@ -13,7 +13,6 @@ local libs = ffi_sokol_app or {
}
local lib = ffi_sokol_app or libs[ ffi.os ][ ffi.arch ]
print(lib)
local sokol_app = ffi.load( lib )
-- just use LuaJIT ffi and lcpp together

View File

@ -2,7 +2,7 @@ local ffi = require( "ffi" )
local sokol_filename = _G.SOKOL_DLL or "sokol_dll"
local libs = ffi_sokol_gfx or {
OSX = { x64 = sokol_filename..".so" },
OSX = { x64 = sokol_filename.."_macos.so", arm64 = sokol_filename.."_macos_arm64.so" },
Windows = { x64 = sokol_filename..".dll" },
Linux = { x64 = sokol_filename..".so", arm = sokol_filename..".so" },
BSD = { x64 = sokol_filename..".so" },

View File

@ -2,7 +2,7 @@ local ffi = require( "ffi" )
local sokol_filename = _G.SOKOL_GP_DLL or "sokol_gp_dll"
local libs = ffi_sokol_gfx or {
OSX = { x64 = sokol_filename..".so" },
OSX = { x64 = sokol_filename.."_macos.so", arm64 = sokol_filename.."_macos_arm64.so" },
Windows = { x64 = sokol_filename..".dll" },
Linux = { x64 = sokol_filename..".so", arm = sokol_filename..".so" },
BSD = { x64 = sokol_filename..".so" },

View File

@ -2,7 +2,7 @@ local ffi = require( "ffi" )
local sokol_filename = _G.SOKOL_DLL or "sokol_dll"
local libs = ffi_sokol_libs or {
OSX = { x64 = sokol_filename..".so" },
OSX = { x64 = sokol_filename.."_macos.so", arm64 = sokol_filename.."_macos_arm64.so" },
Windows = { x64 = sokol_filename..".dll" },
Linux = { x64 = sokol_filename..".so", arm = sokol_filename..".so" },
BSD = { x64 = sokol_filename..".so" },

18
projects/examples/run_sample.sh Normal file → Executable file
View File

@ -1,15 +1,21 @@
#!/bin/bash
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
PROJECT_PATH="$(dirname $(dirname "$SCRIPT_PATH"))"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Running Linux..."
export LD_LIBRARY_PATH=../bin/linux/
../bin/linux/luajit ./samples/$1.lua
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PROJECT_PATH/bin/linux"
$PROJECT_PATH/bin/linux/luajit $SCRIPT_PATH/samples/$1.lua
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "Running MaxOS..."
../bin/macos/luajit ./samples/$1.lua
echo "Running MacOS..."
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PROJECT_PATH/bin/macos"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PROJECT_PATH/bin/macos"
$PROJECT_PATH/bin/macos/luajit $SCRIPT_PATH/samples/$1.lua
elif [[ "$OSTYPE" == "win32" ]]; then
echo "Running Windows..."
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../bin/linux
../bin/win64/luajit ./samples/$1.lua
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROJECT_PATH/bin/linux
$PROJECT_PATH/bin/win64/luajit $SCRIPT_PATH/samples/$1.lua
else
echo "OS Type not found."
fi

View File

@ -54,11 +54,13 @@ dirtools.add_default_paths = function(path)
["Linux"] = "linux",
["Windows"] = "win64",
["MacOSX"] = "macos",
["OSX"] = "macos",
}
local extensions = {
["Linux"] = "so",
["Windows"] = "dll",
["MacOSX"] = "so",
["OSX"] = "so",
}
package.cpath = package.cpath..";"..path.."bin/"..folders[ffi.os].."/?."..extensions[ffi.os]