diff --git a/BeefProj.toml b/BeefProj.toml index 85a4c3d..a082481 100644 --- a/BeefProj.toml +++ b/BeefProj.toml @@ -5,82 +5,66 @@ Name = "Glfw" TargetType = "BeefLib" StartupObject = "Glfw.Program" +[Dependencies] +corlib = "*" +"CxxBuildTool.git" = {Git = "https://git.unicon-gmbh.de/Rune/CxxBuildTool.git"} + [Configs.Debug.Win32] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Debug.Win64] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Debug.Linux32] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] [Configs.Debug.Linux64] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] [Configs.Debug.macOS] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_COCOA\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] [Configs.Release.Win32] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Release.Win64] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Release.Linux32] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Release.Linux64] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Release.macOS] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_COCOA\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] [Configs.Paranoid.Win32] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Paranoid.Win64] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Paranoid.Linux32] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Paranoid.Linux64] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Paranoid.macOS] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_COCOA\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] [Configs.Test.Win32] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Test.Win64] -LibPaths = ["$(BuildDir)/glfw3.lib", "user32.lib", "gdi32.lib", "shell32.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WIN32\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.lib"] [Configs.Test.Linux32] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Test.Linux64] -LibPaths = ["$(BuildDir)/glfw3.lib"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_WAYLAND -D_GLFW_X11\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] +LibPaths = ["$(BuildDir)/glfw3.a"] [Configs.Test.macOS] LibPaths = ["$(BuildDir)/glfw3.a"] -PreBuildCmds = ["ReadFile(\"$(ProjectDir)/CxxBuilderPath.txt\", \"CxxBuilderPath\")", "Execute(\"$(Var CxxBuilderPath) *.c -- \\\"cflags=-D_GLFW_COCOA\\\" \\\"src=$(ProjectDir)/glfw/src\\\" \\\"builddir=$(BuildDir)\\\" target=$(TargetTriple) config=$(Configuration) output=glfw3\")"] diff --git a/BeefSpace.toml b/BeefSpace.toml index b93d3f2..c6b1a89 100644 --- a/BeefSpace.toml +++ b/BeefSpace.toml @@ -1,6 +1,9 @@ FileVersion = 1 -Projects = {"Glfw" = {Path = "."}} ExtraPlatforms = ["Linux32", "Linux64", "macOS"] [Workspace] StartupProject = "Glfw" + +[Projects] +Glfw = {Path = "."} +"CxxBuildTool.git" = {Git = "https://git.unicon-gmbh.de/Rune/CxxBuildTool.git"} diff --git a/BeefSpace_Lock.toml b/BeefSpace_Lock.toml new file mode 100644 index 0000000..15da856 --- /dev/null +++ b/BeefSpace_Lock.toml @@ -0,0 +1,6 @@ +FileVersion = 1 + +[Locks."CxxBuildTool.git".Git] +URL = "https://git.unicon-gmbh.de/Rune/CxxBuildTool.git" +Tag = "" +Hash = "b64a6221b8cb235a5e040c8597365dabeef849ca" diff --git a/Setup/BeefProj.toml b/Setup/BeefProj.toml index ba20939..ed7ea07 100644 --- a/Setup/BeefProj.toml +++ b/Setup/BeefProj.toml @@ -1,67 +1,10 @@ FileVersion = 1 -Dependencies = {corlib = "*", "Clang-C.git" = "*", "Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/BeefBindings/Cpp2Beef.git"}} [Project] Name = "Glfw.Setup" StartupObject = "Glfw.Setup.Program" -DefaultNamespace = "Glfw.Setup" -[Configs.Debug.Win32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Debug.Win64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Debug.Linux32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Debug.Linux64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Debug.macOS] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Release.Win32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Release.Win64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Release.Linux32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Release.Linux64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Release.macOS] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Paranoid.Win32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Paranoid.Win64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Paranoid.Linux32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Paranoid.Linux64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Paranoid.macOS] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Test.Win32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Test.Win64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Test.Linux32] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Test.Linux64] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] - -[Configs.Test.macOS] -PreBuildCmds = ["cp $(ProjectDir Cpp2Beef.git)/CxxBuilder/dist/CxxBuilderPath.txt ../CxxBuilderPath.txt"] +[Dependencies] +corlib = "*" +"Clang-C.git" = "*" +"Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/Rune/Cpp2Beef.git"} diff --git a/Setup/BeefSpace.toml b/Setup/BeefSpace.toml index 10b56a3..a3eceea 100644 --- a/Setup/BeefSpace.toml +++ b/Setup/BeefSpace.toml @@ -1,6 +1,9 @@ FileVersion = 1 -Projects = {"Glfw.Setup" = {Path = "."}, "Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/BeefBindings/Cpp2Beef.git"}} ExtraPlatforms = ["Linux32", "Linux64", "macOS"] [Workspace] StartupProject = "Glfw.Setup" + +[Projects] +"Glfw.Setup" = {Path = "."} +"Cpp2Beef.git" = {Git = "https://git.unicon-gmbh.de/Rune/Cpp2Beef.git"} diff --git a/Setup/src/Program.bf b/Setup/src/Program.bf index 011370d..3af98df 100644 --- a/Setup/src/Program.bf +++ b/Setup/src/Program.bf @@ -21,23 +21,6 @@ class GlfwGenerator : Cpp2BeefGenerator, this(Span args) namespace Glfw; - static class Glfw - { - public struct Bool : c_int - { - public static operator Self(bool b) => b ? True : False; - public static operator bool(Self b) => b != False; - } - - // Vulkan - public typealias PFN_vkGetInstanceProcAddr = void*; - public struct VkInstance : int; - public struct VkPhysicalDevice : int; - public typealias VkResult = c_int; - public struct VkAllocationCallbacks; - public struct VkSurfaceKHR : uint64; - } - """) ~ delete _; diff --git a/src/Glfw.bf b/src/Glfw.bf index 6994593..808182b 100644 --- a/src/Glfw.bf +++ b/src/Glfw.bf @@ -5,23 +5,6 @@ using System.Interop; namespace Glfw; -static class Glfw -{ - public struct Bool : c_int - { - public static operator Self(bool b) => b ? True : False; - public static operator bool(Self b) => b != False; - } - - // Vulkan - public typealias PFN_vkGetInstanceProcAddr = void*; - public struct VkInstance : int; - public struct VkPhysicalDevice : int; - public typealias VkResult = c_int; - public struct VkAllocationCallbacks; - public struct VkSurfaceKHR : int; -} - static { /************************************************************************* diff --git a/src/Library.bf b/src/Library.bf new file mode 100644 index 0000000..c29a0ed --- /dev/null +++ b/src/Library.bf @@ -0,0 +1,34 @@ +using System; +using System.Interop; + +using CxxBuildTool; + +namespace Glfw; + +static class Glfw +{ + public struct Bool : c_int + { + public static operator Self(bool b) => b ? True : False; + public static operator bool(Self b) => b != False; + } + + // Vulkan + public typealias PFN_vkGetInstanceProcAddr = void*; + public struct VkInstance : int; + public struct VkPhysicalDevice : int; + public typealias VkResult = c_int; + public struct VkAllocationCallbacks; + public struct VkSurfaceKHR : int; + + [OnCompile(.TypeDone)] + private static void Build() + { + if (!Compiler.IsBuilding) return; + CxxBuildTool.CMake( + Compiler.ProjectDir + "/glfw", + Compiler.BuildDir + "/" + Compiler.ProjectName, + "-DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_INSTALL=OFF" + ); + } +}