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/qt/shared_library
repos/xmake/tests/projects/qt/shared_library/src/demo.h
#ifndef QT_DEMO_H #define QT_DEMO_H #include "demo_global.h" class QT_DEMOSHARED_EXPORT QtDemo { public: QtDemo(); }; #endif // QT_TEST5_H
0
repos/xmake/tests/projects/qt/shared_library
repos/xmake/tests/projects/qt/shared_library/src/demo_global.h
#ifndef QT_DEMO_GLOBAL_H #define QT_DEMO_GLOBAL_H #include <QtCore/qglobal.h> #if defined(QT_DEMO_LIBRARY) # define QT_DEMOSHARED_EXPORT Q_DECL_EXPORT #else # define QT_DEMOSHARED_EXPORT Q_DECL_IMPORT #endif #endif // QT_TEST5_GLOBAL_H
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.widgetapp") add_headerfiles("src/*.h") add_files("src/*.cpp") add_files("src/mainwindow.ui") add_files("src/mainwindow.h")
0
repos/xmake/tests/projects/qt/widgetapp
repos/xmake/tests/projects/qt/widgetapp/src/mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
0
repos/xmake/tests/projects/qt/widgetapp
repos/xmake/tests/projects/qt/widgetapp/src/mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; }
0
repos/xmake/tests/projects/qt/widgetapp
repos/xmake/tests/projects/qt/widgetapp/src/main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot2/mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE #endif class MainWindowPrivate; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); public Q_SLOTS: void test(); private: MainWindowPrivate *d_ptr; Q_DECLARE_PRIVATE(MainWindow) Q_DISABLE_COPY(MainWindow) Q_PRIVATE_SLOT(d_func(), void mainWindow_slot()) }; #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif #endif // MAINWINDOW_H
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot2/mainwindow.cpp
#include "mainwindow.h" #include <QDebug> class MainWindowPrivate:public QObject { Q_OBJECT public: MainWindow *q_ptr; Q_DECLARE_PUBLIC(MainWindow) public: MainWindowPrivate(){} void mainWindow_slot(){qDebug()<<"mainWindow_slot";} private: Q_PRIVATE_SLOT(q_ptr, void test()) }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { d_ptr = new MainWindowPrivate; d_ptr->q_ptr = this; } MainWindow::~MainWindow() { } void MainWindow::test() { } #include "moc_mainwindow.cpp" #include "mainwindow.moc"
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot2/main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot2/xmake.lua
target("test") add_rules("qt.widgetapp") add_files("main.cpp") add_files("mainwindow.cpp", {rules = "qt.moc"}) add_files("*.h") add_files("*.ui")
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/quickplugin/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.qmlplugin") add_headerfiles("src/*.h") add_files("src/*.cpp") set_values("qt.qmlplugin.import_name", "My.Plugin")
0
repos/xmake/tests/projects/qt/quickplugin
repos/xmake/tests/projects/qt/quickplugin/src/Foo.h
#include <QtCore/QObject> #include <QtQml/qqml.h> class Foo: public QObject { Q_OBJECT Q_PROPERTY(int bar READ bar WRITE setBar NOTIFY barChanged) QML_NAMED_ELEMENT(Foo) public: explicit Foo(QObject *parent = nullptr); int bar() const noexcept; void setBar(int bar) noexcept; Q_SIGNALS: void barChanged(int bar); private: int m_bar; }; QML_DECLARE_TYPE(Foo)
0
repos/xmake/tests/projects/qt/quickplugin
repos/xmake/tests/projects/qt/quickplugin/src/Plugin.h
#include <QtCore/QObject> #include <QtQml/QQmlEngineExtensionPlugin> class Plugin: public QQmlEngineExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: explicit Plugin(QObject *parent = nullptr); };
0
repos/xmake/tests/projects/qt/quickplugin
repos/xmake/tests/projects/qt/quickplugin/src/Foo.cpp
#include "Foo.h" Foo::Foo(QObject *parent) : QObject { parent }, m_bar{ 0 } { } int Foo::bar() const noexcept { return m_bar; } void Foo::setBar(int bar) noexcept { if (bar == m_bar) return; m_bar = bar; Q_EMIT barChanged(m_bar); }
0
repos/xmake/tests/projects/qt/quickplugin
repos/xmake/tests/projects/qt/quickplugin/src/Plugin.cpp
#include "Plugin.h" void qml_register_types_My_Plugin(); ///////////////////////////////////// ///////////////////////////////////// Plugin::Plugin(QObject *parent) : QQmlEngineExtensionPlugin { parent } { volatile auto registration = &qml_register_types_My_Plugin; Q_UNUSED(registration); }
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/console/test.lua
function main(t) if is_host("macosx") and os.arch() ~= "arm64" then -- t:build() else return t:skip("wrong host platform") end end
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/console/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_files("src/*.go")
0
repos/xmake/tests/projects/go/console
repos/xmake/tests/projects/go/console/src/main.go
package main import "fmt" func main() { fmt.Println("hello xmake!") }
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/static_library/test.lua
function main(t) if is_host("macosx") and os.arch() ~= "arm64" then -- t:build() else return t:skip("wrong host platform") end end
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/static_library/xmake.lua
add_rules("mode.debug", "mode.release") target("module") set_kind("static") add_files("src/test/*.go") target("test") set_kind("binary") add_deps("module") add_files("src/*.go")
0
repos/xmake/tests/projects/go/static_library
repos/xmake/tests/projects/go/static_library/src/main.go
package main func main() { Run() }
0
repos/xmake/tests/projects/go/static_library
repos/xmake/tests/projects/go/static_library/src/test.go
package main import ( "fmt" "module" ) func Run() { fmt.Printf("add: %d\n", module.Add(1, 2)); fmt.Printf("sub: %d\n", module.Sub(1, 2)); }
0
repos/xmake/tests/projects/go/static_library/src
repos/xmake/tests/projects/go/static_library/src/test/add.go
package module func Add(a int, b int) int { return a + b; }
0
repos/xmake/tests/projects/go/static_library/src
repos/xmake/tests/projects/go/static_library/src/test/sub.go
package module func Sub(a int, b int) int { return a - b; }
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/console_with_pkgs/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("go::github.com/sirupsen/logrus", {alias = "logrus"}) add_requires("go::golang.org/x/sys/internal/unsafeheader", {alias = "unsafeheader"}) if is_plat("windows") then add_requires("go::golang.org/x/sys/windows", {alias = "syshost"}) else add_requires("go::golang.org/x/sys/unix", {alias = "syshost"}) end target("test") set_kind("binary") add_files("src/*.go") add_packages("logrus", "syshost", "unsafeheader")
0
repos/xmake/tests/projects/go/console_with_pkgs
repos/xmake/tests/projects/go/console_with_pkgs/src/main.go
package main import ( log "github.com/sirupsen/logrus" ) func main() { log.WithFields(log.Fields{"animal": "walrus"}).Info("A walrus appears") }
0
repos/xmake/tests/projects/go
repos/xmake/tests/projects/go/static_library_with_pkgs/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("go::github.com/sirupsen/logrus", {alias = "logrus"}) add_requires("go::golang.org/x/sys/internal/unsafeheader", {alias = "unsafeheader"}) if is_plat("windows") then add_requires("go::golang.org/x/sys/windows", {alias = "syshost"}) else add_requires("go::golang.org/x/sys/unix", {alias = "syshost"}) end target("module") set_kind("static") add_files("src/test/*.go") add_packages("logrus", "syshost", "unsafeheader") target("test") set_kind("binary") add_deps("module") add_files("src/*.go")
0
repos/xmake/tests/projects/go/static_library_with_pkgs
repos/xmake/tests/projects/go/static_library_with_pkgs/src/main.go
package main func main() { Run() }
0
repos/xmake/tests/projects/go/static_library_with_pkgs
repos/xmake/tests/projects/go/static_library_with_pkgs/src/test.go
package main import ( "fmt" "module" ) func Run() { fmt.Printf("add: %d\n", module.Add(1, 2)); fmt.Printf("sub: %d\n", module.Sub(1, 2)); }
0
repos/xmake/tests/projects/go/static_library_with_pkgs/src
repos/xmake/tests/projects/go/static_library_with_pkgs/src/test/add.go
package module import ( log "github.com/sirupsen/logrus" ) func Add(a int, b int) int { log.WithFields(log.Fields{"animal": "walrus"}).Info("A walrus appears") return a + b; }
0
repos/xmake/tests/projects/go/static_library_with_pkgs/src
repos/xmake/tests/projects/go/static_library_with_pkgs/src/test/sub.go
package module func Sub(a int, b int) int { return a - b; }
0
repos/xmake/tests/projects/cppfront
repos/xmake/tests/projects/cppfront/console/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("cppfront") target("test") add_rules("cppfront") set_kind("binary") add_files("src/*.cpp2") add_files("src/*.h2") add_packages("cppfront")
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_archive2/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_archive2/xmake.lua
add_rules("mode.debug", "mode.release") target("add") set_kind("static") add_files("src/add.c") add_files("src/subdir/add.c") target("sub") set_kind("static") add_files("src/sub.c") add_files("src/subdir/sub.c") target("mul") set_kind("static") add_deps("add", "sub") add_files("src/mul.c") set_policy("build.merge_archive", true) target("test") add_deps("mul") add_files("src/main.c")
0
repos/xmake/tests/projects/other/merge_archive2
repos/xmake/tests/projects/other/merge_archive2/src/main.c
#include <stdio.h> int add(int a, int b); int sub(int a, int b); int mul(int a, int b); int subdir_add(int a, int b); int subdir_sub(int a, int b); int main(int argc, char** argv) { printf("%d\n", add(1, 1)); printf("%d\n", sub(1, 1)); printf("%d\n", mul(1, 1)); printf("%d\n", subdir_add(1, 1)); printf("%d\n", subdir_sub(1, 1)); return 0; }
0
repos/xmake/tests/projects/other/merge_archive2
repos/xmake/tests/projects/other/merge_archive2/src/sub.c
int sub(int a, int b) { return a - b; }
0
repos/xmake/tests/projects/other/merge_archive2
repos/xmake/tests/projects/other/merge_archive2/src/mul.c
int mul(int a, int b) { return a * b; }
0
repos/xmake/tests/projects/other/merge_archive2
repos/xmake/tests/projects/other/merge_archive2/src/add.c
int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/merge_archive2/src
repos/xmake/tests/projects/other/merge_archive2/src/subdir/sub.c
int subdir_sub(int a, int b) { return a - b; }
0
repos/xmake/tests/projects/other/merge_archive2/src
repos/xmake/tests/projects/other/merge_archive2/src/subdir/add.c
int subdir_add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other/parse_headerdeps
repos/xmake/tests/projects/other/parse_headerdeps/src/test1.cpp
// test1.cpp #include "common/test1.hpp" int main(int argc, char** argv) { f(); return 0; }
0
repos/xmake/tests/projects/other/parse_headerdeps
repos/xmake/tests/projects/other/parse_headerdeps/src/xmake.lua
-- xmake.lua -- global add_rules('mode.debug', 'mode.release') set_version('0.1.0') set_kind('binary') add_includedirs('..') set_warnings('all') --set_languages('cxx20') target('test1') add_files('test1.cpp')
0
repos/xmake/tests/projects/other/parse_headerdeps
repos/xmake/tests/projects/other/parse_headerdeps/common/test1.hpp
// ../common/test1.hpp #include <iostream> void f() { std::cout << "f()" << std::endl; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_archive/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/merge_archive/xmake.lua
add_rules("mode.debug", "mode.release") target("add") set_kind("static") add_files("src/add.c") set_targetdir("$(buildir)/merge_archive") target("sub") set_kind("static") add_files("src/sub.c") set_targetdir("$(buildir)/merge_archive") target("mul") set_kind("static") add_deps("add", "sub") add_files("src/mul.c") set_policy("build.across_targets_in_parallel", false) if is_plat("windows") then add_files("$(buildir)/merge_archive/*.lib") else add_files("$(buildir)/merge_archive/*.a") end
0
repos/xmake/tests/projects/other/merge_archive
repos/xmake/tests/projects/other/merge_archive/src/sub.c
int sub(int a, int b) { return a - b; }
0
repos/xmake/tests/projects/other/merge_archive
repos/xmake/tests/projects/other/merge_archive/src/mul.c
int mul(int a, int b) { return a * b; }
0
repos/xmake/tests/projects/other/merge_archive
repos/xmake/tests/projects/other/merge_archive/src/add.c
int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/multiplats_vs/test.lua
function test_multivs(t) if is_subhost("windows") then t:build() else return t:skip("wrong host platform") end end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/multiplats_vs/xmake.lua
add_rules("mode.debug", "mode.release") rule("vs2015_x86") on_load(function (target) target:set("arch", "x86") target:set("toolchains", "msvc", {vs = "2015"}) end) target("testvs_vs2015_x86") set_kind("binary") add_files("src/*.cpp", "src/*.rc") add_rules("vs2015_x86") target("testvs") set_kind("binary") add_files("src/*.cpp", "src/*.rc")
0
repos/xmake/tests/projects/other/multiplats_vs
repos/xmake/tests/projects/other/multiplats_vs/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/other
repos/xmake/tests/projects/other/group/xmake.lua
add_rules("mode.debug", "mode.release") target("test1") set_kind("binary") add_files("src/*.cpp") set_group("group1") target("test2") set_kind("binary") add_files("src/*.cpp") set_group("group1") target("test3") set_kind("binary") add_files("src/*.cpp") set_group("group1/group2") target("test4") set_kind("binary") add_files("src/*.cpp") set_group("group3/group4") target("test5") set_kind("binary") add_files("src/*.cpp") target("test6") set_kind("binary") add_files("src/*.cpp")
0
repos/xmake/tests/projects/other/group
repos/xmake/tests/projects/other/group/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/other
repos/xmake/tests/projects/other/parallel_build/2.cpp
// Make this object complex and cost longer compile time... #include <algorithm> #include <any> #include <bitset> #include <filesystem> #include <fstream> #include <iostream> #include <list> #include <map> #include <optional> #include <queue> #include <string> #include <unordered_map> #include <variant> #include <vector> int main(int argc, char** argv) { using Type = std::variant<int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, double, float>; Type a, b, c; a = 5; b = 3.0; c = 4.0f; double r; std::visit([&](auto a, auto b, auto c) { r = a + b + c; }, a, b, c); std::visit([&](auto a, auto b, auto c) { r = a + b - c; }, a, b, c); std::visit([&](auto a, auto b, auto c) { r = a - b - c; }, a, b, c); std::visit([&](auto a, auto b, auto c) { r = (a + b + c) * 2; }, a, b, c); std::visit([&](auto a, auto b, auto c) { r = (a + b - c) * 3; }, a, b, c); return 0; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/parallel_build/1.cpp
int main(int argv, char** argv) { return 0; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/parallel_build/xmake.lua
-- These targets should compiled and linked concurrently. add_rules("mode.release", "mode.debug", "mode.releasedbg") set_policy("build.ccache", false) target("first") set_kind("binary") add_files("1.cpp") set_languages("clatest", "cxx20") target("second") set_kind("binary") add_files("2.cpp") set_languages("clatest", "cxx20")
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/ispc/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_rules("utils.ispc", {header_extension = "_ispc.h"}) set_values("ispc.flags", "--target=host") add_files("src/*.ispc") add_files("src/*.cpp")
0
repos/xmake/tests/projects/other/ispc
repos/xmake/tests/projects/other/ispc/src/main.cpp
#include "test_ispc.h" using namespace ispc; int main(int argc, char *argv[]) { test_ispc(); }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/hlsl2spv/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("glslang", {configs = {binaryonly = true}}) target("test") set_kind("binary") add_rules("utils.hlsl2spv", {bin2c = true}) add_files("src/*.c") add_files("src/*.hlsl", "src/*.hlsl") add_packages("directxshadercompiler")
0
repos/xmake/tests/projects/other/hlsl2spv
repos/xmake/tests/projects/other/hlsl2spv/src/main.c
#include <stdio.h> static unsigned char g_test_vert_spv_data[] = { #include "test.vs.spv.h" }; static unsigned char g_test_frag_spv_data[] = { #include "test.ps.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/native_module
repos/xmake/tests/projects/other/native_module/hello/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/native_module
repos/xmake/tests/projects/other/native_module/hello/xmake.lua
add_rules("mode.debug", "mode.release") add_moduledirs("modules") target("test") set_kind("binary") add_files("src/*.cpp") on_config(function (target) import("shared.foo", {always_build = true}) import("binary.bar") print("foo: 1 + 1 = %d", foo.add(1, 1)) print("foo: 1 - 1 = %d", foo.sub(1, 1)) print("bar: 1 + 1 = %s", bar.add(1, 1)) print("bar: 1 - 1 = %s", bar.sub(1, 1)) end)
0
repos/xmake/tests/projects/other/native_module/hello/modules/shared
repos/xmake/tests/projects/other/native_module/hello/modules/shared/foo/xmake.lua
add_rules("mode.debug", "mode.release") target("foo") add_rules("module.shared") add_files("src/foo.c")
0
repos/xmake/tests/projects/other/native_module/hello/modules/shared/foo
repos/xmake/tests/projects/other/native_module/hello/modules/shared/foo/src/foo.c
#include <xmi.h> static int add(lua_State* lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a + b); return 1; } static int sub(lua_State* lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a - b); return 1; } int luaopen(foo, lua_State* lua) { static const luaL_Reg funcs[] = { {"add", add}, {"sub", sub}, {NULL, NULL} }; lua_newtable(lua); luaL_setfuncs(lua, funcs, 0); return 1; }
0
repos/xmake/tests/projects/other/native_module/hello/modules/binary
repos/xmake/tests/projects/other/native_module/hello/modules/binary/bar/xmake.lua
add_rules("mode.debug", "mode.release") target("add") add_rules("module.binary") add_files("src/add.cpp") target("sub") add_rules("module.binary") add_files("src/sub.cpp")
0
repos/xmake/tests/projects/other/native_module/hello/modules/binary/bar
repos/xmake/tests/projects/other/native_module/hello/modules/binary/bar/src/add.cpp
#include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a + b); return 0; }
0
repos/xmake/tests/projects/other/native_module/hello/modules/binary/bar
repos/xmake/tests/projects/other/native_module/hello/modules/binary/bar/src/sub.cpp
#include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { int a = atoi(argv[1]); int b = atoi(argv[2]); printf("%d", a - b); return 0; }
0
repos/xmake/tests/projects/other/native_module/hello
repos/xmake/tests/projects/other/native_module/hello/src/main.cpp
#include <iostream> int main(int argc, char** argv) { std::cout << "hello world!" << std::endl; return 0; }
0
repos/xmake/tests/projects/other/native_module
repos/xmake/tests/projects/other/native_module/cjson/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/native_module
repos/xmake/tests/projects/other/native_module/cjson/xmake.lua
add_rules("mode.debug", "mode.release") add_moduledirs("modules") target("test") set_kind("binary") add_files("src/*.cpp") on_config(function (target) import("lua.cjson", {always_build = true}) print(cjson.decode('{"foo": 1, "bar": [1, 2, 3]}')) end)
0
repos/xmake/tests/projects/other/native_module/cjson/modules/lua
repos/xmake/tests/projects/other/native_module/cjson/modules/lua/cjson/xmake.lua
add_rules("mode.debug", "mode.release") target("cjson") add_rules("module.shared") set_warnings("all") if is_plat("windows") then set_languages("c89") end add_files("src/*.c") add_files("../../../../../../../../core/src/lua-cjson/lua-cjson/*.c|fpconv.c") -- Use internal strtod() / g_fmt() code for performance and disable multi-thread add_defines("NDEBUG", "USE_INTERNAL_FPCONV") add_defines("XM_CONFIG_API_HAVE_LUA_CJSON") if is_plat("windows") then -- Windows sprintf()/strtod() handle NaN/inf differently. Not supported. add_defines("DISABLE_INVALID_NUMBERS") add_defines("inline=__inline") end
0
repos/xmake/tests/projects/other/native_module/cjson/modules/lua/cjson
repos/xmake/tests/projects/other/native_module/cjson/modules/lua/cjson/src/cjson.c
#include <xmi.h> int luaopen_cjson(lua_State* lua); int luaopen(cjson, lua_State* lua) { return luaopen_cjson(lua); }
0
repos/xmake/tests/projects/other/native_module/cjson
repos/xmake/tests/projects/other/native_module/cjson/src/main.cpp
#include <iostream> int main(int argc, char** argv) { std::cout << "hello world!" << std::endl; return 0; }
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_codedep/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_codedep/xmake.lua
add_rules("mode.debug", "mode.release") rule("autogen") set_extensions(".in") before_buildcmd_file(function (target, batchcmds, sourcefile, opt) local sourcefile_cx = path.join(target:autogendir(), "rules", "autogen", path.basename(sourcefile) .. ".cpp") local objectfile = target:objectfile(sourcefile_cx) table.insert(target:objectfiles(), objectfile) batchcmds:show_progress(opt.progress, "${color.build.object}compiling.autogen %s", sourcefile) batchcmds:mkdir(path.directory(sourcefile_cx)) batchcmds:vrunv(target:dep("autogen"):targetfile(), {sourcefile, sourcefile_cx}) batchcmds:compile(sourcefile_cx, objectfile) batchcmds:add_depfiles(sourcefile, target:dep("autogen"):targetfile()) batchcmds:set_depmtime(os.mtime(objectfile)) batchcmds:set_depcache(target:dependfile(objectfile)) end) target("autogen") set_default(false) set_kind("binary") set_plat(os.host()) set_arch(os.arch()) add_files("src/autogen.cpp") set_languages("c++11") set_policy("build.fence", true) target("test") set_kind("binary") add_deps("autogen") add_rules("autogen") add_files("src/main.cpp") add_files("src/*.in")
0
repos/xmake/tests/projects/other/autogen/autogen_codedep
repos/xmake/tests/projects/other/autogen/autogen_codedep/src/main.cpp
#include <iostream> using namespace std; extern unsigned char g_codegen_data[]; int main(int argc, char** argv) { cout << (const char*)g_codegen_data << endl; return 0; }
0
repos/xmake/tests/projects/other/autogen/autogen_codedep
repos/xmake/tests/projects/other/autogen/autogen_codedep/src/autogen.cpp
#include <iostream> #include <fstream> #include <vector> using namespace std; int main(int argc, char** argv) { ifstream src_file(argv[1], ios::in | ios::binary); if (!src_file) { return 1; } vector<char> buffer(istreambuf_iterator<char>(src_file), {}); src_file.close(); ofstream dst_file(argv[2], ios::out); if (!dst_file) { return 1; } dst_file << "unsigned char g_codegen_data[] = {"; for (auto byte : buffer) { dst_file << "0x" << hex << (int)(unsigned char)byte << ","; } dst_file << "0};" << endl; dst_file.close(); return 0; }
0
repos/xmake/tests/projects/other/autogen/autogen_codedep
repos/xmake/tests/projects/other/autogen/autogen_codedep/src/data.in
hello world!
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_binary_module/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_binary_module/xmake.lua
add_rules("mode.debug", "mode.release") add_moduledirs("modules") rule("autogen") set_extensions(".in") before_build_file(function (target, sourcefile, opt) import("utils.progress") import("core.project.depend") import("core.tool.compiler") import("autogen.foo", {always_build = true}) local sourcefile_cx = path.join(target:autogendir(), "rules", "autogen", path.basename(sourcefile) .. ".cpp") local objectfile = target:objectfile(sourcefile_cx) table.insert(target:objectfiles(), objectfile) depend.on_changed(function () progress.show(opt.progress, "${color.build.object}compiling.autogen %s", sourcefile) os.mkdir(path.directory(sourcefile_cx)) foo.generate(sourcefile, sourcefile_cx) compiler.compile(sourcefile_cx, objectfile, {target = target}) end, {dependfile = target:dependfile(objectfile), files = sourcefile, changed = target:is_rebuilt()}) end) target("test") set_kind("binary") add_rules("autogen") add_files("src/main.cpp") add_files("src/*.in")
0
repos/xmake/tests/projects/other/autogen/autogen_binary_module/modules/autogen
repos/xmake/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/xmake.lua
add_rules("mode.debug", "mode.release") target("generate") add_rules("module.binary") add_files("src/*.cpp") set_languages("c++11")
0
repos/xmake/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo
repos/xmake/tests/projects/other/autogen/autogen_binary_module/modules/autogen/foo/src/main.cpp
#include <iostream> #include <fstream> #include <vector> using namespace std; int main(int argc, char** argv) { ifstream src_file(argv[1], ios::in | ios::binary); if (!src_file) { return 1; } vector<char> buffer(istreambuf_iterator<char>(src_file), {}); src_file.close(); ofstream dst_file(argv[2], ios::out); if (!dst_file) { return 1; } dst_file << "unsigned char g_codegen_data[] = {"; for (auto byte : buffer) { dst_file << "0x" << hex << (int)(unsigned char)byte << ","; } dst_file << "0};" << endl; dst_file.close(); return 0; }
0
repos/xmake/tests/projects/other/autogen/autogen_binary_module
repos/xmake/tests/projects/other/autogen/autogen_binary_module/src/main.cpp
#include <iostream> using namespace std; extern unsigned char g_codegen_data[]; int main(int argc, char** argv) { cout << (const char*)g_codegen_data << endl; return 0; }
0
repos/xmake/tests/projects/other/autogen/autogen_binary_module
repos/xmake/tests/projects/other/autogen/autogen_binary_module/src/data.in
hello world!
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_code/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_code/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_files("$(buildir)/autogen.cpp", {always_added = true}) before_build(function (target) io.writefile("$(buildir)/autogen.cpp", [[ #include <iostream> using namespace std; int main(int argc, char** argv) { cout << "hello world!" << endl; return 0; } ]]) end)
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_shared_module/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other/autogen
repos/xmake/tests/projects/other/autogen/autogen_shared_module/xmake.lua
add_rules("mode.debug", "mode.release") add_moduledirs("modules") rule("autogen") set_extensions(".in") before_build_file(function (target, sourcefile, opt) import("utils.progress") import("core.project.depend") import("core.tool.compiler") import("autogen.foo", {always_build = true}) local sourcefile_cx = path.join(target:autogendir(), "rules", "autogen", path.basename(sourcefile) .. ".cpp") local objectfile = target:objectfile(sourcefile_cx) table.insert(target:objectfiles(), objectfile) depend.on_changed(function () progress.show(opt.progress, "${color.build.object}compiling.autogen %s", sourcefile) os.mkdir(path.directory(sourcefile_cx)) foo.generate(sourcefile, sourcefile_cx) compiler.compile(sourcefile_cx, objectfile, {target = target}) end, {dependfile = target:dependfile(objectfile), files = sourcefile, changed = target:is_rebuilt()}) end) target("test") set_kind("binary") add_rules("autogen") add_files("src/main.cpp") add_files("src/*.in")
0
repos/xmake/tests/projects/other/autogen/autogen_shared_module/modules/autogen
repos/xmake/tests/projects/other/autogen/autogen_shared_module/modules/autogen/foo/xmake.lua
add_rules("mode.debug", "mode.release") target("foo") add_rules("module.shared") add_files("src/*.cpp") set_languages("c++11")
0
repos/xmake/tests/projects/other/autogen/autogen_shared_module/modules/autogen/foo
repos/xmake/tests/projects/other/autogen/autogen_shared_module/modules/autogen/foo/src/main.cpp
#include <xmi.h> #include <iostream> #include <fstream> #include <vector> using namespace std; static int generate(lua_State* lua) { const char* inputfile = lua_tostring(lua, 1); const char* outputfile = lua_tostring(lua, 2); ifstream src_file(inputfile, ios::in | ios::binary); if (!src_file) { return 1; } vector<char> buffer(istreambuf_iterator<char>(src_file), {}); src_file.close(); ofstream dst_file(outputfile, ios::out); if (!dst_file) { return 1; } dst_file << "unsigned char g_codegen_data[] = {"; for (auto byte : buffer) { dst_file << "0x" << hex << (int)(unsigned char)byte << ","; } dst_file << "0};" << endl; dst_file.close(); return 0; } int luaopen(foo, lua_State* lua) { static const luaL_Reg funcs[] = { {"generate", generate}, {NULL, NULL} }; lua_newtable(lua); luaL_setfuncs(lua, funcs, 0); return 1; }
0
repos/xmake/tests/projects/other/autogen/autogen_shared_module
repos/xmake/tests/projects/other/autogen/autogen_shared_module/src/main.cpp
#include <iostream> using namespace std; extern unsigned char g_codegen_data[]; int main(int argc, char** argv) { cout << (const char*)g_codegen_data << endl; return 0; }
0
repos/xmake/tests/projects/other/autogen/autogen_shared_module
repos/xmake/tests/projects/other/autogen/autogen_shared_module/src/data.in
hello world!
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/bin2c/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/bin2c/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_rules("utils.bin2c", {linewidth = 16, extensions = {".bin", ".png"}}) add_files("src/*.c") add_files("src/*.bin") add_files("src/*.png")
0
repos/xmake/tests/projects/other/bin2c
repos/xmake/tests/projects/other/bin2c/src/main.c
#include <stdio.h> static unsigned char g_bin_data[] = { #include "data.bin.h" }; static unsigned char g_png_data[] = { #include "image.png.h" }; int main(int argc, char** argv) { printf("data.bin: %s, size: %d\n", g_bin_data, (int)sizeof(g_bin_data)); printf("image.png: %s, size: %d\n", g_png_data, (int)sizeof(g_png_data)); return 0; }
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/build_deps/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/other
repos/xmake/tests/projects/other/build_deps/xmake.lua
add_rules("mode.release", "mode.debug") target("dep1") set_kind("static") add_deps("dep3") add_files("src/dep1.c") set_policy("build.across_targets_in_parallel", false) after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep3"):targetfile()) end) before_link(function (target) assert(os.isfile(target:dep("dep3"):targetfile()), "dep1: before_link failed!") end) after_link(function (target) assert(os.isfile(target:targetfile()), "dep1: after_link failed!") end) on_install(function (target) end) target("dep2") set_kind("static") add_deps("dep3") add_files("src/dep2.c") set_policy("build.across_targets_in_parallel", false) after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep3"):targetfile()) end) before_link(function (target) assert(os.isfile(target:dep("dep3"):targetfile()), "dep2: before_link failed!") end) after_link(function (target) assert(os.isfile(target:targetfile()), "dep2: after_link failed!") end) on_install(function (target) end) target("dep3") set_kind("static") add_files("src/dep3.c") add_deps("dep4", "dep5") set_policy("build.across_targets_in_parallel", false) after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep4"):targetfile()) os.rm(target:dep("dep5"):targetfile()) end) after_link(function (target) assert(os.isfile(target:targetfile()), "dep3: after_link failed!") assert(os.isfile(target:dep("dep4"):targetfile()), "dep3: after_link failed!") assert(os.isfile(target:dep("dep5"):targetfile()), "dep3: after_link failed!") end) on_install(function (target) end) target("dep4") set_kind("static") add_files("src/dep4.c") after_load(function (target) os.rm(target:targetfile()) end) after_link(function (target) assert(os.isfile(target:targetfile()), "dep4: after_link failed!") end) on_install(function (target) end) target("dep5") set_kind("static") add_files("src/dep5.c") after_load(function (target) os.rm(target:targetfile()) end) after_link(function (target) assert(os.isfile(target:targetfile()), "dep5: after_link failed!") end) on_install(function (target) end) target("test1") set_kind("binary") add_deps("dep1", "dep2") add_files("src/test1.c") after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep1"):targetfile()) os.rm(target:dep("dep2"):targetfile()) os.rm(target:dep("dep3"):targetfile()) end) before_link(function (target) assert(os.isfile(target:dep("dep1"):targetfile()), "test1: before_link failed!") assert(os.isfile(target:dep("dep2"):targetfile()), "test1: before_link failed!") assert(os.isfile(target:dep("dep3"):targetfile()), "test1: before_link failed!") end) after_link(function (target) assert(os.isfile(target:targetfile()), "test1: after_link failed!") end) on_install(function (target) end) target("test2") set_kind("binary") add_deps("dep1") add_files("src/test2.c") after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep1"):targetfile()) os.rm(target:dep("dep3"):targetfile()) end) before_link(function (target) assert(os.isfile(target:dep("dep1"):targetfile()), "test2: before_link failed!") assert(os.isfile(target:dep("dep3"):targetfile()), "test2: before_link failed!") end) after_link(function (target) assert(os.isfile(target:targetfile()), "test2: after_link failed!") end) on_install(function (target) end) rule("test3") before_build(function (target) assert(os.isfile(target:dep("dep1"):targetfile()), "test2: before_build/rule failed!") assert(os.isfile(target:dep("dep3"):targetfile()), "test2: before_build/rule failed!") end) target("test3") set_kind("binary") add_deps("dep1") add_rules("test3") add_files("src/test3.c") after_load(function (target) os.rm(target:targetfile()) os.rm(target:dep("dep1"):targetfile()) os.rm(target:dep("dep3"):targetfile()) end) before_build(function (target) assert(os.isfile(target:dep("dep1"):targetfile()), "test2: before_build failed!") assert(os.isfile(target:dep("dep3"):targetfile()), "test2: before_build failed!") end) after_link(function (target) assert(os.isfile(target:targetfile()), "test2: after_link failed!") end) on_install(function (target) end)
0
repos/xmake/tests/projects/other/build_deps
repos/xmake/tests/projects/other/build_deps/src/test2.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/dep2.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/test1.c
#include "interface.h" #include <stdio.h> int main(int argc, char** argv) { printf("add(1, 2) = %d\n", add(1, 2)); return 0; }