add_rules("mode.debug", "mode.release", "mode.releasedbg", "mode.minsizerel") add_requires("nuklear", "nuklear_glfw_gl3", "nuklear_fonts", "glew", "glfw", "tinyfiledialogs", "c11threads", "pcre2", "cjson") add_requires("libcurl", { configs = { zlib = true } }) if is_plat("linux") then set_toolchains("clang") end target("hinata") set_kind("binary") add_files("src/*.c") add_files("src/*/*.c") set_languages("c11") if is_mode("debug") then add_defines("DEBUG") end add_packages("nuklear", "nuklear_glfw_gl3", "nuklear_fonts", "glew", "glfw", "libcurl", "tinyfiledialogs", "c11threads", "pcre2", "cjson") package("tinyfiledialogs") set_homepage("https://sourceforge.net/projects/tinyfiledialogs/") set_description("Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE") set_license("zlib") add_urls("https://git.code.sf.net/p/tinyfiledialogs/code.git") if is_plat("windows", "mingw") then add_syslinks("comdlg32", "ole32", "user32", "shell32") end on_install("windows", "mingw", "linux", "macosx", function(package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") target("tinyfiledialogs") set_kind("static") add_files("tinyfiledialogs.c") add_headerfiles("tinyfiledialogs.h") ]]) import("package.tools.xmake").install(package) end) on_test(function(package) assert(package:check_csnippets({ test = [[ #include #include #include "tinyfiledialogs.h" void test() { char const * lWillBeGraphicMode; lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL); } ]] })) end) package("c11threads") set_homepage("https://github.com/jtsiomb/c11threads") set_description("Portable C11 threads implementation over POSIX threads and win32 threads.") add_urls("https://github.com/jtsiomb/c11threads/archive/ec95e1aa82079aefe109d18e5069b79711692064.zip") add_versions("1.0-ec95e1a", "9eb5eab9db4c32418eea39543d4883022c81167ea5e37f820f5af972bea7a30e") on_install("linux", "macosx", function(package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") target("c11threads") set_kind("static") add_headerfiles("c11threads.h") ]]) import("package.tools.xmake").install(package) end) on_install("windows", "mingw", function(package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") target("c11threads") set_kind("static") add_files("c11threads_win32.c") add_headerfiles("c11threads.h") ]]) import("package.tools.xmake").install(package) end) package("nuklear_glfw_gl3") set_homepage("https://github.com/Immediate-Mode-UI/Nuklear") set_description("A single-header ANSI C immediate mode cross-platform GUI library (GLFW OpenGL 3 Binding)") set_license("MIT") add_urls("https://github.com/Immediate-Mode-UI/Nuklear/archive/refs/tags/$(version).tar.gz", "https://github.com/Immediate-Mode-UI/Nuklear.git") add_versions("4.10.5", "6c80cbd0612447421fa02ad92f4207da2cd019a14d94885dfccac1aadc57926a") on_install(function(package) os.cp("demo/glfw_opengl3/nuklear_glfw_gl3.h", package:installdir("include")) end) package("nuklear_fonts") add_urls( "https://gist.github.com/135e2/656614a4a86cf6f8e9aea9f0de850634/archive/8d1dc2a079cef20d97acbc2a9874b1b77b25070b.zip") add_versions("8d1dc2a", "3dedfd45900cf68fed49ee50963c37c59af01c7f8deb327224f710c010565f87") on_install(function(package) os.cp("unifont.h", package:installdir("include")) os.cp("NotoSansCJK.h", package:installdir("include")) end) package("cjson") set_homepage("https://github.com/DaveGamble/cJSON") set_description("Ultralightweight JSON parser in ANSI C.") set_license("MIT") set_urls("https://github.com/DaveGamble/cJSON/archive/v$(version).zip", "https://github.com/DaveGamble/cJSON.git") add_versions("1.7.16", "ea60a2477e5b7f41418eeb70488f437c56c56f998802e23be22b859e4be3ef44") add_deps("cmake") on_install("windows", "macosx", "linux", "mingw", "iphoneos", "android", function(package) local configs = { "-DENABLE_CJSON_TEST=OFF" } table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) import("package.tools.cmake").install(package, configs) end) on_test(function(package) assert(package:has_cfuncs("cJSON_malloc", { includes = "cjson/cJSON.h" })) end)