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/c
repos/xmake/tests/projects/c/shared_library_export_list/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/shared_library_export_list/xmake.lua
add_rules("mode.release", "mode.debug") target("foo") set_kind("shared") add_files("src/foo.c") add_rules("utils.symbols.export_list", {symbols = { "add", "sub"}}) target("foo2") set_kind("shared") add_files("src/foo.c") add_files("src/foo.export.txt") add_rules("utils.symbols.export_list") target("test") set_kind("binary") add_deps("foo") add_files("src/main.c")
0
repos/xmake/tests/projects/c/shared_library_export_list
repos/xmake/tests/projects/c/shared_library_export_list/src/main.c
#include "foo.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/c/shared_library_export_list
repos/xmake/tests/projects/c/shared_library_export_list/src/foo.export.txt
add sub
0
repos/xmake/tests/projects/c/shared_library_export_list
repos/xmake/tests/projects/c/shared_library_export_list/src/foo.h
#ifdef __cplusplus extern "C" { #endif int add(int a, int b); #ifdef __cplusplus } #endif
0
repos/xmake/tests/projects/c/shared_library_export_list
repos/xmake/tests/projects/c/shared_library_export_list/src/foo.c
#include "foo.h" #include <stdio.h> void stub() { printf("stub\n"); } int sub(int a, int b) { return a - b; } int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/console/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/console/xmake.lua
add_rules("mode.debug", "mode.release") target("test") set_kind("binary") add_files("src/*.c")
0
repos/xmake/tests/projects/c/console
repos/xmake/tests/projects/c/console/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world!\n"); return 0; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/unity_build/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/unity_build/xmake.lua
target("test") set_kind("binary") add_includedirs("src") add_rules("c.unity_build", {batchsize = 2}) add_files("src/*.c", "src/*.cpp") add_files("src/foo/*.c", {unity_group = "foo"}) add_files("src/bar/*.c", {unity_group = "bar"})
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/test2.c
// main.cpp #include "header.h" int test2() { return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/test6.c
// main.cpp #include "header.h" int test6() { return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/main.c
#include "header.h" int main(int argc, char** argv) { printf("hello xmake!\n"); return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/test.cpp
int test_cpp() { return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/test8.c
// main.cpp #include "header.h" int test8() { return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/test7.c
// main.cpp #include "header.h" int test7() { return 0; }
0
repos/xmake/tests/projects/c/unity_build
repos/xmake/tests/projects/c/unity_build/src/header.h
// header.h #ifndef HEADER_H #define HEADER_H #include <stdio.h> #include <stdlib.h> #include <string.h> #endif
0
repos/xmake/tests/projects/c/unity_build/src
repos/xmake/tests/projects/c/unity_build/src/bar/test5.c
// main.cpp #include "header.h" int test5() { return 0; }
0
repos/xmake/tests/projects/c/unity_build/src
repos/xmake/tests/projects/c/unity_build/src/bar/test4.c
// main.cpp #include "header.h" int test4() { return 0; }
0
repos/xmake/tests/projects/c/unity_build/src
repos/xmake/tests/projects/c/unity_build/src/foo/test2.c
// main.cpp #include "header.h" int test3() { return 0; }
0
repos/xmake/tests/projects/c/unity_build/src
repos/xmake/tests/projects/c/unity_build/src/foo/test1.c
// main.cpp #include "header.h" int test() { return 0; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/library_with_cmakelists/test.lua
-- main entry 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/c
repos/xmake/tests/projects/c/library_with_cmakelists/xmake.lua
add_rules("mode.debug", "mode.release") package("foo") add_deps("cmake") set_sourcedir(path.join(os.scriptdir(), "foo")) set_policy("package.install_always", true) on_install(function (package) local configs = {} 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("add", {includes = "foo.h"})) end) package_end() add_requires("foo") target("demo") set_kind("binary") add_files("src/main.c") add_packages("foo")
0
repos/xmake/tests/projects/c/library_with_cmakelists
repos/xmake/tests/projects/c/library_with_cmakelists/src/main.c
#include "foo.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/c/library_with_cmakelists
repos/xmake/tests/projects/c/library_with_cmakelists/foo/CMakeLists.txt
cmake_minimum_required(VERSION 3.13.0) project(foo LANGUAGES C CXX ASM) add_library(foo STATIC "") target_sources(foo PRIVATE src/foo.c ) set_target_properties(foo PROPERTIES PUBLIC_HEADER src/foo.h) include(GNUInstallDirs) install(TARGETS foo LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
0
repos/xmake/tests/projects/c/library_with_cmakelists/foo
repos/xmake/tests/projects/c/library_with_cmakelists/foo/src/foo.h
int add(int a, int b);
0
repos/xmake/tests/projects/c/library_with_cmakelists/foo
repos/xmake/tests/projects/c/library_with_cmakelists/foo/src/foo.c
#include "foo.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/static_library/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/static_library/xmake.lua
add_rules("mode.release", "mode.debug") target("foo") set_kind("static") add_files("src/foo.c") target("demo") set_kind("binary") add_deps("foo") add_files("src/main.c")
0
repos/xmake/tests/projects/c/static_library
repos/xmake/tests/projects/c/static_library/src/main.c
#include "foo.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/c/static_library
repos/xmake/tests/projects/c/static_library/src/foo.h
int add(int a, int b);
0
repos/xmake/tests/projects/c/static_library
repos/xmake/tests/projects/c/static_library/src/foo.c
#include "foo.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/linker_scripts/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/linker_scripts/xmake.lua
add_rules("mode.debug", "mode.release") target("test") add_deps("foo") set_kind("binary") add_files("src/main.c") if is_plat("linux") and is_arch("x86_64") then add_files("src/main.lds") end target("foo") set_kind("shared") add_files("src/foo.c") if is_plat("windows", "mingw") then add_files("src/foo.def") else add_files("src/foo.map") end
0
repos/xmake/tests/projects/c/linker_scripts
repos/xmake/tests/projects/c/linker_scripts/src/main.lds
SECTIONS { . = 0x10000; .text : { *(.text) } .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } . = 0x8000000; .data : { *(.data) } .bss : { *(.bss) } }
0
repos/xmake/tests/projects/c/linker_scripts
repos/xmake/tests/projects/c/linker_scripts/src/main.c
#include <stdio.h> void foo(); int main(int argc, char** argv) { foo(); return 0; }
0
repos/xmake/tests/projects/c/linker_scripts
repos/xmake/tests/projects/c/linker_scripts/src/foo.def
EXPORTS foo
0
repos/xmake/tests/projects/c/linker_scripts
repos/xmake/tests/projects/c/linker_scripts/src/foo.c
#include <stdio.h> void foo() { printf("hello world!\n"); }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/static library with spaces/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/static library with spaces/xmake.lua
add_rules("mode.release", "mode.debug") target("test") set_kind("static") add_files("s r c/interface.c") add_sysincludedirs("$(projectdir)/i n c", {public = true}) target("demo") set_kind("binary") add_deps("test") add_files("s r c/test.c") set_pcheader("$(projectdir)/i n c/stdafx.h")
0
repos/xmake/tests/projects/c/static library with spaces
repos/xmake/tests/projects/c/static library with spaces/s r c/interface.c
#include "interface.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c/static library with spaces
repos/xmake/tests/projects/c/static library with spaces/s r c/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/c/static library with spaces
repos/xmake/tests/projects/c/static library with spaces/i n c/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/c
repos/xmake/tests/projects/c/shared_library/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/shared_library/xmake.lua
add_rules("mode.release", "mode.debug") target("foo") set_kind("shared") add_files("src/foo.c") target("test") set_kind("binary") add_deps("foo") add_files("src/main.c")
0
repos/xmake/tests/projects/c/shared_library
repos/xmake/tests/projects/c/shared_library/src/main.c
#include "foo.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/c/shared_library
repos/xmake/tests/projects/c/shared_library/src/foo.h
#ifdef __cplusplus extern "C" { #endif #if defined(_WIN32) # define __export __declspec(dllexport) #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) # define __export __attribute__((visibility("default"))) #else # define __export #endif __export int add(int a, int b); #ifdef __cplusplus } #endif
0
repos/xmake/tests/projects/c/shared_library
repos/xmake/tests/projects/c/shared_library/src/foo.c
#include "foo.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c/cosmocc
repos/xmake/tests/projects/c/cosmocc/console/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("cosmocc") target("test") set_kind("binary") add_files("src/*.c") set_toolchains("@cosmocc")
0
repos/xmake/tests/projects/c/cosmocc/console
repos/xmake/tests/projects/c/cosmocc/console/src/main.c
#include <stdio.h> int main(int argc, char** argv) { printf("hello world\n"); return 0; }
0
repos/xmake/tests/projects/c/cosmocc
repos/xmake/tests/projects/c/cosmocc/static_library/xmake.lua
add_rules("mode.release", "mode.debug") add_requires("cosmocc") set_toolchains("@cosmocc") target("foo") set_kind("static") add_files("src/foo.c") target("demo") set_kind("binary") add_deps("foo") add_files("src/main.c")
0
repos/xmake/tests/projects/c/cosmocc/static_library
repos/xmake/tests/projects/c/cosmocc/static_library/src/main.c
#include "foo.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/c/cosmocc/static_library
repos/xmake/tests/projects/c/cosmocc/static_library/src/foo.h
int add(int a, int b);
0
repos/xmake/tests/projects/c/cosmocc/static_library
repos/xmake/tests/projects/c/cosmocc/static_library/src/foo.c
#include "foo.h" int add(int a, int b) { return a + b; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/headeronly/test.lua
function main(t) t:build() end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/headeronly/xmake.lua
add_rules("mode.release", "mode.debug") target("foo") set_kind("headeronly") add_headerfiles("src/foo.h") add_rules("utils.install.cmake_importfiles") add_rules("utils.install.pkgconfig_importfiles")
0
repos/xmake/tests/projects/c/headeronly
repos/xmake/tests/projects/c/headeronly/src/foo.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/c
repos/xmake/tests/projects/c/protobuf/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("protobuf-c") target("test") set_kind("binary") add_packages("protobuf-c") add_rules("protobuf.c") add_files("src/*.c") add_files("src/**.proto", {proto_rootdir = "src"})
0
repos/xmake/tests/projects/c/protobuf
repos/xmake/tests/projects/c/protobuf/src/main.c
#include <stdio.h> #include "test.pb-c.h" #include "subdir/test2.pb-c.h" int main(int argc, char** argv) { return 0; }
0
repos/xmake/tests/projects/c/protobuf
repos/xmake/tests/projects/c/protobuf/src/test.proto
syntax = "proto3"; import "subdir/test2.proto"; package test; message TestCase { string name = 4; } message Test { repeated TestCase case = 1; repeated test2.TestCase2 case2 = 2; }
0
repos/xmake/tests/projects/c/protobuf/src
repos/xmake/tests/projects/c/protobuf/src/subdir/test2.proto
syntax = "proto3"; package test2; message TestCase2 { string name = 4; } message Test2 { repeated TestCase2 case = 1; }
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/Unicode 测试/test.lua
-- main entry function main(t) -- build project, xmake does not support unicode for msys2/mingw if not is_subhost("msys", "cygwin") then t:build() end end
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/Unicode 测试/xmake.lua
-- this file saved with utf-16 le for test purpose add_rules("mode.debug", "mode.release") target("程序") set_kind("binary") add_files("源文件🎆/*.c") add_includedirs("头文件✨") before_build(function() print("开始编译😊") end) after_build(function() print("结束编译🎉") end)
0
repos/xmake/tests/projects/c/Unicode 测试
repos/xmake/tests/projects/c/Unicode 测试/源文件🎆/中文.c
#include <标头🎟.h> int main(int argc, char** argv) { hello(); return 0; }
0
repos/xmake/tests/projects/c/Unicode 测试
repos/xmake/tests/projects/c/Unicode 测试/源文件🎆/😘.c
#include <stdio.h> #include <wchar.h> #include <标头🎟.h> void hello() { printf("你好\n"); }
0
repos/xmake/tests/projects/c/Unicode 测试
repos/xmake/tests/projects/c/Unicode 测试/头文件✨/标头🎟.h
#pragma once void hello();
0
repos/xmake/tests/projects/c
repos/xmake/tests/projects/c/asn1c/xmake.lua
add_rules("mode.debug", "mode.release") add_requires("asn1c") target("test") set_kind("binary") add_files("src/*.c") add_files("src/*.asn1") add_rules("asn1c") add_packages("asn1c")
0
repos/xmake/tests/projects/c/asn1c
repos/xmake/tests/projects/c/asn1c/src/main.c
#include <stdio.h> #include <sys/types.h> #include <Rectangle.h> /* Rectangle ASN.1 type */ /* * This is a custom function which writes the * encoded output into some FILE stream. */ static int write_out(const void *buffer, size_t size, void *app_key) { FILE *out_fp = app_key; size_t wrote; wrote = fwrite(buffer, 1, size, out_fp); return (wrote == size) ? 0 : -1; } int main(int ac, char **av) { Rectangle_t *rectangle; /* Type to encode */ asn_enc_rval_t ec; /* Encoder return value */ /* Allocate the Rectangle_t */ rectangle = calloc(1, sizeof(Rectangle_t)); /* not malloc! */ if(!rectangle) { perror("calloc() failed"); exit(71); /* better, EX_OSERR */ } /* * Initialize the Rectangle members */ /* height */ rectangle->height = 42; /* width */ rectangle->width = 23; /* BER encode the data if filename is given */ if(ac < 2) { fprintf(stderr, "Specify filename for BER output\n"); } else { const char *filename = av[1]; FILE *fp = fopen(filename, "wb"); /* for BER output */ if(!fp) { perror(filename); exit(71); /* better, EX_OSERR */ } /* Encode the Rectangle type as BER (DER) */ ec = der_encode(&asn_DEF_Rectangle, rectangle, write_out, fp); fclose(fp); if(ec.encoded == -1) { fprintf(stderr, "Could not encode Rectangle (at %s)\n", ec.failed_type ? ec.failed_type->name : "unknown"); exit(65); /* better, EX_DATAERR */ } else { fprintf(stderr, "Created %s with BER encoded Rectangle\n", filename); } } /* Also print the constructed Rectangle XER encoded (XML) */ xer_fprint(stdout, &asn_DEF_Rectangle, rectangle); return 0; /* Encoding finished successfully */ }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/with_private/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.widgetapp") add_frameworks("QtCore", "QtGui", "QtWidgets", "QtQuick", "QtQuickPrivate", "QtQml", "QtQmlPrivate", "QtCorePrivate", "QtGuiPrivate") add_headerfiles("src/*.h") add_files("src/*.cpp") add_files("src/mainwindow.ui") add_files("src/mainwindow.h")
0
repos/xmake/tests/projects/qt/with_private
repos/xmake/tests/projects/qt/with_private/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/with_private
repos/xmake/tests/projects/qt/with_private/src/mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <private/qquicktext_p.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QQuickText *text = new QQuickText(); delete text; } MainWindow::~MainWindow() { delete ui; }
0
repos/xmake/tests/projects/qt/with_private
repos/xmake/tests/projects/qt/with_private/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/console/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.console") add_files("src/*.cpp")
0
repos/xmake/tests/projects/qt/console
repos/xmake/tests/projects/qt/console/src/main.cpp
#include <QCoreApplication> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); printf("hello xmake\n"); return a.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_static/xmake.lua
add_rules("mode.debug", "mode.release") includes("@builtin/qt") target("demo") add_rules("qt.widgetapp_static") add_headerfiles("src/*.h") add_files("src/*.cpp") add_files("src/mainwindow.ui") add_files("src/mainwindow.h") add_frameworks("QtSvg") qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg"}})
0
repos/xmake/tests/projects/qt/widgetapp_static
repos/xmake/tests/projects/qt/widgetapp_static/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_static
repos/xmake/tests/projects/qt/widgetapp_static/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_static
repos/xmake/tests/projects/qt/widgetapp_static/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/console_static/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.console") add_files("src/*.cpp")
0
repos/xmake/tests/projects/qt/console_static
repos/xmake/tests/projects/qt/console_static/src/main.cpp
#include <QCoreApplication> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); printf("hello xmake\n"); return a.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/static_library/xmake.lua
add_rules("mode.debug", "mode.release") target("qt_demo") add_rules("qt.static") add_headerfiles("src/*.h") add_files("src/*.cpp") add_frameworks("QtGui")
0
repos/xmake/tests/projects/qt/static_library
repos/xmake/tests/projects/qt/static_library/src/demo.cpp
#include "demo.h" QtDemo::QtDemo() { }
0
repos/xmake/tests/projects/qt/static_library
repos/xmake/tests/projects/qt/static_library/src/demo.h
#ifndef QT_DEMO_H #define QT_DEMO_H class QtDemo { public: QtDemo(); }; #endif // QT_DEMO_H
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/quickapp_static/xmake.lua
add_rules("mode.debug", "mode.release") includes("@builtin/qt") target("demo") add_rules("qt.quickapp_static") add_headerfiles("src/*.h") add_files("src/*.cpp") add_files("src/qml.qrc") add_frameworks("QtQuickControls2", "QtQuickTemplates2") qt_add_static_plugins("QtQuick2Plugin", {linkdirs = "qml/QtQuick.2", links = "qtquick2plugin"}) qt_add_static_plugins("QtQuick2WindowPlugin", {linkdirs = "qml/QtQuick/Window.2", links = "windowplugin"}) qt_add_static_plugins("QtQuickControls2Plugin", {linkdirs = "qml/QtQuick/Controls.2", links = "qtquickcontrols2plugin"}) qt_add_static_plugins("QtQuickTemplates2Plugin", {linkdirs = "qml/QtQuick/Templates.2", links = "qtquicktemplates2plugin"})
0
repos/xmake/tests/projects/qt/quickapp_static
repos/xmake/tests/projects/qt/quickapp_static/src/main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { #if QT_VERSION >= 0x50601 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/quickapp/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.quickapp") add_headerfiles("src/*.h") add_files("src/*.cpp") add_files("src/qml.qrc")
0
repos/xmake/tests/projects/qt/quickapp
repos/xmake/tests/projects/qt/quickapp/src/main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { #if QT_VERSION >= 0x50601 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot/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(); 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_slot/mainwindow.cpp
#include "mainwindow.h" #include <QDebug> class MainWindowPrivate { MainWindow *q_ptr; Q_DECLARE_PUBLIC(MainWindow) public: MainWindowPrivate(){} void mainWindow_slot(){qDebug()<<"mainWindow_slot";} }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { d_ptr = new MainWindowPrivate; d_ptr->q_ptr = this; } MainWindow::~MainWindow() { } #include "moc_mainwindow.cpp"
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/widgetapp_private_slot/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_slot/xmake.lua
target("test") add_rules("qt.widgetapp") add_files("mainwindow.h") add_files("*.cpp") add_frameworks("QtCore", "QtGui")
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/with_ts/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") add_files("src/demo_zh_CN.ts") add_files("src/demo_zh_TW.ts", { prefixdir = "translations" })
0
repos/xmake/tests/projects/qt/with_ts
repos/xmake/tests/projects/qt/with_ts/src/demo_zh_TW.ts
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="zh_TW"> <context> <name>MainWindow</name> <message> <location filename="mainwindow.ui" line="14"/> <source>MainWindow</source> <translation>主視窗</translation> </message> <message> <location filename="mainwindow.ui" line="27"/> <source>PushButton</source> <translation>按鈕</translation> </message> </context> </TS>
0
repos/xmake/tests/projects/qt/with_ts
repos/xmake/tests/projects/qt/with_ts/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/with_ts
repos/xmake/tests/projects/qt/with_ts/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/with_ts
repos/xmake/tests/projects/qt/with_ts/src/main.cpp
#include "mainwindow.h" #include <QApplication> #include <QLocale> #include <QTranslator> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTranslator translator; const QStringList uiLanguages = QLocale::system().uiLanguages(); for (const QString& locale : uiLanguages) { const QString baseName = "demo_" + QLocale(locale).name(); if (translator.load(baseName + ".qm")) { a.installTranslator(&translator); break; } } MainWindow w; w.show(); return a.exec(); }
0
repos/xmake/tests/projects/qt/with_ts
repos/xmake/tests/projects/qt/with_ts/src/demo_zh_CN.ts
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="zh_CN"> <context> <name>MainWindow</name> <message> <location filename="mainwindow.ui" line="14"/> <source>MainWindow</source> <translation>主窗口</translation> </message> <message> <location filename="mainwindow.ui" line="27"/> <source>PushButton</source> <translation>按钮</translation> </message> </context> </TS>
0
repos/xmake/tests/projects/qt
repos/xmake/tests/projects/qt/shared_library/xmake.lua
add_rules("mode.debug", "mode.release") target("demo") add_rules("qt.shared") add_headerfiles("src/*.h") add_files("src/*.cpp") add_defines("QT_DEMO_LIBRARY") add_frameworks("QtGui")
0
repos/xmake/tests/projects/qt/shared_library
repos/xmake/tests/projects/qt/shared_library/src/demo.cpp
#include "demo.h" QtDemo::QtDemo() { }