Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/dep5.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/dep4.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/interface.h
/*! calculate add(a, b) * * @param a the first argument * @param b the second argument * * @return the result */ int add(int a, int b);
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/dep3.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/test3.c
#include "interface.h" #include <stdio.h> int main(int argc, char** argv) { printf("add(1, 2) = %d\n", add(1, 2)); return 0; }
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/dep1.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/multiplats_xcode/test.lua
function main(t) if is_host("macosx") then os.exec("xmake f -c -vD") os.exec("xmake -rvD") os.exec("xmake f -c -vD -p iphoneos") os.exec("xmake -rvD") end end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/multiplats_xcode/xmake.lua
add_rules("mode.debug", "mode.release") target("test_host") set_kind("binary") add_files("src/*.c") target("test_iphoneos") set_kind("binary") add_files("src/*.c") set_plat("iphoneos") target("test_iphoneos_armv7") set_kind("binary") add_files("src/*.c") set_plat("iphoneos") set_arch("armv7")
0
repos/xmake/tests/projects/other/multiplats_xcode
repos/xmake/tests/projects/other/multiplats_xcode/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/glsl2spv/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("glslang", {configs = {binaryonly = true}}) target("test") set_kind("binary") add_rules("utils.glsl2spv", {bin2c = true}) add_files("src/*.c") add_files("src/*.vert", "src/*.frag") add_packages("glslang")
0
repos/xmake/tests/projects/other/glsl2spv
repos/xmake/tests/projects/other/glsl2spv/src/main.c
#include <stdio.h> static unsigned char g_test_vert_spv_data[] = { #include "test.vert.spv.h" }; static unsigned char g_test_frag_spv_data[] = { #include "test.frag.spv.h" }; int main(int argc, char** argv) { printf("test.vert.spv: %s, size: %d\n", g_test_vert_spv_data, (int)sizeof(g_test_vert_spv_data)); printf("test.frag.spv: %s, size: %d\n", g_test_frag_spv_data, (int)sizeof(g_test_frag_spv_data)); return 0; }
0
repos/xmake/tests/projects/other/glsl2spv
repos/xmake/tests/projects/other/glsl2spv/src/test.frag
#version 330 precision mediump float; void main() { }
0
repos/xmake/tests/projects/other/glsl2spv
repos/xmake/tests/projects/other/glsl2spv/src/test.vert
#version 330 precision mediump float; void main() { }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_object/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_object/xmake.lua
add_rules("mode.debug", "mode.release") set_policy("build.across_targets_in_parallel", false) target("merge_object") set_kind("static") add_files("src/interface.c") after_build_file(function (target, sourcefile) os.cp(target:objectfile(sourcefile), "$(buildir)/merge_object/") end) target("test") set_kind("binary") add_deps("merge_object") add_files("src/test.c") if is_plat("windows") then add_files("$(buildir)/merge_object/interface.c.obj") else add_files("$(buildir)/merge_object/interface.c.o") end
0
repos/xmake/tests/projects/other/merge_object
repos/xmake/tests/projects/other/merge_object/src/interface.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/merge_object
repos/xmake/tests/projects/other/merge_object/src/interface.h
/*! calculate add(a, b) * * @param a the first argument * @param b the second argument * * @return the result */ int add(int a, int b);
0
repos/xmake/tests/projects/other/merge_object
repos/xmake/tests/projects/other/merge_object/src/test.c
#include "interface.h" #include <stdio.h> int main(int argc, char** argv) { printf("add(1, 2) = %d\n", add(1, 2)); return 0; }
0
repos/xmake/tests/projects
repos/xmake/tests/projects/lex_yacc/xmake.lua
add_rules("mode.debug", "mode.release") target("calc") set_kind("binary") add_rules("lex", "yacc") add_files("src/*.c", "src/*.l", "src/*.y")
0
repos/xmake/tests/projects/lex_yacc
repos/xmake/tests/projects/lex_yacc/src/test.c
#include "calc.tab.h" void test() { }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/components/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/components/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("sfml") target("graphics") set_kind("static") add_files("src/graphics.cpp") add_packages("sfml", {components = "graphics", public = true}) target("network") set_kind("static") add_files("src/network.cpp") add_packages("sfml", {components = "network", public = true}) target("test") set_kind("binary") add_files("src/main.cpp") add_deps("graphics", "network") package("sfml") set_homepage("https://www.sfml-dev.org") set_description("Simple and Fast Multimedia Library") if is_plat("windows", "linux") then set_urls("https://www.sfml-dev.org/files/SFML-$(version)-sources.zip") add_urls("https://github.com/SFML/SFML/releases/download/$(version)/SFML-$(version)-sources.zip") add_versions("2.5.1", "bf1e0643acb92369b24572b703473af60bac82caf5af61e77c063b779471bb7f") elseif is_plat("macosx") then if is_arch("x64", "x86_64") then set_urls("https://www.sfml-dev.org/files/SFML-$(version)-macOS-clang.tar.gz") add_versions("2.5.1", "6af0f14fbd41dc038a00d7709f26fb66bb7ccdfe6187657ef0ef8cba578dcf14") add_configs("debug", {builtin = true, description = "Enable debug symbols.", default = false, type = "boolean", readonly = true}) add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true}) end elseif is_plat("mingw") then if is_arch("x64", "x86_64") then set_urls("https://www.sfml-dev.org/files/SFML-$(version)-windows-gcc-7.3.0-mingw-64-bit.zip") add_versions("2.5.1", "671e786f1af934c488cb22c634251c8c8bd441c709b4ef7bc6bbe227b2a28560") elseif is_arch("x86", "i386") then set_urls("https://www.sfml-dev.org/files/SFML-$(version)-windows-gcc-7.3.0-mingw-32-bit.zip") add_versions("2.5.1", "92d864c9c9094dc9d91e0006d66784f25ac900a8ee23c3f79db626de46a1d9d8") end end if is_plat("linux") then add_syslinks("pthread") end add_configs("graphics", {description = "Use the graphics module", default = true, type = "boolean"}) add_configs("window", {description = "Use the window module", default = true, type = "boolean"}) add_configs("audio", {description = "Use the audio module", default = true, type = "boolean"}) add_configs("network", {description = "Use the network module", default = true, type = "boolean"}) if is_plat("windows", "mingw") then add_configs("main", {description = "Link to the sfml-main library", default = true, type = "boolean"}) end if is_plat("macosx") then add_extsources("brew::sfml/sfml-all") end on_component("graphics", function (package, component) local e = package:config("shared") and "" or "-s" if package:debug() then e = e .. "-d" end component:add("links", "sfml-graphics" .. e) if package:is_plat("windows", "mingw") and not package:config("shared") then component:add("links", "freetype") component:add("syslinks", "opengl32", "gdi32", "user32", "advapi32") end component:add("deps", "window", "system") component:add("extsources", "brew::sfml/sfml-graphics") end) on_component("window", function (package, component) local e = package:config("shared") and "" or "-s" if package:debug() then e = e .. "-d" end component:add("links", "sfml-window" .. e) if package:is_plat("windows", "mingw") and not package:config("shared") then component:add("syslinks", "opengl32", "gdi32", "user32", "advapi32") end component:add("deps", "system") component:add("extsources", "brew::sfml/sfml-window") end) on_component("audio", function (package, component) local e = package:config("shared") and "" or "-s" if package:debug() then e = e .. "-d" end component:add("links", "sfml-audio" .. e) if package:is_plat("windows", "mingw") and not package:config("shared") then component:add("links", "openal32", "flac", "vorbisenc", "vorbisfile", "vorbis", "ogg") end component:add("deps", "system") component:add("extsources", "brew::sfml/sfml-audio") end) on_component("network", function (package, component) local e = package:config("shared") and "" or "-s" if package:debug() then e = e .. "-d" end component:add("links", "sfml-network" .. e) if package:is_plat("windows", "mingw") and not package:config("shared") then component:add("syslinks", "ws2_32") end component:add("deps", "system") component:add("extsources", "brew::sfml/sfml-network") component:add("extsources", "apt::sfml-network") end) on_component("system", function (package, component) local e = package:config("shared") and "" or "-s" if package:debug() then e = e .. "-d" end component:add("links", "sfml-system" .. e) if package:is_plat("windows", "mingw") then component:add("syslinks", "winmm") end if package:is_plat("windows", "mingw") and package:config("main") then component:add("deps", "main") end component:add("extsources", "brew::sfml/sfml-system") end) on_component("main", function (package, component) if package:is_plat("windows", "mingw") then local main_module = "sfml-main" if package:debug() then main_module = main_module .. "-d" end component:add("links", main_module) end end) on_load("windows", "linux", "macosx", "mingw", function (package) if package:is_plat("windows", "linux") then package:add("deps", "cmake") end if not package:config("shared") then package:add("defines", "SFML_STATIC") end if package:is_plat("linux") then if package:config("window") or package:config("graphics") then package:add("deps", "libx11", "libxext", "libxrandr", "libxrender", "freetype", "eudev") package:add("deps", "opengl", "glx", {optional = true}) end if package:config("audio") then package:add("deps", "libogg", "libflac", "libvorbis", "openal-soft") end end package:add("components", "system") for _, component in ipairs({"graphics", "window", "audio", "network"}) do if package:config(component) then package:add("components", component) end end if package:is_plat("windows", "mingw") and package:config("main") then package:add("components", "main") end end) on_install("windows", "linux", function (package) local configs = {"-DSFML_BUILD_DOC=OFF", "-DSFML_BUILD_EXAMPLES=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) if package:config("shared") then table.insert(configs, "-DBUILD_SHARED_LIBS=ON") else table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") if package:is_plat("windows") and package:runtimes():startswith("MT") then table.insert(configs, "-DSFML_USE_STATIC_STD_LIBS=ON") end end local packagedeps if package:is_plat("linux") and package:config("shared") then io.replace("src/SFML/Graphics/CMakeLists.txt", "target_link_libraries(sfml-graphics PRIVATE X11)", "target_link_libraries(sfml-graphics PRIVATE X11 Xext Xrender)", {plain = true}) packagedeps = {"libxext", "libxrender"} end table.insert(configs, "-DSFML_BUILD_AUDIO=" .. (package:config("audio") and "ON" or "OFF")) table.insert(configs, "-DSFML_BUILD_GRAPHICS=" .. (package:config("graphics") and "ON" or "OFF")) table.insert(configs, "-DSFML_BUILD_WINDOW=" .. (package:config("window") and "ON" or "OFF")) table.insert(configs, "-DSFML_BUILD_NETWORK=" .. (package:config("network") and "ON" or "OFF")) import("package.tools.cmake").install(package, configs, {packagedeps = packagedeps}) end) on_install("macosx", "mingw", function (package) os.cp("lib", package:installdir()) os.cp("include", package:installdir()) if package:is_plat("mingw") then os.cp("bin/*", package:installdir("lib"), {rootdir = "bin"}) end end) on_test(function (package) assert(package:check_cxxsnippets({test = [[ void test(int args, char** argv) { sf::Clock c; c.restart(); } ]]}, {includes = "SFML/System.hpp"})) if package:config("graphics") then assert(package:check_cxxsnippets({test = [[ void test(int args, char** argv) { sf::Text text; text.setString("Hello world"); } ]]}, {includes = "SFML/Graphics.hpp"})) end if package:config("window") or package:config("graphics") then assert(package:check_cxxsnippets({test = [[ void test(int args, char** argv) { sf::Window window(sf::VideoMode(1280, 720), "Title"); sf::Event event; window.pollEvent(event); } ]]}, {includes = "SFML/Window.hpp"})) end if package:config("audio") then assert(package:check_cxxsnippets({test = [[ void test(int args, char** argv) { sf::Music music; music.openFromFile("music.ogg"); music.play(); } ]]}, {includes = "SFML/Audio.hpp"})) end if package:config("network") then assert(package:check_cxxsnippets({test = [[ void test(int args, char** argv) { sf::UdpSocket socket; socket.bind(54000); char data[100]; std::size_t received; sf::IpAddress sender; unsigned short port; socket.receive(data, 100, received, sender, port); } ]]}, {includes = "SFML/Network.hpp"})) end end) package_end()
0
repos/xmake/tests/projects/package/components
repos/xmake/tests/projects/package/components/src/network.cpp
#include <SFML/Network.hpp> extern "C" { void network() { sf::UdpSocket socket; socket.bind(54000); char data[100]; std::size_t received; sf::IpAddress sender; unsigned short port; socket.receive(data, 100, received, sender, port); } }
0
repos/xmake/tests/projects/package/components
repos/xmake/tests/projects/package/components/src/graphics.cpp
#include <SFML/Graphics.hpp> extern "C" { void graphics() { sf::Text text; text.setString("Hello world"); } }
0
repos/xmake/tests/projects/package/components
repos/xmake/tests/projects/package/components/src/main.cpp
#include <SFML/Graphics.hpp> #include <SFML/Network.hpp> extern "C" { void network(); void graphics(); } int main(int argc, char** argv) { network(); graphics(); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/multiconfig/xmake-requires.lock
{ __meta__ = { version = "1.0" }, ["macosx|x86_64"] = { ["zlib#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" }, ["zlib~debug#55833b12"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" }, ["zlib~shared#b6ab42cb"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" } }, ["windows|x64"] = { ["zlib#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" }, ["zlib~debug#55833b12"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" }, ["zlib~shared#b6ab42cb"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" } } }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/multiconfig/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/multiconfig/xmake.lua
add_requires("zlib", {system = false}) add_requires("zlib", {system = false}) -- test repeat requires add_requires("zlib~debug", {system = false, debug = true}) add_requires("zlib~shared", {system = false, configs = {shared = true}, alias = "zlib_shared"}) set_policy("package.requires_lock", true) target("test1") set_kind("binary") add_files("src/*.c") add_packages("zlib") target("test2") set_kind("binary") add_files("src/*.c") add_packages("zlib~debug") target("test3") set_kind("binary") add_files("src/*.c") add_packages("zlib_shared")
0
repos/xmake/tests/projects/package/multiconfig
repos/xmake/tests/projects/package/multiconfig/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_muslcc/xmake-requires.lock
{ __meta__ = { version = "1.0" }, ["macosx|x86_64"] = { ["autoconf#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "2.71" }, ["automake#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "1.16.4" }, ["cmake#31fecfc4"] = { repo = { branch = "master", commit = "d3260ca0867f8b26aa2a72818bca3e6113a4fc42", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "3.22.1" }, ["gmp#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "6.2.1" }, ["libisl 0.22#67114504"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "0.22" }, ["libogg#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.3.4" }, ["libplist#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "2.2.0" }, ["libtool#31fecfc4"] = { repo = { branch = "master", commit = "dd4abbd658b9897c9e1dcacf2e4bdeeb02d05860", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "2.4.6" }, ["m4#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "1.4.19" }, ["muslcc#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "20210202" }, ["pkg-config#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "0.29.2" }, ["zlib#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" } }, ["windows|x64"] = { ["cmake#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "3.22.1" }, ["libogg#31fecfc4"] = { repo = { branch = "master", commit = "2b1cb74b289ae3221241985db4401a495c42fde3", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.3.4" }, ["make#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "4.3" }, ["muslcc#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "20210202" }, ["zlib#31fecfc4"] = { repo = { branch = "master", commit = "8d4f0875fe9a3c63be4948cefca9f232954e3e87", url = "https://github.com/xmake-io/xmake-repo.git" }, version = "v1.2.11" } } }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_muslcc/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_muslcc/xmake.lua
add_rules("mode.debug", "mode.release") -- set cross-compliation platform set_plat("cross") set_arch("arm") -- lock requires set_policy("package.requires_lock", true) -- custom toolchain toolchain("my_muslcc") set_homepage("https://musl.cc/") set_description("The musl-based cross-compilation toolchains") set_kind("cross") on_load(function (toolchain) toolchain:load_cross_toolchain() if toolchain:is_arch("arm") then toolchain:add("cxflags", "-march=armv7-a", "-msoft-float", {force = true}) toolchain:add("ldflags", "-march=armv7-a", "-msoft-float", {force = true}) end toolchain:add("syslinks", "gcc", "c") end) toolchain_end() -- add library packages -- for testing zlib/xmake, libplist/autoconf, libogg/cmake add_requires("zlib", "libogg", {system = false}) if is_host("macosx", "linux", "bsd") then add_requires("libplist", {system = false}) end -- add toolchains package add_requires("muslcc") -- set global toolchains for target and packages set_toolchains("my_muslcc@muslcc") -- use the builltin toolchain("muslcc") instead of "my_muslcc" --set_toolchains("@muslcc") target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib", "libplist", "libogg") if has_package("libplist") then add_defines("HAVE_LIBPLIST") end
0
repos/xmake/tests/projects/package/toolchain_muslcc
repos/xmake/tests/projects/package/toolchain_muslcc/src/main.c
#include <stdio.h> #include <stdint.h> #include <zlib.h> #include <ogg/ogg.h> #ifdef HAVE_LIBPLIST # include <plist/plist.h> #endif int main(int argc, char** argv) { printf("hello world!\n"); inflate(0, 0); ogg_sync_init(0); #ifdef HAVE_LIBPLIST plist_new_dict(); #endif return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/package_rule/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/package_rule/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("foo") add_repositories("myrepo ./repo") target("console") set_kind("binary") add_files("src/main.cpp", "src/*.md") add_packages("foo") add_rules("@foo/markdown")
0
repos/xmake/tests/projects/package/package_rule/repo/packages/f
repos/xmake/tests/projects/package/package_rule/repo/packages/f/foo/xmake.lua
package("foo") on_install(function() end)
0
repos/xmake/tests/projects/package/package_rule/repo/packages/f/foo
repos/xmake/tests/projects/package/package_rule/repo/packages/f/foo/rules/markdown.lua
rule("markdown") set_extensions(".md") on_config(function (target) print("test: config %s", target:name()) end) on_build_file(function(target, sourcefile) print("test: build %s", sourcefile) end) after_clean(function (target) print("test: clean") end)
0
repos/xmake/tests/projects/package/package_rule
repos/xmake/tests/projects/package/package_rule/src/main.cpp
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/basic/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/basic/xmake.lua
add_requires("tbox master", {debug = true}) add_requires("zlib >=1.2.11") add_requires("pcre2", {system = false, optional = true}) add_rules("mode.debug", "mode.release") target("test") set_kind("static") add_files("src/test.c") add_packages("pcre2", {public = true}) target("console") set_kind("binary") add_deps("test") add_files("src/main.c") add_packages("tbox", "zlib")
0
repos/xmake/tests/projects/package/basic
repos/xmake/tests/projects/package/basic/src/main.c
#include <stdio.h> #include <pcre2.h> int test(); int main(int argc, char** argv) { printf("hello world!\n"); pcre2_compile(0, 0, 0, 0, 0, 0); test(); return 0; }
0
repos/xmake/tests/projects/package/basic
repos/xmake/tests/projects/package/basic/src/test.c
#include <stdio.h> #include <pcre2.h> int test() { printf("hello world!\n"); pcre2_compile(0, 0, 0, 0, 0, 0); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/multiplat/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("raylib") add_requires("raylib~mingw", {plat = "mingw", arch = "x86_64"}) target("hello") add_packages("raylib") set_kind("binary") add_files("src/*.cpp") set_languages("c++11") target("hello_mingw") set_plat("mingw") set_arch("x86_64") add_packages("raylib~mingw") set_kind("binary") add_files("src/*.cpp")
0
repos/xmake/tests/projects/package/multiplat
repos/xmake/tests/projects/package/multiplat/src/main.cpp
/******************************************************************************************* * * raylib [core] example - Basic window * * Welcome to raylib! * * To test examples, just press F6 and execute raylib_compile_execute script * Note that compiled executable is placed in the same folder as .c file * * You can find all basic examples on C:\raylib\raylib\examples folder or * raylib official webpage: www.raylib.com * * Enjoy using raylib. :) * * This example has been created using raylib 1.0 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * * Copyright (c) 2013-2016 Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "raylib.h" int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { // Update //---------------------------------------------------------------------------------- // TODO: Update your variables here //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); ClearBackground(RAYWHITE); DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_zig/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("zig") target("test") set_kind("binary") add_files("src/*.zig") set_toolchains("@zig")
0
repos/xmake/tests/projects/package/toolchain_zig
repos/xmake/tests/projects/package/toolchain_zig/src/main.zig
const std = @import("std"); pub fn main() !void { const stdout = std.io.getStdOut().writer(); try stdout.print("Hello, {s}!\n", .{"world"}); }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_gnu_rm/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("gnu-rm") target("test") set_kind("binary") add_files("src/*.c") set_toolchains("@gnu-rm")
0
repos/xmake/tests/projects/package/toolchain_gnu_rm
repos/xmake/tests/projects/package/toolchain_gnu_rm/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/llvm_dev/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("llvm", {kind = "library", configs = {mlir = true}}) target("testllvm") set_kind("binary") add_files("src/*.cpp") add_packages("llvm", {components = "mlir"})
0
repos/xmake/tests/projects/package/llvm_dev
repos/xmake/tests/projects/package/llvm_dev/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/depconfigs/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/depconfigs/xmake.lua
add_requires("libpng", {system = false, configs = {runtimes = "MD"}}) add_requires("libtiff", {system = false, configs = {runtimes = "MD", zlib = true}}) add_requireconfs("libpng.zlib", {system = false, override = true, configs = {cxflags = "-DTEST1"}, version = "1.2.10"}) add_requireconfs("libtiff.*|cmake", {system = false, configs = {cxflags = "-DTEST2"}}) target("test") set_kind("binary") add_files("src/*.c") add_packages("libpng") before_build(function (target) if target:pkg("libpng") then local found for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do if linkdir:find("zlib[/\\]v1%.2%.10") then found = true end end assert(found, "package(zlib 1.2.10) not found!") end end) target("test2") set_kind("binary") add_files("src/*.c") add_packages("libtiff") before_build(function (target) if target:pkg("libtiff") then local found for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do if linkdir:find("zlib", 1, true) then found = true end end assert(found, "package(zlib) not found!") end end)
0
repos/xmake/tests/projects/package/depconfigs
repos/xmake/tests/projects/package/depconfigs/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/inherit_base/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/inherit_base/xmake.lua
package("myzlib") set_base("zlib") set_urls("https://github.com/madler/zlib.git") package_end() add_requires("myzlib", {system = false, alias = "zlib"}) target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib")
0
repos/xmake/tests/projects/package/inherit_base
repos/xmake/tests/projects/package/inherit_base/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/conan/xmake.lua
add_requires("conan::zlib 1.2.11", {alias = "zlib", debug = true, configs = {settings = "compiler.cppstd=14"}}) add_requires("conan::openssl 1.1.1t", {alias = "openssl", configs = {options = "shared=True"}}) target("test") set_kind("binary") add_files("src/*.cpp") add_packages("openssl", "zlib")
0
repos/xmake/tests/projects/package/conan
repos/xmake/tests/projects/package/conan/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_llvm/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("llvm 14.0.0", {alias = "llvm-14"}) target("test") set_kind("binary") add_files("src/*.c") set_toolchains("llvm@llvm-14")
0
repos/xmake/tests/projects/package/toolchain_llvm
repos/xmake/tests/projects/package/toolchain_llvm/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/cmake/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("cmake::ZLIB", {system = true}) add_requires("cmake::LibXml2", {system = true}) add_requires("cmake::Boost", {system = true, configs = {components = {"regex", "system"}, presets = {Boost_USE_STATIC_LIB = true}}}) target("test") set_kind("binary") add_files("src/*.cpp") add_packages("cmake::ZLIB", "cmake::Boost", "cmake::LibXml2")
0
repos/xmake/tests/projects/package/cmake
repos/xmake/tests/projects/package/cmake/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/rootconfigs/test.lua
function main(t) -- freebsd ci is slower if is_host("bsd") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then t:build() end end
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/rootconfigs/xmake.lua
add_requireconfs("*", {system = false, configs = {debug = false}}) add_requires("zlib", {system = false, debug = true}) target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib")
0
repos/xmake/tests/projects/package/rootconfigs
repos/xmake/tests/projects/package/rootconfigs/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/vcpkg/xmake.lua
add_requires("vcpkg::zlib", "vcpkg::pcre2") add_requires("vcpkg::boost[core]", {alias = "boost"}) target("test") set_kind("binary") add_files("src/*.cpp") add_packages("vcpkg::zlib", "vcpkg::pcre2", "boost")
0
repos/xmake/tests/projects/package/vcpkg
repos/xmake/tests/projects/package/vcpkg/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/vcpkg_manifest/xmake.lua
add_requires("vcpkg::zlib 1.2.11+10") add_requires("vcpkg::fmt >=8.0.1", {configs = {baseline = "50fd3d9957195575849a49fa591e645f1d8e7156"}}) add_requires("vcpkg::libpng", {configs = {features = {"apng"}}}) target("test") set_kind("binary") add_files("src/*.cpp") add_packages("vcpkg::zlib", "vcpkg::fmt", "vcpkg::libpng")
0
repos/xmake/tests/projects/package/vcpkg_manifest
repos/xmake/tests/projects/package/vcpkg_manifest/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_llvm_mingw/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("llvm-mingw") target("test") set_kind("binary") add_files("src/*.c") set_toolchains("mingw@llvm-mingw")
0
repos/xmake/tests/projects/package/toolchain_llvm_mingw
repos/xmake/tests/projects/package/toolchain_llvm_mingw/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/toolchain_tinycc/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("tinycc") target("test") set_kind("binary") add_files("src/*.c") set_toolchains("@tinycc")
0
repos/xmake/tests/projects/package/toolchain_tinycc
repos/xmake/tests/projects/package/toolchain_tinycc/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/package
repos/xmake/tests/projects/package/brew/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("brew::pcre2/libpcre2-8", {alias = "pcre2"}) target("brew") set_kind("binary") add_files("src/*.cpp") add_packages("pcre2") -- -- If you want to known more usage about xmake, please see https://xmake.io -- -- ## FAQ -- -- You can enter the project directory firstly before building project. -- -- $ cd projectdir -- -- 1. How to build project? -- -- $ xmake -- -- 2. How to configure project? -- -- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release] -- -- 3. Where is the build output directory? -- -- The default output directory is `./build` and you can configure the output directory. -- -- $ xmake f -o outputdir -- $ xmake -- -- 4. How to run and debug target after building project? -- -- $ xmake run [targetname] -- $ xmake run -d [targetname] -- -- 5. How to install target to the system directory or other output directory? -- -- $ xmake install -- $ xmake install -o installdir -- -- 6. Add some frequently-used compilation flags in xmake.lua -- -- @code -- -- add debug and release modes -- add_rules("mode.debug", "mode.release") -- -- -- add macro definition -- add_defines("NDEBUG", "_GNU_SOURCE=1") -- -- -- set warning all as error -- set_warnings("all", "error") -- -- -- set language: c99, c++11 -- set_languages("c99", "c++11") -- -- -- set optimization: none, faster, fastest, smallest -- set_optimize("fastest") -- -- -- add include search directories -- add_includedirs("/usr/include", "/usr/local/include") -- -- -- add link libraries and search directories -- add_links("tbox") -- add_linkdirs("/usr/local/lib", "/usr/lib") -- -- -- add system link libraries -- add_syslinks("z", "pthread") -- -- -- add compilation and link flags -- add_cxflags("-stdnolib", "-fno-strict-aliasing") -- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true}) -- -- @endcode --
0
repos/xmake/tests/projects/package/brew
repos/xmake/tests/projects/package/brew/src/main.cpp
#include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; }
0
repos/xmake/tests/projects/pybind
repos/xmake/tests/projects/pybind/example/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("pybind11") target("example") add_rules("python.library") add_files("src/*.cpp") add_packages("pybind11") set_languages("c++11")
0
repos/xmake/tests/projects/pybind/example
repos/xmake/tests/projects/pybind/example/src/example.cpp
#include <pybind11/pybind11.h> #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) int add(int i, int j) { return i + j; } namespace py = pybind11; PYBIND11_MODULE(example, m) { m.doc() = R"pbdoc( Pybind11 example plugin ----------------------- .. currentmodule:: example .. autosummary:: :toctree: _generate add subtract )pbdoc"; m.def("add", &add, R"pbdoc( Add two numbers Some other explanation about the add function. )pbdoc"); m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc"); #ifdef VERSION_INFO m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO); #else m.attr("__version__") = "dev"; #endif }
0
repos/xmake/tests/projects/pybind
repos/xmake/tests/projects/pybind/example_with_soabi/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("pybind11") target("example") add_rules("python.library", {soabi = true}) add_files("src/*.cpp") add_packages("pybind11") set_languages("c++11")
0
repos/xmake/tests/projects/pybind/example_with_soabi
repos/xmake/tests/projects/pybind/example_with_soabi/src/example.cpp
#include <pybind11/pybind11.h> #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) int add(int i, int j) { return i + j; } namespace py = pybind11; PYBIND11_MODULE(example, m) { m.doc() = R"pbdoc( Pybind11 example plugin ----------------------- .. currentmodule:: example .. autosummary:: :toctree: _generate add subtract )pbdoc"; m.def("add", &add, R"pbdoc( Add two numbers Some other explanation about the add function. )pbdoc"); m.def("subtract", [](int i, int j) { return i - j; }, R"pbdoc( Subtract two numbers Some other explanation about the subtract function. )pbdoc"); #ifdef VERSION_INFO m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO); #else m.attr("__version__") = "dev"; #endif }
0
repos/xmake/tests/projects/fortran
repos/xmake/tests/projects/fortran/console/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_files("src/*.f90")
0
repos/xmake/tests/projects/fortran
repos/xmake/tests/projects/fortran/static_library/xmake.lua
add_rules("mode.debug", "mode.release") target("testlib") set_kind("static") add_files("src/test.f90") target("test") set_kind("binary") add_deps("testlib") add_files("src/main.f90")
0
repos/xmake/tests/projects/fortran
repos/xmake/tests/projects/fortran/shared_library/xmake.lua
add_rules("mode.debug", "mode.release") target("testlib") set_kind("shared") add_files("src/test.f90") target("test") set_kind("binary") add_deps("testlib") add_files("src/main.f90")
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/python_cpp/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("python 3.x") target("example") add_rules("swig.cpp", {moduletype = "python"}) add_files("src/example.i", {scriptdir = "share"}) add_files("src/example.cpp") add_packages("python")
0
repos/xmake/tests/projects/swig/python_cpp
repos/xmake/tests/projects/swig/python_cpp/src/example.cpp
double My_variable = 3.0; /* Compute factorial of n */ int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } /* Compute n mod m */ int my_mod(int n, int m) { return(n % m); }
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/python_c/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("python 3.x") target("example") add_rules("swig.c", {moduletype = "python"}) add_files("src/example.i", {scriptdir = "share"}) add_files("src/example.c") add_packages("python")
0
repos/xmake/tests/projects/swig/python_c
repos/xmake/tests/projects/swig/python_c/src/example.c
double My_variable = 3.0; /* Compute factorial of n */ int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } /* Compute n mod m */ int my_mod(int n, int m) { return(n % m); }
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/lua_c/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("lua") target("example") add_rules("swig.c", {moduletype = "lua"}) add_files("src/example.i", {swigflags = "-no-old-metatable-bindings"}) add_files("src/example.c") add_packages("lua")
0
repos/xmake/tests/projects/swig/lua_c
repos/xmake/tests/projects/swig/lua_c/src/example.c
int fact(int n) { return n; }
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/python_c_with_soabi/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("python 3.x") target("example") add_rules("swig.c", {moduletype = "python", soabi = true}) add_files("src/example.i", {scriptdir = "share"}) add_files("src/example.c") add_packages("python")
0
repos/xmake/tests/projects/swig/python_c_with_soabi
repos/xmake/tests/projects/swig/python_c_with_soabi/src/example.c
double My_variable = 3.0; /* Compute factorial of n */ int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } /* Compute n mod m */ int my_mod(int n, int m) { return(n % m); }
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/java_c/xmake.lua
add_rules("mode.release", "mode.debug") -- make sure you config to an enviroment with jni.h -- for example: xmake f -c -p android target("example") set_kind('shared') -- set moduletype to java add_rules("swig.c", {moduletype = "java"}) -- use swigflags to provider package name and output path of java files add_files("src/example.i", {swigflags = { "-package", "com.example", "-outdir", "build/java/com/example/" }}) add_files("src/example.c") before_build(function() -- ensure output path exists before running swig os.mkdir("build/java/com/example/") end)
0
repos/xmake/tests/projects/swig/java_c
repos/xmake/tests/projects/swig/java_c/src/example.c
int fact(int n) { return n; }
0
repos/xmake/tests/projects/swig
repos/xmake/tests/projects/swig/auto_include/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("python 3.x") add_requires("nlohmann_json") target("example") add_rules("swig.cpp", {moduletype = "python"}) add_files("src/example.i", {scriptdir = "share"}) add_files("src/example.cpp") add_packages("python") add_packages("nlohmann_json")
0
repos/xmake/tests/projects/swig/auto_include
repos/xmake/tests/projects/swig/auto_include/src/example.cpp
double My_variable = 3.0; /* Compute factorial of n */ int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } /* Compute n mod m */ int my_mod(int n, int m) { return(n % m); }
0
repos/xmake/tests/apis
repos/xmake/tests/apis/set_toolchains/xmake.lua
-- define toolchain toolchain("myclang") -- mark as standalone toolchain set_kind("standalone") -- set toolset set_toolset("cc", "clang") set_toolset("cxx", "clang", "clang++") set_toolset("ld", "clang++", "clang") set_toolset("sh", "clang++", "clang") set_toolset("ar", "ar") set_toolset("strip", "strip") set_toolset("mm", "clang") set_toolset("mxx", "clang", "clang++") set_toolset("as", "clang") add_defines("MYCLANG") toolchain_end() add_rules("mode.debug", "mode.release") target("test") set_kind("static") add_files("src/interface.cpp") set_toolset("ar", "ar") target("demo") set_kind("binary") add_deps("test") add_files("src/test.cpp") set_toolchains("myclang")
0
repos/xmake/tests/apis/set_toolchains
repos/xmake/tests/apis/set_toolchains/src/test.cpp
#include "interface.h" #include <iostream> using namespace std; int main(int argc, char** argv) { cout << "add(1, 2) = " << add(1, 2) << endl; return 0; }
0
repos/xmake/tests/apis/set_toolchains
repos/xmake/tests/apis/set_toolchains/src/interface.cpp
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/apis/set_toolchains
repos/xmake/tests/apis/set_toolchains/src/interface.h
#ifdef __cplusplus extern "C" { #endif /*! calculate add(a, b) * * @param a the first argument * @param b the second argument * * @return the result */ int add(int a, int b); #ifdef __cplusplus } #endif
0
repos/xmake/tests/apis
repos/xmake/tests/apis/rules/test.lua
function main() os.exec("xmake") end
0
repos/xmake/tests/apis
repos/xmake/tests/apis/rules/xmake.lua
-- define rule: markdown rule("markdown") set_extensions(".md", ".markdown") on_load(function (target) print("markdown: on_load") end) on_build_file(function (target, sourcefile) print("compile %s", sourcefile) os.cp(sourcefile, path.join(target:targetdir(), path.basename(sourcefile) .. ".html")) end) -- define rule: man rule("man") add_imports("core.project.rule") on_build_files(function (target, sourcefiles) for _, sourcefile in ipairs(sourcefiles) do print("generating man: %s", sourcefile) end end) -- define rule: c code rule("c code") add_imports("core.tool.compiler") before_build_file(function (target, sourcefile) print("before_build_file: ", sourcefile) end) on_build_file(function (target, sourcefile, opt) import("core.theme.theme") import("utils.progress") progress.show(opt.progress, "compiling.$(mode) %s", sourcefile) local objectfile_o = os.tmpfile() .. ".o" local sourcefile_c = os.tmpfile() .. ".c" os.cp(sourcefile, sourcefile_c) compiler.compile(sourcefile_c, objectfile_o) table.insert(target:objectfiles(), objectfile_o) end) after_build_file(function (target, sourcefile) print("after_build_file: ", sourcefile) end) -- define rule: stub3 rule("stub3") add_deps("markdown") on_load(function (target) print("rule(stub3): on_load") end) -- define rule: stub2 rule("stub2") add_deps("stub3") on_load(function (target) print("rule(stub2): on_load") end) before_build(function (target) print("rule(stub2): before_build") end) after_build(function (target) print("rule(stub2): after_build") end) before_build_files(function (target) print("rule(stub2): before_build_files") end) after_build_files(function (target) print("rule(stub2): after_build_files") end) -- define rule: stub1 rule("stub1") add_deps("stub2") on_load(function (target) print("rule(stub1): on_load") end) before_build(function (target) print("rule(stub1): before_build") end) after_build(function (target) print("rule(stub1): after_build") end) before_clean(function (target) print("rule(stub1): before_clean") end) after_clean(function (target) print("rule(stub1): after_clean") end) before_install(function (target) print("rule(stub1): before_install") end) on_install(function (target) print("rule(stub1): on_install") end) after_install(function (target) print("rule(stub1): after_install") end) before_uninstall(function (target) print("rule(stub1): before_uninstall") end) on_uninstall(function (target) print("rule(stub1): on_uninstall") end) after_uninstall(function (target) print("rule(stub1): after_uninstall") end) before_package(function (target) print("rule(stub1): before_package") end) on_package(function (target) print("rule(stub1): on_package") end) after_package(function (target) print("rule(stub1): after_package") end) before_run(function (target) print("rule(stub1): before_run") end) on_run(function (target) print("rule(stub1): on_run") end) after_run(function (target) print("rule(stub1): after_run") end) -- define rule: stub0b rule("stub0b") before_build_file(function (target, sourcefile) print("rule(stub0b): before_build_file", sourcefile) end) -- define rule: stub0a rule("stub0a") after_build_file(function (target, sourcefile) print("rule(stub0a): after_build_file", sourcefile) end) -- define target target("test") -- set kind set_kind("binary") -- add rules add_rules("stub1") -- add files add_files("src/*.c|main2.c", {rules = {"stub0a", "stub0b"}}) add_files("src/main2.c", {rules = {"stub0a", "stub0b", override = true}}) add_files("src/man/*.in", {rule = "man"}) add_files("src/index.md") add_files("src/test.c.in", {rule = "c code"}) before_build(function (target) print("target: before_build") end) after_build(function (target) print("target: after_build") end)