diff --git a/.gitignore b/.gitignore index 437f89d..0aa8640 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ Cargo.lock # FFI Bindings -Source/Library.h +Header.h # Visual Studio Project Files @@ -24,6 +24,7 @@ Source/Library.h # CMake Project Files Makefile +*.make # Xcode Project Files diff --git a/Bootstrap.ps1 b/Bootstrap.ps1 new file mode 100644 index 0000000..316aed0 --- /dev/null +++ b/Bootstrap.ps1 @@ -0,0 +1,38 @@ +#!/usr/bin/env pwsh + +echo "Installing dependencies..." + +cargo install cbindgen + +echo "Generating bindings..." + +cbindgen --config ./Config/Bindings.toml --crate Library --output ./Source/Header.h --quiet + +# Windows + +if ($IsWindows) +{ + echo "Generating Visual Studio project..." + + & "./Vendor/Premake/Windows/premake5.exe" "vs2019" +} + +# Mac + +elseif ($IsMacOS) +{ + echo "Generating XCode project..." + + sudo chmod +x ./Vendor/Premake/Mac/premake5 + & "./Vendor/Premake/Mac/premake5" "xcode4" +} + +# Linux + +elseif ($IsLinux) +{ + echo "Generating GMake project..." + + sudo chmod +x ./Vendor/Premake/Linux/premake5 + & "./Vendor/Premake/Linux/premake5" "gmake2" +} diff --git a/Bootstrap.sh b/Bootstrap.sh new file mode 100644 index 0000000..06fef4b --- /dev/null +++ b/Bootstrap.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +echo "Installing dependencies..." + +cargo install cbindgen + +echo "Generating bindings..." + +cbindgen --config ./Config/Bindings.toml --crate Library --output ./Source/Header.h --quiet + +# Linux + +if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ] +then + echo "Generating GMake project..." + + sudo chmod +x ./Vendor/Premake/Linux/premake5 + ./Vendor/Premake/Linux/premake5 gmake2 + +# Mac + +elif [ "$(uname)" = "Darwin" ] +then + echo "Generating XCode project..." + + sudo chmod +x ./Vendor/Premake/Mac/premake5 + ./Vendor/Premake/Mac/premake5 xcode4 +fi diff --git a/GenerateProjectFiles.bat b/GenerateProjectFiles.bat deleted file mode 100644 index a42a91c..0000000 --- a/GenerateProjectFiles.bat +++ /dev/null @@ -1,2 +0,0 @@ -cbindgen --config .\Config\Bindings.toml --crate Library --output Source\Library.h -call .\Premake\Windows\premake5.exe vs2019 diff --git a/GenerateProjectFiles.command b/GenerateProjectFiles.command deleted file mode 100644 index f0c1f03..0000000 --- a/GenerateProjectFiles.command +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/zsh - -cbindgen --config ./Config/Bindings.toml --crate Library --output Source/Library.h -sudo ./Premake/Mac/premake5 xcode4 diff --git a/GenerateProjectFiles.sh b/GenerateProjectFiles.sh deleted file mode 100755 index 8542046..0000000 --- a/GenerateProjectFiles.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cbindgen --config ./Config/Bindings.toml --crate Library --output Source/Library.h -sudo ./Premake/Linux/premake5 gmake2 diff --git a/Premake/LICENSE.txt b/Vendor/Premake/LICENSE.txt similarity index 100% rename from Premake/LICENSE.txt rename to Vendor/Premake/LICENSE.txt diff --git a/Premake/Linux/premake5 b/Vendor/Premake/Linux/premake5 old mode 100755 new mode 100644 similarity index 100% rename from Premake/Linux/premake5 rename to Vendor/Premake/Linux/premake5 diff --git a/Premake/Mac/premake5 b/Vendor/Premake/Mac/premake5 similarity index 100% rename from Premake/Mac/premake5 rename to Vendor/Premake/Mac/premake5 diff --git a/Premake/Windows/premake5.exe b/Vendor/Premake/Windows/premake5.exe similarity index 100% rename from Premake/Windows/premake5.exe rename to Vendor/Premake/Windows/premake5.exe diff --git a/Vendor/rcedit.exe b/Vendor/rcedit.exe new file mode 100644 index 0000000..36764c6 Binary files /dev/null and b/Vendor/rcedit.exe differ diff --git a/premake5.lua b/premake5.lua index 896c4ce..640e3b1 100644 --- a/premake5.lua +++ b/premake5.lua @@ -34,7 +34,6 @@ project "Cpp" } filter "system:windows" - cppdialect "C++17" staticruntime "On" systemversion "latest" @@ -45,14 +44,24 @@ project "Cpp" filter { "system:windows", "configurations:debug" } runtime "Debug" - buildoptions "/MDd" symbols "on" filter { "system:windows", "configurations:release" } runtime "Release" - buildoptions "/MD" optimize "on" + filter "system:linux" + links + { + "Library" + } + + filter "system:darwin" + links + { + "Library" + } + project "C" location "Examples/C" kind "ConsoleApp" @@ -88,17 +97,36 @@ project "C" filter { "system:windows", "configurations:debug" } runtime "Debug" - buildoptions "/MDd" symbols "on" filter { "system:windows", "configurations:release" } runtime "Release" - buildoptions "/MD" optimize "on" + filter "system:linux" + links + { + "Library" + } + + filter "system:darwin" + links + { + "Library" + } + project "CSharp" location "Examples/CSharp" - kind "ConsoleApp" + + filter { "system:windows" } + kind "ConsoleApp" + filter { "system:linux" } + kind "None" + filter { "system:darwin" } + kind "None" + + filter {} + language "C#" targetdir ("Binaries/" .. outputDir) @@ -125,15 +153,13 @@ project "CSharp" defines { - "WINDOWS_PLATFORM" + "PLATFORM_WINDOWS" } filter { "system:windows", "configurations:debug" } runtime "Debug" - buildoptions "/MDd" symbols "on" filter { "system:windows", "configurations:release" } runtime "Release" - buildoptions "/MD" optimize "on"