|
@@ -0,0 +1,204 @@
|
|
|
+add_rules("mode.debug", "mode.release") -- Enable debug/release modes
|
|
|
+
|
|
|
+set_configvar("generate_commands", 1)
|
|
|
+
|
|
|
+-- option("compile_commands") -- Enable compile_commands.json generation
|
|
|
+
|
|
|
+-- if has_config("compile_commands") then
|
|
|
+-- set_configvar("generate_commands", 1)
|
|
|
+-- end
|
|
|
+
|
|
|
+-- Add required dependencies using add_requires
|
|
|
+--add_requires("raylib")
|
|
|
+--add_requires("imgui")
|
|
|
+
|
|
|
+-- Define a GLFW3 static library
|
|
|
+target("glfw")
|
|
|
+
|
|
|
+ set_kind("static")
|
|
|
+
|
|
|
+ -- add_includedirs(
|
|
|
+ -- "libs/glfw/include"
|
|
|
+ -- --, "libs/glfw/deps"
|
|
|
+ -- )
|
|
|
+
|
|
|
+ -- Add the include files
|
|
|
+ add_includedirs(
|
|
|
+ -- "libs/raylib/src/external/glfw/deps",
|
|
|
+ "libs/raylib/src/external/glfw/src",
|
|
|
+ "libs/raylib/src/external/glfw/include"
|
|
|
+ )
|
|
|
+
|
|
|
+ -- add_files("libs/raylib/src/external/glfw/deps/*.c")
|
|
|
+ add_files(
|
|
|
+ --"libs/raylib/src/external/glfw/include/GLFW/glfw3.h",
|
|
|
+ --"libs\\raylib\\src\\external\\glfw\\include\\GLFW\\glfw3native.h",
|
|
|
+ --"libs/raylib/src/external/glfw/include/GLFW/glfw3native.h",
|
|
|
+ "libs/raylib/src/external/glfw/src/context.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/init.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/input.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/monitor.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/platform.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/vulkan.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/window.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/egl_context.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/osmesa_context.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/null_init.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/null_monitor.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/null_window.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/null_joystick.c"
|
|
|
+
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ -- Set the compiler standard to c99 (not c++)
|
|
|
+ set_languages("c99")
|
|
|
+
|
|
|
+ -- Check for MSVC toolchain
|
|
|
+ if is_plat("windows") then
|
|
|
+ add_cflags("/W0") -- Add warning level 3 for MSVC
|
|
|
+ add_cflags("/TC") -- Compile all .c files as C files
|
|
|
+ --add_cflags("/wd4244") -- Disable warning 4244
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ -- Test include everything but os defined for target
|
|
|
+ -- OS Conditional Logic
|
|
|
+
|
|
|
+ if is_plat("linux") then
|
|
|
+ add_defines("_GLFW_X11")
|
|
|
+ add_files(
|
|
|
+ "libs/raylib/src/external/glfw/src/posix_time.h",
|
|
|
+ "libs/raylib/src/external/glfw/src/posix_thread.h",
|
|
|
+ "libs/raylib/src/external/glfw/src/posix_module.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/posix_time.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/posix_thread.c"
|
|
|
+ )
|
|
|
+ add_links("X11")
|
|
|
+ add_syslinks("dl", "pthread")
|
|
|
+ elseif is_plat("windows") then
|
|
|
+ add_defines("_GLFW_WIN32")
|
|
|
+ add_files(
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_init.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_module.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_monitor.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_window.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_joystick.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_time.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_thread.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/wgl_context.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/egl_context.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/osmesa_context.c"
|
|
|
+ )
|
|
|
+ add_syslinks("user32", "shell32", "gdi32")
|
|
|
+ elseif is_plat("macosx") then
|
|
|
+ add_defines("_GLFW_COCOA")
|
|
|
+ add_files(
|
|
|
+ "libs/raylib/src/external/glfw/src/cocoa_time.h",
|
|
|
+ "libs/raylib/src/external/glfw/src/cocoa_thread.h",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_module.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_time.c",
|
|
|
+ "libs/raylib/src/external/glfw/src/win32_thread.c"
|
|
|
+ )
|
|
|
+
|
|
|
+ add_frameworks("Cocoa", "IOKit", "CoreFoundation", "CoreVideo")
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+target_end() -- End the 'glfw' target definition
|
|
|
+
|
|
|
+
|
|
|
+target("raylib")
|
|
|
+ set_kind("static")
|
|
|
+
|
|
|
+ set_languages("c99")
|
|
|
+
|
|
|
+ -- Add the defines needed, to build for desktop with opengl 3.3+
|
|
|
+ add_defines(
|
|
|
+ "PLATFORM_DESKTOP",
|
|
|
+ "PLATFORM_DESKTOP_GLFW",
|
|
|
+ "_GNU_SOURCE"
|
|
|
+ )
|
|
|
+
|
|
|
+ -- add a compiler option
|
|
|
+ add_cflags("-DGL_SILENCE_DEPRECATION=199309L")
|
|
|
+
|
|
|
+ -- Check for MSVC toolchain
|
|
|
+ if is_plat("windows") then
|
|
|
+ add_cflags("/W0") -- Add warning level 3 for MSVC
|
|
|
+ add_cflags("/TC") -- Compile all .c files as C files
|
|
|
+ --add_cflags("/wd4244") -- Disable warning 4244
|
|
|
+ end
|
|
|
+
|
|
|
+ add_includedirs(
|
|
|
+ "libs/raylib/src",
|
|
|
+ "libs/raylib/src/external/glfw/include"
|
|
|
+ )
|
|
|
+
|
|
|
+ add_files(
|
|
|
+ "libs/raylib/src/raudio.c",
|
|
|
+ "libs/raylib/src/rcore.c",
|
|
|
+ "libs/raylib/src/rmodels.c",
|
|
|
+ "libs/raylib/src/rshapes.c",
|
|
|
+ "libs/raylib/src/rtext.c",
|
|
|
+ "libs/raylib/src/rtextures.c",
|
|
|
+ "libs/raylib/src/utils.c"
|
|
|
+ )
|
|
|
+
|
|
|
+ -- For each platform, we need to add the platform specific files
|
|
|
+ if is_plat("windows") then
|
|
|
+ add_includedirs("libs/raylib/src/external/glfw/deps/mingw")
|
|
|
+ -- add_files("libs/raylib/src/rglfw.c")
|
|
|
+ add_defines("PLATFORM_DESKTOP")
|
|
|
+ add_syslinks("user32", "shell32", "winmm", "gdi32", "opengl32")
|
|
|
+ elseif is_plat("linux") then
|
|
|
+ add_defines("DESKTOP_LINUX")
|
|
|
+ add_defines("_GNU_SOURCE")
|
|
|
+ add_defines("GL_SILENCE_DEPRECATION=199309L")
|
|
|
+ elseif is_plat("macosx") then
|
|
|
+
|
|
|
+ elseif is_plat("android") then
|
|
|
+
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+target_end() -- End the 'raylib' target definition
|
|
|
+
|
|
|
+-- Add the target executable
|
|
|
+target("bgstart")
|
|
|
+ set_kind("binary") -- Specify the kind of target (binary/executable)
|
|
|
+ set_default(true) -- Set this target as the default build target
|
|
|
+
|
|
|
+
|
|
|
+ -- Include directories for your header files
|
|
|
+ add_includedirs("include") -- Include your game's headers
|
|
|
+ add_includedirs("libs/raylib/src") -- Include raylib's headers
|
|
|
+
|
|
|
+ --add_packages("raylib") -- Add the bgfx and imgui packages
|
|
|
+ add_deps("raylib", "glfw") -- Add the raylib library
|
|
|
+
|
|
|
+ -- link the required libraries
|
|
|
+ add_links("raylib", "glfw") -- Link the raylib library
|
|
|
+
|
|
|
+ -- Check for MSVC toolchain
|
|
|
+ if is_plat("windows") then
|
|
|
+ add_cflags("/W0") -- Add warning level 3 for MSVC
|
|
|
+ -- add_cflags("/TC") -- Compile all .c files as C files
|
|
|
+ --add_cflags("/wd4244") -- Disable warning 4244
|
|
|
+ end
|
|
|
+
|
|
|
+ --add_links("glfw") -- Link the GLFW library
|
|
|
+
|
|
|
+ -- Set the source files
|
|
|
+ add_files("src/main.c") -- Include all .cpp files in src
|
|
|
+
|
|
|
+ -- Set additional build options if necessary
|
|
|
+ set_languages("c++17", "c11") -- Set the C++ standard (modify as needed)
|
|
|
+
|
|
|
+target_end() -- End the main 'bgstart' definition
|
|
|
+
|