From 074d2607f20aa675e6835c0e31e8876d2f05da57 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 14 Sep 2019 21:44:31 +0800 Subject: improve project template --- xmake/actions/create/xmake.lua | 15 +++- xmake/core/project/template.lua | 6 -- .../templates/c++/console_qt/project/src/main.cpp | 9 -- xmake/templates/c++/console_qt/project/xmake.lua | 13 --- xmake/templates/c++/console_qt/template.lua | 15 ---- .../c++/console_tbox/project/src/main.cpp | 20 ----- .../c++/console_tbox/project/src/xmake.lua | 15 ---- xmake/templates/c++/console_tbox/project/xmake.lua | 69 --------------- xmake/templates/c++/console_tbox/template.lua | 15 ---- .../templates/c++/qt.console/project/src/main.cpp | 9 ++ xmake/templates/c++/qt.console/project/xmake.lua | 13 +++ xmake/templates/c++/qt.console/template.lua | 15 ++++ .../templates/c++/qt.quickapp/project/src/main.cpp | 16 ++++ .../templates/c++/qt.quickapp/project/src/main.qml | 9 ++ .../templates/c++/qt.quickapp/project/src/qml.qrc | 5 ++ xmake/templates/c++/qt.quickapp/project/xmake.lua | 18 ++++ xmake/templates/c++/qt.quickapp/template.lua | 15 ++++ .../c++/qt.quickapp_static/project/src/main.cpp | 16 ++++ .../c++/qt.quickapp_static/project/src/main.qml | 9 ++ .../c++/qt.quickapp_static/project/src/qml.qrc | 5 ++ .../c++/qt.quickapp_static/project/xmake.lua | 24 ++++++ .../templates/c++/qt.quickapp_static/template.lua | 15 ++++ xmake/templates/c++/qt.shared/project/src/demo.cpp | 6 ++ xmake/templates/c++/qt.shared/project/src/demo.h | 13 +++ .../c++/qt.shared/project/src/demo_global.h | 12 +++ xmake/templates/c++/qt.shared/project/xmake.lua | 21 +++++ xmake/templates/c++/qt.shared/template.lua | 15 ++++ xmake/templates/c++/qt.static/project/src/demo.cpp | 5 ++ xmake/templates/c++/qt.static/project/src/demo.h | 11 +++ xmake/templates/c++/qt.static/project/xmake.lua | 18 ++++ xmake/templates/c++/qt.static/template.lua | 15 ++++ .../c++/qt.widgetapp/project/src/main.cpp | 11 +++ .../c++/qt.widgetapp/project/src/mainwindow.cpp | 14 ++++ .../c++/qt.widgetapp/project/src/mainwindow.h | 22 +++++ .../c++/qt.widgetapp/project/src/mainwindow.ui | 24 ++++++ xmake/templates/c++/qt.widgetapp/project/xmake.lua | 21 +++++ xmake/templates/c++/qt.widgetapp/template.lua | 15 ++++ .../c++/qt.widgetapp_static/project/src/main.cpp | 11 +++ .../qt.widgetapp_static/project/src/mainwindow.cpp | 14 ++++ .../qt.widgetapp_static/project/src/mainwindow.h | 22 +++++ .../qt.widgetapp_static/project/src/mainwindow.ui | 24 ++++++ .../c++/qt.widgetapp_static/project/xmake.lua | 25 ++++++ .../templates/c++/qt.widgetapp_static/template.lua | 15 ++++ .../templates/c++/quickapp_qt/project/src/main.cpp | 16 ---- .../templates/c++/quickapp_qt/project/src/main.qml | 9 -- .../templates/c++/quickapp_qt/project/src/qml.qrc | 5 -- xmake/templates/c++/quickapp_qt/project/xmake.lua | 18 ---- xmake/templates/c++/quickapp_qt/template.lua | 15 ---- .../c++/quickapp_qt_static/project/src/main.cpp | 16 ---- .../c++/quickapp_qt_static/project/src/main.qml | 9 -- .../c++/quickapp_qt_static/project/src/qml.qrc | 5 -- .../c++/quickapp_qt_static/project/xmake.lua | 24 ------ .../templates/c++/quickapp_qt_static/template.lua | 15 ---- .../templates/c++/shared/project/src/interface.cpp | 6 ++ xmake/templates/c++/shared/project/src/interface.h | 24 ++++++ xmake/templates/c++/shared/project/src/test.cpp | 10 +++ xmake/templates/c++/shared/project/xmake.lua | 26 ++++++ xmake/templates/c++/shared/template.lua | 14 ++++ .../c++/shared_library/project/src/interface.cpp | 6 -- .../c++/shared_library/project/src/interface.h | 24 ------ .../c++/shared_library/project/src/test.cpp | 10 --- .../templates/c++/shared_library/project/xmake.lua | 26 ------ xmake/templates/c++/shared_library/template.lua | 14 ---- .../c++/shared_library_qt/project/src/demo.cpp | 6 -- .../c++/shared_library_qt/project/src/demo.h | 13 --- .../shared_library_qt/project/src/demo_global.h | 12 --- .../c++/shared_library_qt/project/xmake.lua | 21 ----- xmake/templates/c++/shared_library_qt/template.lua | 15 ---- .../shared_library_tbox/project/src/_demo/main.cpp | 23 ----- .../project/src/_demo/xmake.lua | 18 ---- .../project/src/_library/interface.cpp | 12 --- .../project/src/_library/interface.h | 29 ------- .../project/src/_library/xmake.lua | 21 ----- .../c++/shared_library_tbox/project/xmake.lua | 69 --------------- .../templates/c++/shared_library_tbox/template.lua | 25 ------ .../c++/static_library_qt/project/src/demo.cpp | 5 -- .../c++/static_library_qt/project/src/demo.h | 11 --- .../c++/static_library_qt/project/xmake.lua | 18 ---- xmake/templates/c++/static_library_qt/template.lua | 15 ---- .../static_library_tbox/project/src/_demo/main.cpp | 23 ----- .../project/src/_demo/xmake.lua | 18 ---- .../project/src/_library/interface.cpp | 12 --- .../project/src/_library/interface.h | 29 ------- .../project/src/_library/xmake.lua | 21 ----- .../c++/static_library_tbox/project/xmake.lua | 69 --------------- .../templates/c++/static_library_tbox/template.lua | 25 ------ .../c++/tbox.console/project/src/main.cpp | 20 +++++ .../c++/tbox.console/project/src/xmake.lua | 15 ++++ xmake/templates/c++/tbox.console/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c++/tbox.console/template.lua | 15 ++++ .../c++/tbox.shared/project/src/_demo/main.cpp | 23 +++++ .../c++/tbox.shared/project/src/_demo/xmake.lua | 18 ++++ .../tbox.shared/project/src/_library/interface.cpp | 12 +++ .../tbox.shared/project/src/_library/interface.h | 29 +++++++ .../c++/tbox.shared/project/src/_library/xmake.lua | 21 +++++ xmake/templates/c++/tbox.shared/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c++/tbox.shared/template.lua | 25 ++++++ .../c++/tbox.static/project/src/_demo/main.cpp | 23 +++++ .../c++/tbox.static/project/src/_demo/xmake.lua | 18 ++++ .../tbox.static/project/src/_library/interface.cpp | 12 +++ .../tbox.static/project/src/_library/interface.h | 29 +++++++ .../c++/tbox.static/project/src/_library/xmake.lua | 21 +++++ xmake/templates/c++/tbox.static/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c++/tbox.static/template.lua | 25 ++++++ .../c++/widgetapp_qt/project/src/main.cpp | 11 --- .../c++/widgetapp_qt/project/src/mainwindow.cpp | 14 ---- .../c++/widgetapp_qt/project/src/mainwindow.h | 22 ----- .../c++/widgetapp_qt/project/src/mainwindow.ui | 24 ------ xmake/templates/c++/widgetapp_qt/project/xmake.lua | 21 ----- xmake/templates/c++/widgetapp_qt/template.lua | 15 ---- .../c++/widgetapp_qt_static/project/src/main.cpp | 11 --- .../widgetapp_qt_static/project/src/mainwindow.cpp | 14 ---- .../widgetapp_qt_static/project/src/mainwindow.h | 22 ----- .../widgetapp_qt_static/project/src/mainwindow.ui | 24 ------ .../c++/widgetapp_qt_static/project/xmake.lua | 25 ------ .../templates/c++/widgetapp_qt_static/template.lua | 15 ---- xmake/templates/c/console_tbox/project/src/main.c | 20 ----- .../templates/c/console_tbox/project/src/xmake.lua | 15 ---- xmake/templates/c/console_tbox/project/xmake.lua | 69 --------------- xmake/templates/c/console_tbox/template.lua | 15 ---- xmake/templates/c/shared/project/src/interface.c | 6 ++ xmake/templates/c/shared/project/src/interface.h | 18 ++++ xmake/templates/c/shared/project/src/test.c | 8 ++ xmake/templates/c/shared/project/xmake.lua | 26 ++++++ xmake/templates/c/shared/template.lua | 14 ++++ .../c/shared_library/project/src/interface.c | 6 -- .../c/shared_library/project/src/interface.h | 18 ---- .../templates/c/shared_library/project/src/test.c | 8 -- xmake/templates/c/shared_library/project/xmake.lua | 26 ------ xmake/templates/c/shared_library/template.lua | 14 ---- .../c/shared_library_tbox/project/src/_demo/main.c | 23 ----- .../project/src/_demo/xmake.lua | 18 ---- .../project/src/_library/interface.c | 12 --- .../project/src/_library/interface.h | 29 ------- .../project/src/_library/xmake.lua | 21 ----- .../c/shared_library_tbox/project/xmake.lua | 69 --------------- xmake/templates/c/shared_library_tbox/template.lua | 25 ------ xmake/templates/c/static/project/src/interface.c | 6 ++ xmake/templates/c/static/project/src/interface.h | 8 ++ xmake/templates/c/static/project/src/test.c | 8 ++ xmake/templates/c/static/project/xmake.lua | 26 ++++++ xmake/templates/c/static/template.lua | 14 ++++ .../c/static_library/project/src/interface.c | 6 -- .../c/static_library/project/src/interface.h | 8 -- .../templates/c/static_library/project/src/test.c | 8 -- xmake/templates/c/static_library/project/xmake.lua | 26 ------ xmake/templates/c/static_library/template.lua | 14 ---- .../c/static_library_tbox/project/src/_demo/main.c | 23 ----- .../project/src/_demo/xmake.lua | 18 ---- .../project/src/_library/interface.c | 12 --- .../project/src/_library/interface.h | 29 ------- .../project/src/_library/xmake.lua | 21 ----- .../c/static_library_tbox/project/xmake.lua | 69 --------------- xmake/templates/c/static_library_tbox/template.lua | 25 ------ xmake/templates/c/tbox.console/project/src/main.c | 20 +++++ .../templates/c/tbox.console/project/src/xmake.lua | 15 ++++ xmake/templates/c/tbox.console/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c/tbox.console/template.lua | 15 ++++ .../c/tbox.shared/project/src/_demo/main.c | 23 +++++ .../c/tbox.shared/project/src/_demo/xmake.lua | 18 ++++ .../c/tbox.shared/project/src/_library/interface.c | 12 +++ .../c/tbox.shared/project/src/_library/interface.h | 29 +++++++ .../c/tbox.shared/project/src/_library/xmake.lua | 21 +++++ xmake/templates/c/tbox.shared/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c/tbox.shared/template.lua | 25 ++++++ .../c/tbox.static/project/src/_demo/main.c | 23 +++++ .../c/tbox.static/project/src/_demo/xmake.lua | 18 ++++ .../c/tbox.static/project/src/_library/interface.c | 12 +++ .../c/tbox.static/project/src/_library/interface.h | 29 +++++++ .../c/tbox.static/project/src/_library/xmake.lua | 21 +++++ xmake/templates/c/tbox.static/project/xmake.lua | 69 +++++++++++++++ xmake/templates/c/tbox.static/template.lua | 25 ++++++ xmake/templates/cuda/shared/project/inc/lib.cuh | 22 +++++ xmake/templates/cuda/shared/project/src/lib.cu | 98 ++++++++++++++++++++++ xmake/templates/cuda/shared/project/xmake.lua | 36 ++++++++ xmake/templates/cuda/shared/template.lua | 14 ++++ .../cuda/shared_library/project/inc/lib.cuh | 22 ----- .../cuda/shared_library/project/src/lib.cu | 98 ---------------------- .../cuda/shared_library/project/xmake.lua | 36 -------- xmake/templates/cuda/shared_library/template.lua | 14 ---- xmake/templates/cuda/static/project/inc/lib.cuh | 3 + xmake/templates/cuda/static/project/src/lib.cu | 7 ++ xmake/templates/cuda/static/project/xmake.lua | 36 ++++++++ xmake/templates/cuda/static/template.lua | 14 ++++ .../cuda/static_library/project/inc/lib.cuh | 3 - .../cuda/static_library/project/src/lib.cu | 7 -- .../cuda/static_library/project/xmake.lua | 36 -------- xmake/templates/cuda/static_library/template.lua | 14 ---- .../dlang/shared/project/src/interfaces.d | 9 ++ xmake/templates/dlang/shared/project/src/main.d | 8 ++ xmake/templates/dlang/shared/project/xmake.lua | 53 ++++++++++++ xmake/templates/dlang/shared/template.lua | 14 ++++ .../dlang/shared_library/project/src/interfaces.d | 9 -- .../dlang/shared_library/project/src/main.d | 8 -- .../dlang/shared_library/project/xmake.lua | 53 ------------ xmake/templates/dlang/shared_library/template.lua | 14 ---- .../dlang/static/project/src/interfaces.d | 9 ++ xmake/templates/dlang/static/project/src/main.d | 8 ++ xmake/templates/dlang/static/project/xmake.lua | 53 ++++++++++++ xmake/templates/dlang/static/template.lua | 14 ++++ .../dlang/static_library/project/src/interfaces.d | 9 -- .../dlang/static_library/project/src/main.d | 8 -- .../dlang/static_library/project/xmake.lua | 53 ------------ xmake/templates/dlang/static_library/template.lua | 14 ---- xmake/templates/go/static/project/src/main.go | 7 ++ xmake/templates/go/static/project/src/test.go | 12 +++ xmake/templates/go/static/project/src/test/add.go | 6 ++ xmake/templates/go/static/project/src/test/sub.go | 6 ++ xmake/templates/go/static/project/xmake.lua | 50 +++++++++++ xmake/templates/go/static/template.lua | 14 ++++ .../go/static_library/project/src/main.go | 7 -- .../go/static_library/project/src/test.go | 12 --- .../go/static_library/project/src/test/add.go | 6 -- .../go/static_library/project/src/test/sub.go | 6 -- .../templates/go/static_library/project/xmake.lua | 50 ----------- xmake/templates/go/static_library/template.lua | 14 ---- .../rust/static/project/src/interfaces.rs | 5 ++ xmake/templates/rust/static/project/src/main.rs | 7 ++ xmake/templates/rust/static/project/xmake.lua | 48 +++++++++++ xmake/templates/rust/static/template.lua | 14 ++++ .../rust/static_library/project/src/interfaces.rs | 5 -- .../rust/static_library/project/src/main.rs | 7 -- .../rust/static_library/project/xmake.lua | 48 ----------- xmake/templates/rust/static_library/template.lua | 14 ---- 224 files changed, 2321 insertions(+), 2320 deletions(-) delete mode 100644 xmake/templates/c++/console_qt/project/src/main.cpp delete mode 100644 xmake/templates/c++/console_qt/project/xmake.lua delete mode 100644 xmake/templates/c++/console_qt/template.lua delete mode 100644 xmake/templates/c++/console_tbox/project/src/main.cpp delete mode 100644 xmake/templates/c++/console_tbox/project/src/xmake.lua delete mode 100644 xmake/templates/c++/console_tbox/project/xmake.lua delete mode 100644 xmake/templates/c++/console_tbox/template.lua create mode 100644 xmake/templates/c++/qt.console/project/src/main.cpp create mode 100644 xmake/templates/c++/qt.console/project/xmake.lua create mode 100644 xmake/templates/c++/qt.console/template.lua create mode 100644 xmake/templates/c++/qt.quickapp/project/src/main.cpp create mode 100644 xmake/templates/c++/qt.quickapp/project/src/main.qml create mode 100644 xmake/templates/c++/qt.quickapp/project/src/qml.qrc create mode 100644 xmake/templates/c++/qt.quickapp/project/xmake.lua create mode 100644 xmake/templates/c++/qt.quickapp/template.lua create mode 100644 xmake/templates/c++/qt.quickapp_static/project/src/main.cpp create mode 100644 xmake/templates/c++/qt.quickapp_static/project/src/main.qml create mode 100644 xmake/templates/c++/qt.quickapp_static/project/src/qml.qrc create mode 100644 xmake/templates/c++/qt.quickapp_static/project/xmake.lua create mode 100644 xmake/templates/c++/qt.quickapp_static/template.lua create mode 100644 xmake/templates/c++/qt.shared/project/src/demo.cpp create mode 100644 xmake/templates/c++/qt.shared/project/src/demo.h create mode 100644 xmake/templates/c++/qt.shared/project/src/demo_global.h create mode 100644 xmake/templates/c++/qt.shared/project/xmake.lua create mode 100644 xmake/templates/c++/qt.shared/template.lua create mode 100644 xmake/templates/c++/qt.static/project/src/demo.cpp create mode 100644 xmake/templates/c++/qt.static/project/src/demo.h create mode 100644 xmake/templates/c++/qt.static/project/xmake.lua create mode 100644 xmake/templates/c++/qt.static/template.lua create mode 100644 xmake/templates/c++/qt.widgetapp/project/src/main.cpp create mode 100644 xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp create mode 100644 xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h create mode 100644 xmake/templates/c++/qt.widgetapp/project/src/mainwindow.ui create mode 100644 xmake/templates/c++/qt.widgetapp/project/xmake.lua create mode 100644 xmake/templates/c++/qt.widgetapp/template.lua create mode 100644 xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp create mode 100644 xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp create mode 100644 xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h create mode 100644 xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.ui create mode 100644 xmake/templates/c++/qt.widgetapp_static/project/xmake.lua create mode 100644 xmake/templates/c++/qt.widgetapp_static/template.lua delete mode 100644 xmake/templates/c++/quickapp_qt/project/src/main.cpp delete mode 100644 xmake/templates/c++/quickapp_qt/project/src/main.qml delete mode 100644 xmake/templates/c++/quickapp_qt/project/src/qml.qrc delete mode 100644 xmake/templates/c++/quickapp_qt/project/xmake.lua delete mode 100644 xmake/templates/c++/quickapp_qt/template.lua delete mode 100644 xmake/templates/c++/quickapp_qt_static/project/src/main.cpp delete mode 100644 xmake/templates/c++/quickapp_qt_static/project/src/main.qml delete mode 100644 xmake/templates/c++/quickapp_qt_static/project/src/qml.qrc delete mode 100644 xmake/templates/c++/quickapp_qt_static/project/xmake.lua delete mode 100644 xmake/templates/c++/quickapp_qt_static/template.lua create mode 100644 xmake/templates/c++/shared/project/src/interface.cpp create mode 100644 xmake/templates/c++/shared/project/src/interface.h create mode 100644 xmake/templates/c++/shared/project/src/test.cpp create mode 100644 xmake/templates/c++/shared/project/xmake.lua create mode 100644 xmake/templates/c++/shared/template.lua delete mode 100644 xmake/templates/c++/shared_library/project/src/interface.cpp delete mode 100644 xmake/templates/c++/shared_library/project/src/interface.h delete mode 100644 xmake/templates/c++/shared_library/project/src/test.cpp delete mode 100644 xmake/templates/c++/shared_library/project/xmake.lua delete mode 100644 xmake/templates/c++/shared_library/template.lua delete mode 100644 xmake/templates/c++/shared_library_qt/project/src/demo.cpp delete mode 100644 xmake/templates/c++/shared_library_qt/project/src/demo.h delete mode 100644 xmake/templates/c++/shared_library_qt/project/src/demo_global.h delete mode 100644 xmake/templates/c++/shared_library_qt/project/xmake.lua delete mode 100644 xmake/templates/c++/shared_library_qt/template.lua delete mode 100644 xmake/templates/c++/shared_library_tbox/project/src/_demo/main.cpp delete mode 100644 xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua delete mode 100644 xmake/templates/c++/shared_library_tbox/project/src/_library/interface.cpp delete mode 100644 xmake/templates/c++/shared_library_tbox/project/src/_library/interface.h delete mode 100644 xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua delete mode 100644 xmake/templates/c++/shared_library_tbox/project/xmake.lua delete mode 100644 xmake/templates/c++/shared_library_tbox/template.lua delete mode 100644 xmake/templates/c++/static_library_qt/project/src/demo.cpp delete mode 100644 xmake/templates/c++/static_library_qt/project/src/demo.h delete mode 100644 xmake/templates/c++/static_library_qt/project/xmake.lua delete mode 100644 xmake/templates/c++/static_library_qt/template.lua delete mode 100644 xmake/templates/c++/static_library_tbox/project/src/_demo/main.cpp delete mode 100644 xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua delete mode 100644 xmake/templates/c++/static_library_tbox/project/src/_library/interface.cpp delete mode 100644 xmake/templates/c++/static_library_tbox/project/src/_library/interface.h delete mode 100644 xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua delete mode 100644 xmake/templates/c++/static_library_tbox/project/xmake.lua delete mode 100644 xmake/templates/c++/static_library_tbox/template.lua create mode 100644 xmake/templates/c++/tbox.console/project/src/main.cpp create mode 100644 xmake/templates/c++/tbox.console/project/src/xmake.lua create mode 100644 xmake/templates/c++/tbox.console/project/xmake.lua create mode 100644 xmake/templates/c++/tbox.console/template.lua create mode 100644 xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp create mode 100644 xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua create mode 100644 xmake/templates/c++/tbox.shared/project/src/_library/interface.cpp create mode 100644 xmake/templates/c++/tbox.shared/project/src/_library/interface.h create mode 100644 xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua create mode 100644 xmake/templates/c++/tbox.shared/project/xmake.lua create mode 100644 xmake/templates/c++/tbox.shared/template.lua create mode 100644 xmake/templates/c++/tbox.static/project/src/_demo/main.cpp create mode 100644 xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua create mode 100644 xmake/templates/c++/tbox.static/project/src/_library/interface.cpp create mode 100644 xmake/templates/c++/tbox.static/project/src/_library/interface.h create mode 100644 xmake/templates/c++/tbox.static/project/src/_library/xmake.lua create mode 100644 xmake/templates/c++/tbox.static/project/xmake.lua create mode 100644 xmake/templates/c++/tbox.static/template.lua delete mode 100644 xmake/templates/c++/widgetapp_qt/project/src/main.cpp delete mode 100644 xmake/templates/c++/widgetapp_qt/project/src/mainwindow.cpp delete mode 100644 xmake/templates/c++/widgetapp_qt/project/src/mainwindow.h delete mode 100644 xmake/templates/c++/widgetapp_qt/project/src/mainwindow.ui delete mode 100644 xmake/templates/c++/widgetapp_qt/project/xmake.lua delete mode 100644 xmake/templates/c++/widgetapp_qt/template.lua delete mode 100644 xmake/templates/c++/widgetapp_qt_static/project/src/main.cpp delete mode 100644 xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.cpp delete mode 100644 xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.h delete mode 100644 xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.ui delete mode 100644 xmake/templates/c++/widgetapp_qt_static/project/xmake.lua delete mode 100644 xmake/templates/c++/widgetapp_qt_static/template.lua delete mode 100644 xmake/templates/c/console_tbox/project/src/main.c delete mode 100644 xmake/templates/c/console_tbox/project/src/xmake.lua delete mode 100644 xmake/templates/c/console_tbox/project/xmake.lua delete mode 100644 xmake/templates/c/console_tbox/template.lua create mode 100644 xmake/templates/c/shared/project/src/interface.c create mode 100644 xmake/templates/c/shared/project/src/interface.h create mode 100644 xmake/templates/c/shared/project/src/test.c create mode 100644 xmake/templates/c/shared/project/xmake.lua create mode 100644 xmake/templates/c/shared/template.lua delete mode 100644 xmake/templates/c/shared_library/project/src/interface.c delete mode 100644 xmake/templates/c/shared_library/project/src/interface.h delete mode 100644 xmake/templates/c/shared_library/project/src/test.c delete mode 100644 xmake/templates/c/shared_library/project/xmake.lua delete mode 100644 xmake/templates/c/shared_library/template.lua delete mode 100644 xmake/templates/c/shared_library_tbox/project/src/_demo/main.c delete mode 100644 xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua delete mode 100644 xmake/templates/c/shared_library_tbox/project/src/_library/interface.c delete mode 100644 xmake/templates/c/shared_library_tbox/project/src/_library/interface.h delete mode 100644 xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua delete mode 100644 xmake/templates/c/shared_library_tbox/project/xmake.lua delete mode 100644 xmake/templates/c/shared_library_tbox/template.lua create mode 100644 xmake/templates/c/static/project/src/interface.c create mode 100644 xmake/templates/c/static/project/src/interface.h create mode 100644 xmake/templates/c/static/project/src/test.c create mode 100644 xmake/templates/c/static/project/xmake.lua create mode 100644 xmake/templates/c/static/template.lua delete mode 100644 xmake/templates/c/static_library/project/src/interface.c delete mode 100644 xmake/templates/c/static_library/project/src/interface.h delete mode 100644 xmake/templates/c/static_library/project/src/test.c delete mode 100644 xmake/templates/c/static_library/project/xmake.lua delete mode 100644 xmake/templates/c/static_library/template.lua delete mode 100644 xmake/templates/c/static_library_tbox/project/src/_demo/main.c delete mode 100644 xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua delete mode 100644 xmake/templates/c/static_library_tbox/project/src/_library/interface.c delete mode 100644 xmake/templates/c/static_library_tbox/project/src/_library/interface.h delete mode 100644 xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua delete mode 100644 xmake/templates/c/static_library_tbox/project/xmake.lua delete mode 100644 xmake/templates/c/static_library_tbox/template.lua create mode 100644 xmake/templates/c/tbox.console/project/src/main.c create mode 100644 xmake/templates/c/tbox.console/project/src/xmake.lua create mode 100644 xmake/templates/c/tbox.console/project/xmake.lua create mode 100644 xmake/templates/c/tbox.console/template.lua create mode 100644 xmake/templates/c/tbox.shared/project/src/_demo/main.c create mode 100644 xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua create mode 100644 xmake/templates/c/tbox.shared/project/src/_library/interface.c create mode 100644 xmake/templates/c/tbox.shared/project/src/_library/interface.h create mode 100644 xmake/templates/c/tbox.shared/project/src/_library/xmake.lua create mode 100644 xmake/templates/c/tbox.shared/project/xmake.lua create mode 100644 xmake/templates/c/tbox.shared/template.lua create mode 100644 xmake/templates/c/tbox.static/project/src/_demo/main.c create mode 100644 xmake/templates/c/tbox.static/project/src/_demo/xmake.lua create mode 100644 xmake/templates/c/tbox.static/project/src/_library/interface.c create mode 100644 xmake/templates/c/tbox.static/project/src/_library/interface.h create mode 100644 xmake/templates/c/tbox.static/project/src/_library/xmake.lua create mode 100644 xmake/templates/c/tbox.static/project/xmake.lua create mode 100644 xmake/templates/c/tbox.static/template.lua create mode 100644 xmake/templates/cuda/shared/project/inc/lib.cuh create mode 100644 xmake/templates/cuda/shared/project/src/lib.cu create mode 100644 xmake/templates/cuda/shared/project/xmake.lua create mode 100644 xmake/templates/cuda/shared/template.lua delete mode 100644 xmake/templates/cuda/shared_library/project/inc/lib.cuh delete mode 100644 xmake/templates/cuda/shared_library/project/src/lib.cu delete mode 100644 xmake/templates/cuda/shared_library/project/xmake.lua delete mode 100644 xmake/templates/cuda/shared_library/template.lua create mode 100644 xmake/templates/cuda/static/project/inc/lib.cuh create mode 100644 xmake/templates/cuda/static/project/src/lib.cu create mode 100644 xmake/templates/cuda/static/project/xmake.lua create mode 100644 xmake/templates/cuda/static/template.lua delete mode 100644 xmake/templates/cuda/static_library/project/inc/lib.cuh delete mode 100644 xmake/templates/cuda/static_library/project/src/lib.cu delete mode 100644 xmake/templates/cuda/static_library/project/xmake.lua delete mode 100644 xmake/templates/cuda/static_library/template.lua create mode 100644 xmake/templates/dlang/shared/project/src/interfaces.d create mode 100644 xmake/templates/dlang/shared/project/src/main.d create mode 100644 xmake/templates/dlang/shared/project/xmake.lua create mode 100644 xmake/templates/dlang/shared/template.lua delete mode 100644 xmake/templates/dlang/shared_library/project/src/interfaces.d delete mode 100644 xmake/templates/dlang/shared_library/project/src/main.d delete mode 100644 xmake/templates/dlang/shared_library/project/xmake.lua delete mode 100644 xmake/templates/dlang/shared_library/template.lua create mode 100644 xmake/templates/dlang/static/project/src/interfaces.d create mode 100644 xmake/templates/dlang/static/project/src/main.d create mode 100644 xmake/templates/dlang/static/project/xmake.lua create mode 100644 xmake/templates/dlang/static/template.lua delete mode 100644 xmake/templates/dlang/static_library/project/src/interfaces.d delete mode 100644 xmake/templates/dlang/static_library/project/src/main.d delete mode 100644 xmake/templates/dlang/static_library/project/xmake.lua delete mode 100644 xmake/templates/dlang/static_library/template.lua create mode 100644 xmake/templates/go/static/project/src/main.go create mode 100644 xmake/templates/go/static/project/src/test.go create mode 100644 xmake/templates/go/static/project/src/test/add.go create mode 100644 xmake/templates/go/static/project/src/test/sub.go create mode 100644 xmake/templates/go/static/project/xmake.lua create mode 100644 xmake/templates/go/static/template.lua delete mode 100644 xmake/templates/go/static_library/project/src/main.go delete mode 100644 xmake/templates/go/static_library/project/src/test.go delete mode 100644 xmake/templates/go/static_library/project/src/test/add.go delete mode 100644 xmake/templates/go/static_library/project/src/test/sub.go delete mode 100644 xmake/templates/go/static_library/project/xmake.lua delete mode 100644 xmake/templates/go/static_library/template.lua create mode 100644 xmake/templates/rust/static/project/src/interfaces.rs create mode 100644 xmake/templates/rust/static/project/src/main.rs create mode 100644 xmake/templates/rust/static/project/xmake.lua create mode 100644 xmake/templates/rust/static/template.lua delete mode 100644 xmake/templates/rust/static_library/project/src/interfaces.rs delete mode 100644 xmake/templates/rust/static_library/project/src/main.rs delete mode 100644 xmake/templates/rust/static_library/project/xmake.lua delete mode 100644 xmake/templates/rust/static_library/template.lua diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua index f05a352f6..dee04b4b8 100644 --- a/xmake/actions/create/xmake.lua +++ b/xmake/actions/create/xmake.lua @@ -64,20 +64,27 @@ task("create") -- import template import("core.project.template") - -- make description + -- get templates local templates = {} - local description = {} for _, l in ipairs(template.languages()) do for _, t in ipairs(template.templates(l)) do templates[t.name] = templates[t.name] or {} table.insert(templates[t.name], l) end end + + -- get sorted templates + local templates_sorted = {} for name, languages in pairs(templates) do - table.insert(description, " - " .. name .. ": " .. table.concat(languages, ", ")) + table.insert(templates_sorted, {name = name, languages = languages}) end + table.sort(templates_sorted, function(a, b) return a.name < b.name end) - -- get it + -- make description + local description = {} + for _, t in ipairs(templates_sorted) do + table.insert(description, " - " .. t.name .. ": " .. table.concat(t.languages, ", ")) + end return description end } diff --git a/xmake/core/project/template.lua b/xmake/core/project/template.lua index 27dc34e42..1d61e0572 100644 --- a/xmake/core/project/template.lua +++ b/xmake/core/project/template.lua @@ -160,11 +160,6 @@ function template.templates(language) table.insert(templates, results:info()) end end - - -- sort templates - table.sort(templates, function(a, b) return a.description < b.description end) - - -- ok? return templates end @@ -181,7 +176,6 @@ function template.create(language, templateid, targetname) return false, "no template id!" end - -- get interpreter local interp = template._interpreter() assert(interp) diff --git a/xmake/templates/c++/console_qt/project/src/main.cpp b/xmake/templates/c++/console_qt/project/src/main.cpp deleted file mode 100644 index de25444ff..000000000 --- a/xmake/templates/c++/console_qt/project/src/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main(int argc, char *argv[]) -{ - QCoreApplication a(argc, argv); - - printf("hello xmake\n"); - return a.exec(); -} diff --git a/xmake/templates/c++/console_qt/project/xmake.lua b/xmake/templates/c++/console_qt/project/xmake.lua deleted file mode 100644 index 5dba5a131..000000000 --- a/xmake/templates/c++/console_qt/project/xmake.lua +++ /dev/null @@ -1,13 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.console") - - -- add files - add_files("src/*.cpp") - diff --git a/xmake/templates/c++/console_qt/template.lua b/xmake/templates/c++/console_qt/template.lua deleted file mode 100644 index e5ed714e6..000000000 --- a/xmake/templates/c++/console_qt/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("console_qt") - --- set description -set_description("The Console Program (Qt)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/console_tbox/project/src/main.cpp b/xmake/templates/c++/console_tbox/project/src/main.cpp deleted file mode 100644 index ad676ef58..000000000 --- a/xmake/templates/c++/console_tbox/project/src/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c++/console_tbox/project/src/xmake.lua b/xmake/templates/c++/console_tbox/project/src/xmake.lua deleted file mode 100644 index 73adf9675..000000000 --- a/xmake/templates/c++/console_tbox/project/src/xmake.lua +++ /dev/null @@ -1,15 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("binary") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.cpp") - diff --git a/xmake/templates/c++/console_tbox/project/xmake.lua b/xmake/templates/c++/console_tbox/project/xmake.lua deleted file mode 100644 index 83a45434f..000000000 --- a/xmake/templates/c++/console_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.2") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src") diff --git a/xmake/templates/c++/console_tbox/template.lua b/xmake/templates/c++/console_tbox/template.lua deleted file mode 100644 index e205071e6..000000000 --- a/xmake/templates/c++/console_tbox/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("console_tbox") - --- set description -set_description("The Console Program (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("src/xmake.lua") - diff --git a/xmake/templates/c++/qt.console/project/src/main.cpp b/xmake/templates/c++/qt.console/project/src/main.cpp new file mode 100644 index 000000000..de25444ff --- /dev/null +++ b/xmake/templates/c++/qt.console/project/src/main.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + printf("hello xmake\n"); + return a.exec(); +} diff --git a/xmake/templates/c++/qt.console/project/xmake.lua b/xmake/templates/c++/qt.console/project/xmake.lua new file mode 100644 index 000000000..5dba5a131 --- /dev/null +++ b/xmake/templates/c++/qt.console/project/xmake.lua @@ -0,0 +1,13 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.console") + + -- add files + add_files("src/*.cpp") + diff --git a/xmake/templates/c++/qt.console/template.lua b/xmake/templates/c++/qt.console/template.lua new file mode 100644 index 000000000..5ca8ed018 --- /dev/null +++ b/xmake/templates/c++/qt.console/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.console") + +-- set description +set_description("The Console Program (Qt)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.quickapp/project/src/main.cpp b/xmake/templates/c++/qt.quickapp/project/src/main.cpp new file mode 100644 index 000000000..6333b85c4 --- /dev/null +++ b/xmake/templates/c++/qt.quickapp/project/src/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/xmake/templates/c++/qt.quickapp/project/src/main.qml b/xmake/templates/c++/qt.quickapp/project/src/main.qml new file mode 100644 index 000000000..188049dae --- /dev/null +++ b/xmake/templates/c++/qt.quickapp/project/src/main.qml @@ -0,0 +1,9 @@ +import QtQuick 2.9 +import QtQuick.Window 2.2 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") +} diff --git a/xmake/templates/c++/qt.quickapp/project/src/qml.qrc b/xmake/templates/c++/qt.quickapp/project/src/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/xmake/templates/c++/qt.quickapp/project/src/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/xmake/templates/c++/qt.quickapp/project/xmake.lua b/xmake/templates/c++/qt.quickapp/project/xmake.lua new file mode 100644 index 000000000..ed756850c --- /dev/null +++ b/xmake/templates/c++/qt.quickapp/project/xmake.lua @@ -0,0 +1,18 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.quickapp") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + add_files("src/qml.qrc") + + diff --git a/xmake/templates/c++/qt.quickapp/template.lua b/xmake/templates/c++/qt.quickapp/template.lua new file mode 100644 index 000000000..56e3adf6f --- /dev/null +++ b/xmake/templates/c++/qt.quickapp/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.quickapp") + +-- set description +set_description("The Quick Application (Qt)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp b/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp new file mode 100644 index 000000000..6333b85c4 --- /dev/null +++ b/xmake/templates/c++/qt.quickapp_static/project/src/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/xmake/templates/c++/qt.quickapp_static/project/src/main.qml b/xmake/templates/c++/qt.quickapp_static/project/src/main.qml new file mode 100644 index 000000000..45ee20a2f --- /dev/null +++ b/xmake/templates/c++/qt.quickapp_static/project/src/main.qml @@ -0,0 +1,9 @@ +import QtQuick 2.6 +import QtQuick.Window 2.2 + +Window { + visible: true + width: 640 + height: 480 + title: qsTr("Hello World") +} diff --git a/xmake/templates/c++/qt.quickapp_static/project/src/qml.qrc b/xmake/templates/c++/qt.quickapp_static/project/src/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/xmake/templates/c++/qt.quickapp_static/project/src/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/xmake/templates/c++/qt.quickapp_static/project/xmake.lua b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua new file mode 100644 index 000000000..f341f724f --- /dev/null +++ b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua @@ -0,0 +1,24 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- includes +includes("qt_add_static_plugins.lua") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.quickapp_static") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + add_files("src/qml.qrc") + + -- add plugin: qml.QtQuick + qt_add_static_plugins("QtQuick2Plugin", {linkdirs = "qml/QtQuick.2", links = "qtquick2plugin"}) + qt_add_static_plugins("QtQuick2WindowPlugin", {linkdirs = "qml/QtQuick/Window.2", links = "windowplugin"}) + diff --git a/xmake/templates/c++/qt.quickapp_static/template.lua b/xmake/templates/c++/qt.quickapp_static/template.lua new file mode 100644 index 000000000..ab3239f58 --- /dev/null +++ b/xmake/templates/c++/qt.quickapp_static/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.quickapp_static") + +-- set description +set_description("The Quick Application (Qt/Static)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.shared/project/src/demo.cpp b/xmake/templates/c++/qt.shared/project/src/demo.cpp new file mode 100644 index 000000000..bd791c271 --- /dev/null +++ b/xmake/templates/c++/qt.shared/project/src/demo.cpp @@ -0,0 +1,6 @@ +#include "demo.h" + + +QtDemo::QtDemo() +{ +} diff --git a/xmake/templates/c++/qt.shared/project/src/demo.h b/xmake/templates/c++/qt.shared/project/src/demo.h new file mode 100644 index 000000000..d88dc29ee --- /dev/null +++ b/xmake/templates/c++/qt.shared/project/src/demo.h @@ -0,0 +1,13 @@ +#ifndef QT_DEMO_H +#define QT_DEMO_H + +#include "demo_global.h" + +class QT_DEMOSHARED_EXPORT QtDemo +{ + +public: + QtDemo(); +}; + +#endif // QT_TEST5_H diff --git a/xmake/templates/c++/qt.shared/project/src/demo_global.h b/xmake/templates/c++/qt.shared/project/src/demo_global.h new file mode 100644 index 000000000..25abfb05c --- /dev/null +++ b/xmake/templates/c++/qt.shared/project/src/demo_global.h @@ -0,0 +1,12 @@ +#ifndef QT_DEMO_GLOBAL_H +#define QT_DEMO_GLOBAL_H + +#include + +#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 diff --git a/xmake/templates/c++/qt.shared/project/xmake.lua b/xmake/templates/c++/qt.shared/project/xmake.lua new file mode 100644 index 000000000..0f6894fe9 --- /dev/null +++ b/xmake/templates/c++/qt.shared/project/xmake.lua @@ -0,0 +1,21 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.shared") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + + -- add defines + add_defines("QT_DEMO_LIBRARY") + + -- add frameworks + add_frameworks("QtGui") diff --git a/xmake/templates/c++/qt.shared/template.lua b/xmake/templates/c++/qt.shared/template.lua new file mode 100644 index 000000000..d98fae5c1 --- /dev/null +++ b/xmake/templates/c++/qt.shared/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.shared") + +-- set description +set_description("The Share Library (Qt)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.static/project/src/demo.cpp b/xmake/templates/c++/qt.static/project/src/demo.cpp new file mode 100644 index 000000000..a702ad253 --- /dev/null +++ b/xmake/templates/c++/qt.static/project/src/demo.cpp @@ -0,0 +1,5 @@ +#include "demo.h" + +QtDemo::QtDemo() +{ +} diff --git a/xmake/templates/c++/qt.static/project/src/demo.h b/xmake/templates/c++/qt.static/project/src/demo.h new file mode 100644 index 000000000..51eb9be55 --- /dev/null +++ b/xmake/templates/c++/qt.static/project/src/demo.h @@ -0,0 +1,11 @@ +#ifndef QT_DEMO_H +#define QT_DEMO_H + +class QtDemo +{ + +public: + QtDemo(); +}; + +#endif // QT_DEMO_H diff --git a/xmake/templates/c++/qt.static/project/xmake.lua b/xmake/templates/c++/qt.static/project/xmake.lua new file mode 100644 index 000000000..e69a47e61 --- /dev/null +++ b/xmake/templates/c++/qt.static/project/xmake.lua @@ -0,0 +1,18 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.static") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + + -- add frameworks + add_frameworks("QtGui") diff --git a/xmake/templates/c++/qt.static/template.lua b/xmake/templates/c++/qt.static/template.lua new file mode 100644 index 000000000..60db73bcc --- /dev/null +++ b/xmake/templates/c++/qt.static/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.static") + +-- set description +set_description("The Static Library (Qt)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.widgetapp/project/src/main.cpp b/xmake/templates/c++/qt.widgetapp/project/src/main.cpp new file mode 100644 index 000000000..b48f94ec8 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/project/src/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp new file mode 100644 index 000000000..49d64fce7 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h new file mode 100644 index 000000000..8e06f4918 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.ui b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.ui new file mode 100644 index 000000000..1c59b695e --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/project/src/mainwindow.ui @@ -0,0 +1,24 @@ + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + + + + + diff --git a/xmake/templates/c++/qt.widgetapp/project/xmake.lua b/xmake/templates/c++/qt.widgetapp/project/xmake.lua new file mode 100644 index 000000000..8b7bd5ec8 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/project/xmake.lua @@ -0,0 +1,21 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.widgetapp") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + add_files("src/mainwindow.ui") + + -- add files with Q_OBJECT meta (only for qt.moc) + add_files("src/mainwindow.h") + + diff --git a/xmake/templates/c++/qt.widgetapp/template.lua b/xmake/templates/c++/qt.widgetapp/template.lua new file mode 100644 index 000000000..94aeacb67 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.widgetapp") + +-- set description +set_description("The Widget Application (Qt)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp b/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp new file mode 100644 index 000000000..b48f94ec8 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp new file mode 100644 index 000000000..49d64fce7 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h new file mode 100644 index 000000000..8e06f4918 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.ui b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.ui new file mode 100644 index 000000000..1c59b695e --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/project/src/mainwindow.ui @@ -0,0 +1,24 @@ + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + + + + + diff --git a/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua new file mode 100644 index 000000000..3c8e46c85 --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua @@ -0,0 +1,25 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- includes +includes("qt_add_static_plugins.lua") + +-- add target +target("[targetname]") + + -- add rules + add_rules("qt.widgetapp_static") + + -- add headers + add_headerfiles("src/*.h") + + -- add files + add_files("src/*.cpp") + add_files("src/mainwindow.ui") + + -- add files with Q_OBJECT meta (only for qt.moc) + add_files("src/mainwindow.h") + + -- add plugin: QSvgPlugin (optional) + qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg", "Qt5Svg"}}) diff --git a/xmake/templates/c++/qt.widgetapp_static/template.lua b/xmake/templates/c++/qt.widgetapp_static/template.lua new file mode 100644 index 000000000..8b3848e4d --- /dev/null +++ b/xmake/templates/c++/qt.widgetapp_static/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("qt.widgetapp_static") + +-- set description +set_description("The Widget Application (Qt/Static)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") + diff --git a/xmake/templates/c++/quickapp_qt/project/src/main.cpp b/xmake/templates/c++/quickapp_qt/project/src/main.cpp deleted file mode 100644 index 6333b85c4..000000000 --- a/xmake/templates/c++/quickapp_qt/project/src/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} diff --git a/xmake/templates/c++/quickapp_qt/project/src/main.qml b/xmake/templates/c++/quickapp_qt/project/src/main.qml deleted file mode 100644 index 188049dae..000000000 --- a/xmake/templates/c++/quickapp_qt/project/src/main.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.9 -import QtQuick.Window 2.2 - -Window { - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") -} diff --git a/xmake/templates/c++/quickapp_qt/project/src/qml.qrc b/xmake/templates/c++/quickapp_qt/project/src/qml.qrc deleted file mode 100644 index 5f6483ac3..000000000 --- a/xmake/templates/c++/quickapp_qt/project/src/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/xmake/templates/c++/quickapp_qt/project/xmake.lua b/xmake/templates/c++/quickapp_qt/project/xmake.lua deleted file mode 100644 index ed756850c..000000000 --- a/xmake/templates/c++/quickapp_qt/project/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.quickapp") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - add_files("src/qml.qrc") - - diff --git a/xmake/templates/c++/quickapp_qt/template.lua b/xmake/templates/c++/quickapp_qt/template.lua deleted file mode 100644 index 1efa5b9aa..000000000 --- a/xmake/templates/c++/quickapp_qt/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("quickapp_qt") - --- set description -set_description("The Quick Application (Qt)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/quickapp_qt_static/project/src/main.cpp b/xmake/templates/c++/quickapp_qt_static/project/src/main.cpp deleted file mode 100644 index 6333b85c4..000000000 --- a/xmake/templates/c++/quickapp_qt_static/project/src/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} diff --git a/xmake/templates/c++/quickapp_qt_static/project/src/main.qml b/xmake/templates/c++/quickapp_qt_static/project/src/main.qml deleted file mode 100644 index 45ee20a2f..000000000 --- a/xmake/templates/c++/quickapp_qt_static/project/src/main.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.6 -import QtQuick.Window 2.2 - -Window { - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") -} diff --git a/xmake/templates/c++/quickapp_qt_static/project/src/qml.qrc b/xmake/templates/c++/quickapp_qt_static/project/src/qml.qrc deleted file mode 100644 index 5f6483ac3..000000000 --- a/xmake/templates/c++/quickapp_qt_static/project/src/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/xmake/templates/c++/quickapp_qt_static/project/xmake.lua b/xmake/templates/c++/quickapp_qt_static/project/xmake.lua deleted file mode 100644 index f341f724f..000000000 --- a/xmake/templates/c++/quickapp_qt_static/project/xmake.lua +++ /dev/null @@ -1,24 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- includes -includes("qt_add_static_plugins.lua") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.quickapp_static") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - add_files("src/qml.qrc") - - -- add plugin: qml.QtQuick - qt_add_static_plugins("QtQuick2Plugin", {linkdirs = "qml/QtQuick.2", links = "qtquick2plugin"}) - qt_add_static_plugins("QtQuick2WindowPlugin", {linkdirs = "qml/QtQuick/Window.2", links = "windowplugin"}) - diff --git a/xmake/templates/c++/quickapp_qt_static/template.lua b/xmake/templates/c++/quickapp_qt_static/template.lua deleted file mode 100644 index 314503740..000000000 --- a/xmake/templates/c++/quickapp_qt_static/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("quickapp_qt_static") - --- set description -set_description("The Quick Application (Qt/Static)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/shared/project/src/interface.cpp b/xmake/templates/c++/shared/project/src/interface.cpp new file mode 100644 index 000000000..598d07560 --- /dev/null +++ b/xmake/templates/c++/shared/project/src/interface.cpp @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/xmake/templates/c++/shared/project/src/interface.h b/xmake/templates/c++/shared/project/src/interface.h new file mode 100644 index 000000000..ef24ba3ce --- /dev/null +++ b/xmake/templates/c++/shared/project/src/interface.h @@ -0,0 +1,24 @@ +#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 + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +__export int add(int a, int b); + +#ifdef __cplusplus +} +#endif diff --git a/xmake/templates/c++/shared/project/src/test.cpp b/xmake/templates/c++/shared/project/src/test.cpp new file mode 100644 index 000000000..72e03272b --- /dev/null +++ b/xmake/templates/c++/shared/project/src/test.cpp @@ -0,0 +1,10 @@ +#include "interface.h" +#include + +using namespace std; + +int main(int argc, char** argv) +{ + cout << "add(1, 2) = " << add(1, 2) << endl; + return 0; +} diff --git a/xmake/templates/c++/shared/project/xmake.lua b/xmake/templates/c++/shared/project/xmake.lua new file mode 100644 index 000000000..59fe4dbe6 --- /dev/null +++ b/xmake/templates/c++/shared/project/xmake.lua @@ -0,0 +1,26 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add files + add_files("src/interface.cpp") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add files + add_files("src/test.cpp") + + diff --git a/xmake/templates/c++/shared/template.lua b/xmake/templates/c++/shared/template.lua new file mode 100644 index 000000000..666542844 --- /dev/null +++ b/xmake/templates/c++/shared/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("shared") + +-- set description +set_description("The Shared Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/c++/shared_library/project/src/interface.cpp b/xmake/templates/c++/shared_library/project/src/interface.cpp deleted file mode 100644 index 598d07560..000000000 --- a/xmake/templates/c++/shared_library/project/src/interface.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "interface.h" - -int add(int a, int b) -{ - return a + b; -} diff --git a/xmake/templates/c++/shared_library/project/src/interface.h b/xmake/templates/c++/shared_library/project/src/interface.h deleted file mode 100644 index ef24ba3ce..000000000 --- a/xmake/templates/c++/shared_library/project/src/interface.h +++ /dev/null @@ -1,24 +0,0 @@ -#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 - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -__export int add(int a, int b); - -#ifdef __cplusplus -} -#endif diff --git a/xmake/templates/c++/shared_library/project/src/test.cpp b/xmake/templates/c++/shared_library/project/src/test.cpp deleted file mode 100644 index 72e03272b..000000000 --- a/xmake/templates/c++/shared_library/project/src/test.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "interface.h" -#include - -using namespace std; - -int main(int argc, char** argv) -{ - cout << "add(1, 2) = " << add(1, 2) << endl; - return 0; -} diff --git a/xmake/templates/c++/shared_library/project/xmake.lua b/xmake/templates/c++/shared_library/project/xmake.lua deleted file mode 100644 index 59fe4dbe6..000000000 --- a/xmake/templates/c++/shared_library/project/xmake.lua +++ /dev/null @@ -1,26 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add files - add_files("src/interface.cpp") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add files - add_files("src/test.cpp") - - diff --git a/xmake/templates/c++/shared_library/template.lua b/xmake/templates/c++/shared_library/template.lua deleted file mode 100644 index 666542844..000000000 --- a/xmake/templates/c++/shared_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("shared") - --- set description -set_description("The Shared Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo.cpp b/xmake/templates/c++/shared_library_qt/project/src/demo.cpp deleted file mode 100644 index bd791c271..000000000 --- a/xmake/templates/c++/shared_library_qt/project/src/demo.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "demo.h" - - -QtDemo::QtDemo() -{ -} diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo.h b/xmake/templates/c++/shared_library_qt/project/src/demo.h deleted file mode 100644 index d88dc29ee..000000000 --- a/xmake/templates/c++/shared_library_qt/project/src/demo.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QT_DEMO_H -#define QT_DEMO_H - -#include "demo_global.h" - -class QT_DEMOSHARED_EXPORT QtDemo -{ - -public: - QtDemo(); -}; - -#endif // QT_TEST5_H diff --git a/xmake/templates/c++/shared_library_qt/project/src/demo_global.h b/xmake/templates/c++/shared_library_qt/project/src/demo_global.h deleted file mode 100644 index 25abfb05c..000000000 --- a/xmake/templates/c++/shared_library_qt/project/src/demo_global.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef QT_DEMO_GLOBAL_H -#define QT_DEMO_GLOBAL_H - -#include - -#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 diff --git a/xmake/templates/c++/shared_library_qt/project/xmake.lua b/xmake/templates/c++/shared_library_qt/project/xmake.lua deleted file mode 100644 index 0f6894fe9..000000000 --- a/xmake/templates/c++/shared_library_qt/project/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.shared") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - - -- add defines - add_defines("QT_DEMO_LIBRARY") - - -- add frameworks - add_frameworks("QtGui") diff --git a/xmake/templates/c++/shared_library_qt/template.lua b/xmake/templates/c++/shared_library_qt/template.lua deleted file mode 100644 index d65460fa1..000000000 --- a/xmake/templates/c++/shared_library_qt/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("shared_qt") - --- set description -set_description("The Share Library (Qt)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_demo/main.cpp b/xmake/templates/c++/shared_library_tbox/project/src/_demo/main.cpp deleted file mode 100644 index 818ff6919..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/src/_demo/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "[targetname]/interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // test - tb_trace_i("add(1 + 1) = %d", add(1, 1)); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua deleted file mode 100644 index c6f24eed7..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ --- add target -target("demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add defines - add_defines("__tb_prefix__=\"demo\"") - - -- add files - add_files("*.cpp") - - -- add packages - add_packages("tbox") - diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.cpp b/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.cpp deleted file mode 100644 index a0ccb007b..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.cpp +++ /dev/null @@ -1,12 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ -tb_int_t add(tb_int_t a, tb_int_t b) -{ - return a + b; -} diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.h b/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.h deleted file mode 100644 index 944af8121..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/src/_library/interface.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua deleted file mode 100644 index 4f564356b..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add the header files for installing - add_headerfiles("../([targetname]/**.h)") - - -- add includes directory - add_includedirs("..", {interface = true}) - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.cpp") - diff --git a/xmake/templates/c++/shared_library_tbox/project/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/xmake.lua deleted file mode 100644 index 1ebaa6e34..000000000 --- a/xmake/templates/c++/shared_library_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.5") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c++/shared_library_tbox/template.lua b/xmake/templates/c++/shared_library_tbox/template.lua deleted file mode 100644 index c092427ed..000000000 --- a/xmake/templates/c++/shared_library_tbox/template.lua +++ /dev/null @@ -1,25 +0,0 @@ --- set name -set_name("shared_tbox") - --- set description -set_description("The Shared Library (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") -add_macrofiles("src/_demo/main.cpp") -add_macrofiles("src/_demo/xmake.lua") -add_macrofiles("src/_library/xmake.lua") - --- set create script -on_create(function () - - -- rename target directory - os.mv("src/_library", "src/$(targetname)") - os.mv("src/_demo", "src/$(targetname)_demo") -end) diff --git a/xmake/templates/c++/static_library_qt/project/src/demo.cpp b/xmake/templates/c++/static_library_qt/project/src/demo.cpp deleted file mode 100644 index a702ad253..000000000 --- a/xmake/templates/c++/static_library_qt/project/src/demo.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "demo.h" - -QtDemo::QtDemo() -{ -} diff --git a/xmake/templates/c++/static_library_qt/project/src/demo.h b/xmake/templates/c++/static_library_qt/project/src/demo.h deleted file mode 100644 index 51eb9be55..000000000 --- a/xmake/templates/c++/static_library_qt/project/src/demo.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef QT_DEMO_H -#define QT_DEMO_H - -class QtDemo -{ - -public: - QtDemo(); -}; - -#endif // QT_DEMO_H diff --git a/xmake/templates/c++/static_library_qt/project/xmake.lua b/xmake/templates/c++/static_library_qt/project/xmake.lua deleted file mode 100644 index e69a47e61..000000000 --- a/xmake/templates/c++/static_library_qt/project/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.static") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - - -- add frameworks - add_frameworks("QtGui") diff --git a/xmake/templates/c++/static_library_qt/template.lua b/xmake/templates/c++/static_library_qt/template.lua deleted file mode 100644 index 14b5db59c..000000000 --- a/xmake/templates/c++/static_library_qt/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("static_qt") - --- set description -set_description("The Static Library (Qt)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/static_library_tbox/project/src/_demo/main.cpp b/xmake/templates/c++/static_library_tbox/project/src/_demo/main.cpp deleted file mode 100644 index 818ff6919..000000000 --- a/xmake/templates/c++/static_library_tbox/project/src/_demo/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "[targetname]/interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // test - tb_trace_i("add(1 + 1) = %d", add(1, 1)); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua deleted file mode 100644 index c6f24eed7..000000000 --- a/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ --- add target -target("demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add defines - add_defines("__tb_prefix__=\"demo\"") - - -- add files - add_files("*.cpp") - - -- add packages - add_packages("tbox") - diff --git a/xmake/templates/c++/static_library_tbox/project/src/_library/interface.cpp b/xmake/templates/c++/static_library_tbox/project/src/_library/interface.cpp deleted file mode 100644 index a0ccb007b..000000000 --- a/xmake/templates/c++/static_library_tbox/project/src/_library/interface.cpp +++ /dev/null @@ -1,12 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ -tb_int_t add(tb_int_t a, tb_int_t b) -{ - return a + b; -} diff --git a/xmake/templates/c++/static_library_tbox/project/src/_library/interface.h b/xmake/templates/c++/static_library_tbox/project/src/_library/interface.h deleted file mode 100644 index f4f4a07e1..000000000 --- a/xmake/templates/c++/static_library_tbox/project/src/_library/interface.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -tb_int_t add(tb_int_t a, tb_int_t b); - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua deleted file mode 100644 index 71a5e698f..000000000 --- a/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("static") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add the header files for installing - add_headerfiles("../([targetname]/**.h)") - - -- add includes directory - add_includedirs("..", {interface = true}) - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.cpp") - diff --git a/xmake/templates/c++/static_library_tbox/project/xmake.lua b/xmake/templates/c++/static_library_tbox/project/xmake.lua deleted file mode 100644 index 1ebaa6e34..000000000 --- a/xmake/templates/c++/static_library_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.5") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c++/static_library_tbox/template.lua b/xmake/templates/c++/static_library_tbox/template.lua deleted file mode 100644 index 07c3141a2..000000000 --- a/xmake/templates/c++/static_library_tbox/template.lua +++ /dev/null @@ -1,25 +0,0 @@ --- set name -set_name("static_tbox") - --- set description -set_description("The Static Library (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") -add_macrofiles("src/_demo/main.cpp") -add_macrofiles("src/_demo/xmake.lua") -add_macrofiles("src/_library/xmake.lua") - --- set create script -on_create(function () - - -- rename target directory - os.mv("src/_library", "src/$(targetname)") - os.mv("src/_demo", "src/$(targetname)_demo") -end) diff --git a/xmake/templates/c++/tbox.console/project/src/main.cpp b/xmake/templates/c++/tbox.console/project/src/main.cpp new file mode 100644 index 000000000..ad676ef58 --- /dev/null +++ b/xmake/templates/c++/tbox.console/project/src/main.cpp @@ -0,0 +1,20 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c++/tbox.console/project/src/xmake.lua b/xmake/templates/c++/tbox.console/project/src/xmake.lua new file mode 100644 index 000000000..73adf9675 --- /dev/null +++ b/xmake/templates/c++/tbox.console/project/src/xmake.lua @@ -0,0 +1,15 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("binary") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.cpp") + diff --git a/xmake/templates/c++/tbox.console/project/xmake.lua b/xmake/templates/c++/tbox.console/project/xmake.lua new file mode 100644 index 000000000..83a45434f --- /dev/null +++ b/xmake/templates/c++/tbox.console/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.2") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src") diff --git a/xmake/templates/c++/tbox.console/template.lua b/xmake/templates/c++/tbox.console/template.lua new file mode 100644 index 000000000..f1edee39b --- /dev/null +++ b/xmake/templates/c++/tbox.console/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("tbox.console") + +-- set description +set_description("The Console Program (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("src/xmake.lua") + diff --git a/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp new file mode 100644 index 000000000..818ff6919 --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp @@ -0,0 +1,23 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "[targetname]/interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // test + tb_trace_i("add(1 + 1) = %d", add(1, 1)); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua b/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua new file mode 100644 index 000000000..c6f24eed7 --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua @@ -0,0 +1,18 @@ +-- add target +target("demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add defines + add_defines("__tb_prefix__=\"demo\"") + + -- add files + add_files("*.cpp") + + -- add packages + add_packages("tbox") + diff --git a/xmake/templates/c++/tbox.shared/project/src/_library/interface.cpp b/xmake/templates/c++/tbox.shared/project/src/_library/interface.cpp new file mode 100644 index 000000000..a0ccb007b --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/src/_library/interface.cpp @@ -0,0 +1,12 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ +tb_int_t add(tb_int_t a, tb_int_t b) +{ + return a + b; +} diff --git a/xmake/templates/c++/tbox.shared/project/src/_library/interface.h b/xmake/templates/c++/tbox.shared/project/src/_library/interface.h new file mode 100644 index 000000000..944af8121 --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/src/_library/interface.h @@ -0,0 +1,29 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua b/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua new file mode 100644 index 000000000..4f564356b --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua @@ -0,0 +1,21 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add the header files for installing + add_headerfiles("../([targetname]/**.h)") + + -- add includes directory + add_includedirs("..", {interface = true}) + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.cpp") + diff --git a/xmake/templates/c++/tbox.shared/project/xmake.lua b/xmake/templates/c++/tbox.shared/project/xmake.lua new file mode 100644 index 000000000..1ebaa6e34 --- /dev/null +++ b/xmake/templates/c++/tbox.shared/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.5") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c++/tbox.shared/template.lua b/xmake/templates/c++/tbox.shared/template.lua new file mode 100644 index 000000000..31bd81e93 --- /dev/null +++ b/xmake/templates/c++/tbox.shared/template.lua @@ -0,0 +1,25 @@ +-- set name +set_name("tbox.shared") + +-- set description +set_description("The Shared Library (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") +add_macrofiles("src/_demo/main.cpp") +add_macrofiles("src/_demo/xmake.lua") +add_macrofiles("src/_library/xmake.lua") + +-- set create script +on_create(function () + + -- rename target directory + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") +end) diff --git a/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp new file mode 100644 index 000000000..818ff6919 --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp @@ -0,0 +1,23 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "[targetname]/interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // test + tb_trace_i("add(1 + 1) = %d", add(1, 1)); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua b/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua new file mode 100644 index 000000000..c6f24eed7 --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua @@ -0,0 +1,18 @@ +-- add target +target("demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add defines + add_defines("__tb_prefix__=\"demo\"") + + -- add files + add_files("*.cpp") + + -- add packages + add_packages("tbox") + diff --git a/xmake/templates/c++/tbox.static/project/src/_library/interface.cpp b/xmake/templates/c++/tbox.static/project/src/_library/interface.cpp new file mode 100644 index 000000000..a0ccb007b --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/src/_library/interface.cpp @@ -0,0 +1,12 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ +tb_int_t add(tb_int_t a, tb_int_t b) +{ + return a + b; +} diff --git a/xmake/templates/c++/tbox.static/project/src/_library/interface.h b/xmake/templates/c++/tbox.static/project/src/_library/interface.h new file mode 100644 index 000000000..f4f4a07e1 --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/src/_library/interface.h @@ -0,0 +1,29 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +tb_int_t add(tb_int_t a, tb_int_t b); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua b/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua new file mode 100644 index 000000000..71a5e698f --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua @@ -0,0 +1,21 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("static") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add the header files for installing + add_headerfiles("../([targetname]/**.h)") + + -- add includes directory + add_includedirs("..", {interface = true}) + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.cpp") + diff --git a/xmake/templates/c++/tbox.static/project/xmake.lua b/xmake/templates/c++/tbox.static/project/xmake.lua new file mode 100644 index 000000000..1ebaa6e34 --- /dev/null +++ b/xmake/templates/c++/tbox.static/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.5") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c++/tbox.static/template.lua b/xmake/templates/c++/tbox.static/template.lua new file mode 100644 index 000000000..a9acb2caa --- /dev/null +++ b/xmake/templates/c++/tbox.static/template.lua @@ -0,0 +1,25 @@ +-- set name +set_name("tbox.static") + +-- set description +set_description("The Static Library (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") +add_macrofiles("src/_demo/main.cpp") +add_macrofiles("src/_demo/xmake.lua") +add_macrofiles("src/_library/xmake.lua") + +-- set create script +on_create(function () + + -- rename target directory + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") +end) diff --git a/xmake/templates/c++/widgetapp_qt/project/src/main.cpp b/xmake/templates/c++/widgetapp_qt/project/src/main.cpp deleted file mode 100644 index b48f94ec8..000000000 --- a/xmake/templates/c++/widgetapp_qt/project/src/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "mainwindow.h" -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); -} diff --git a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.cpp b/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.cpp deleted file mode 100644 index 49d64fce7..000000000 --- a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} diff --git a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.h b/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.h deleted file mode 100644 index 8e06f4918..000000000 --- a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H diff --git a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.ui b/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.ui deleted file mode 100644 index 1c59b695e..000000000 --- a/xmake/templates/c++/widgetapp_qt/project/src/mainwindow.ui +++ /dev/null @@ -1,24 +0,0 @@ - - MainWindow - - - - 0 - 0 - 400 - 300 - - - - MainWindow - - - - - - - - - - - diff --git a/xmake/templates/c++/widgetapp_qt/project/xmake.lua b/xmake/templates/c++/widgetapp_qt/project/xmake.lua deleted file mode 100644 index 8b7bd5ec8..000000000 --- a/xmake/templates/c++/widgetapp_qt/project/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.widgetapp") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - add_files("src/mainwindow.ui") - - -- add files with Q_OBJECT meta (only for qt.moc) - add_files("src/mainwindow.h") - - diff --git a/xmake/templates/c++/widgetapp_qt/template.lua b/xmake/templates/c++/widgetapp_qt/template.lua deleted file mode 100644 index 668b32bce..000000000 --- a/xmake/templates/c++/widgetapp_qt/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("widgetapp_qt") - --- set description -set_description("The Widget Application (Qt)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c++/widgetapp_qt_static/project/src/main.cpp b/xmake/templates/c++/widgetapp_qt_static/project/src/main.cpp deleted file mode 100644 index b48f94ec8..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/project/src/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "mainwindow.h" -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); -} diff --git a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.cpp b/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.cpp deleted file mode 100644 index 49d64fce7..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} diff --git a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.h b/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.h deleted file mode 100644 index 8e06f4918..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -namespace Ui { -class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H diff --git a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.ui b/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.ui deleted file mode 100644 index 1c59b695e..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/project/src/mainwindow.ui +++ /dev/null @@ -1,24 +0,0 @@ - - MainWindow - - - - 0 - 0 - 400 - 300 - - - - MainWindow - - - - - - - - - - - diff --git a/xmake/templates/c++/widgetapp_qt_static/project/xmake.lua b/xmake/templates/c++/widgetapp_qt_static/project/xmake.lua deleted file mode 100644 index 3c8e46c85..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/project/xmake.lua +++ /dev/null @@ -1,25 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- includes -includes("qt_add_static_plugins.lua") - --- add target -target("[targetname]") - - -- add rules - add_rules("qt.widgetapp_static") - - -- add headers - add_headerfiles("src/*.h") - - -- add files - add_files("src/*.cpp") - add_files("src/mainwindow.ui") - - -- add files with Q_OBJECT meta (only for qt.moc) - add_files("src/mainwindow.h") - - -- add plugin: QSvgPlugin (optional) - qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg", "Qt5Svg"}}) diff --git a/xmake/templates/c++/widgetapp_qt_static/template.lua b/xmake/templates/c++/widgetapp_qt_static/template.lua deleted file mode 100644 index 7a1cfed24..000000000 --- a/xmake/templates/c++/widgetapp_qt_static/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("widgetapp_qt_static") - --- set description -set_description("The Widget Application (Qt/Static)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") - diff --git a/xmake/templates/c/console_tbox/project/src/main.c b/xmake/templates/c/console_tbox/project/src/main.c deleted file mode 100644 index ad676ef58..000000000 --- a/xmake/templates/c/console_tbox/project/src/main.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c/console_tbox/project/src/xmake.lua b/xmake/templates/c/console_tbox/project/src/xmake.lua deleted file mode 100644 index 3f528a7ec..000000000 --- a/xmake/templates/c/console_tbox/project/src/xmake.lua +++ /dev/null @@ -1,15 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("binary") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.c") - diff --git a/xmake/templates/c/console_tbox/project/xmake.lua b/xmake/templates/c/console_tbox/project/xmake.lua deleted file mode 100644 index 83a45434f..000000000 --- a/xmake/templates/c/console_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.2") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src") diff --git a/xmake/templates/c/console_tbox/template.lua b/xmake/templates/c/console_tbox/template.lua deleted file mode 100644 index e205071e6..000000000 --- a/xmake/templates/c/console_tbox/template.lua +++ /dev/null @@ -1,15 +0,0 @@ --- set name -set_name("console_tbox") - --- set description -set_description("The Console Program (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("src/xmake.lua") - diff --git a/xmake/templates/c/shared/project/src/interface.c b/xmake/templates/c/shared/project/src/interface.c new file mode 100644 index 000000000..598d07560 --- /dev/null +++ b/xmake/templates/c/shared/project/src/interface.c @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/xmake/templates/c/shared/project/src/interface.h b/xmake/templates/c/shared/project/src/interface.h new file mode 100644 index 000000000..7a3eb570a --- /dev/null +++ b/xmake/templates/c/shared/project/src/interface.h @@ -0,0 +1,18 @@ +#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 + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +__export int add(int a, int b); + + diff --git a/xmake/templates/c/shared/project/src/test.c b/xmake/templates/c/shared/project/src/test.c new file mode 100644 index 000000000..9505a2f75 --- /dev/null +++ b/xmake/templates/c/shared/project/src/test.c @@ -0,0 +1,8 @@ +#include "interface.h" +#include + +int main(int argc, char** argv) +{ + printf("add(1, 2) = %d\n", add(1, 2)); + return 0; +} diff --git a/xmake/templates/c/shared/project/xmake.lua b/xmake/templates/c/shared/project/xmake.lua new file mode 100644 index 000000000..4a52ee6d0 --- /dev/null +++ b/xmake/templates/c/shared/project/xmake.lua @@ -0,0 +1,26 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add files + add_files("src/interface.c") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add files + add_files("src/test.c") + + diff --git a/xmake/templates/c/shared/template.lua b/xmake/templates/c/shared/template.lua new file mode 100644 index 000000000..666542844 --- /dev/null +++ b/xmake/templates/c/shared/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("shared") + +-- set description +set_description("The Shared Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/c/shared_library/project/src/interface.c b/xmake/templates/c/shared_library/project/src/interface.c deleted file mode 100644 index 598d07560..000000000 --- a/xmake/templates/c/shared_library/project/src/interface.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "interface.h" - -int add(int a, int b) -{ - return a + b; -} diff --git a/xmake/templates/c/shared_library/project/src/interface.h b/xmake/templates/c/shared_library/project/src/interface.h deleted file mode 100644 index 7a3eb570a..000000000 --- a/xmake/templates/c/shared_library/project/src/interface.h +++ /dev/null @@ -1,18 +0,0 @@ -#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 - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -__export int add(int a, int b); - - diff --git a/xmake/templates/c/shared_library/project/src/test.c b/xmake/templates/c/shared_library/project/src/test.c deleted file mode 100644 index 9505a2f75..000000000 --- a/xmake/templates/c/shared_library/project/src/test.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "interface.h" -#include - -int main(int argc, char** argv) -{ - printf("add(1, 2) = %d\n", add(1, 2)); - return 0; -} diff --git a/xmake/templates/c/shared_library/project/xmake.lua b/xmake/templates/c/shared_library/project/xmake.lua deleted file mode 100644 index 4a52ee6d0..000000000 --- a/xmake/templates/c/shared_library/project/xmake.lua +++ /dev/null @@ -1,26 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add files - add_files("src/interface.c") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add files - add_files("src/test.c") - - diff --git a/xmake/templates/c/shared_library/template.lua b/xmake/templates/c/shared_library/template.lua deleted file mode 100644 index 666542844..000000000 --- a/xmake/templates/c/shared_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("shared") - --- set description -set_description("The Shared Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/c/shared_library_tbox/project/src/_demo/main.c b/xmake/templates/c/shared_library_tbox/project/src/_demo/main.c deleted file mode 100644 index 818ff6919..000000000 --- a/xmake/templates/c/shared_library_tbox/project/src/_demo/main.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "[targetname]/interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // test - tb_trace_i("add(1 + 1) = %d", add(1, 1)); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua deleted file mode 100644 index c62ddcec5..000000000 --- a/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ --- add target -target("demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add defines - add_defines("__tb_prefix__=\"demo\"") - - -- add files - add_files("*.c") - - -- add packages - add_packages("tbox") - diff --git a/xmake/templates/c/shared_library_tbox/project/src/_library/interface.c b/xmake/templates/c/shared_library_tbox/project/src/_library/interface.c deleted file mode 100644 index a0ccb007b..000000000 --- a/xmake/templates/c/shared_library_tbox/project/src/_library/interface.c +++ /dev/null @@ -1,12 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ -tb_int_t add(tb_int_t a, tb_int_t b) -{ - return a + b; -} diff --git a/xmake/templates/c/shared_library_tbox/project/src/_library/interface.h b/xmake/templates/c/shared_library_tbox/project/src/_library/interface.h deleted file mode 100644 index 944af8121..000000000 --- a/xmake/templates/c/shared_library_tbox/project/src/_library/interface.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua deleted file mode 100644 index cb36ba3b8..000000000 --- a/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add the header files for installing - add_headerfiles("../([targetname]/**.h)") - - -- add includes directory - add_includedirs("..", {interface = true}) - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.c") - diff --git a/xmake/templates/c/shared_library_tbox/project/xmake.lua b/xmake/templates/c/shared_library_tbox/project/xmake.lua deleted file mode 100644 index 1ebaa6e34..000000000 --- a/xmake/templates/c/shared_library_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.5") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c/shared_library_tbox/template.lua b/xmake/templates/c/shared_library_tbox/template.lua deleted file mode 100644 index aa48cc2fa..000000000 --- a/xmake/templates/c/shared_library_tbox/template.lua +++ /dev/null @@ -1,25 +0,0 @@ --- set name -set_name("shared_tbox") - --- set description -set_description("The Shared Library (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") -add_macrofiles("src/_demo/main.c") -add_macrofiles("src/_demo/xmake.lua") -add_macrofiles("src/_library/xmake.lua") - --- set create script -on_create(function () - - -- rename target directory - os.mv("src/_library", "src/$(targetname)") - os.mv("src/_demo", "src/$(targetname)_demo") -end) diff --git a/xmake/templates/c/static/project/src/interface.c b/xmake/templates/c/static/project/src/interface.c new file mode 100644 index 000000000..598d07560 --- /dev/null +++ b/xmake/templates/c/static/project/src/interface.c @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/xmake/templates/c/static/project/src/interface.h b/xmake/templates/c/static/project/src/interface.h new file mode 100644 index 000000000..10ec0f856 --- /dev/null +++ b/xmake/templates/c/static/project/src/interface.h @@ -0,0 +1,8 @@ +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +int add(int a, int b); diff --git a/xmake/templates/c/static/project/src/test.c b/xmake/templates/c/static/project/src/test.c new file mode 100644 index 000000000..9505a2f75 --- /dev/null +++ b/xmake/templates/c/static/project/src/test.c @@ -0,0 +1,8 @@ +#include "interface.h" +#include + +int main(int argc, char** argv) +{ + printf("add(1, 2) = %d\n", add(1, 2)); + return 0; +} diff --git a/xmake/templates/c/static/project/xmake.lua b/xmake/templates/c/static/project/xmake.lua new file mode 100644 index 000000000..04d422083 --- /dev/null +++ b/xmake/templates/c/static/project/xmake.lua @@ -0,0 +1,26 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- add target +target("[targetname]") + + -- set kind + set_kind("static") + + -- add files + add_files("src/interface.c") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add files + add_files("src/test.c") + + diff --git a/xmake/templates/c/static/template.lua b/xmake/templates/c/static/template.lua new file mode 100644 index 000000000..f05045e07 --- /dev/null +++ b/xmake/templates/c/static/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("static") + +-- set description +set_description("The Static Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/c/static_library/project/src/interface.c b/xmake/templates/c/static_library/project/src/interface.c deleted file mode 100644 index 598d07560..000000000 --- a/xmake/templates/c/static_library/project/src/interface.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "interface.h" - -int add(int a, int b) -{ - return a + b; -} diff --git a/xmake/templates/c/static_library/project/src/interface.h b/xmake/templates/c/static_library/project/src/interface.h deleted file mode 100644 index 10ec0f856..000000000 --- a/xmake/templates/c/static_library/project/src/interface.h +++ /dev/null @@ -1,8 +0,0 @@ -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -int add(int a, int b); diff --git a/xmake/templates/c/static_library/project/src/test.c b/xmake/templates/c/static_library/project/src/test.c deleted file mode 100644 index 9505a2f75..000000000 --- a/xmake/templates/c/static_library/project/src/test.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "interface.h" -#include - -int main(int argc, char** argv) -{ - printf("add(1, 2) = %d\n", add(1, 2)); - return 0; -} diff --git a/xmake/templates/c/static_library/project/xmake.lua b/xmake/templates/c/static_library/project/xmake.lua deleted file mode 100644 index 04d422083..000000000 --- a/xmake/templates/c/static_library/project/xmake.lua +++ /dev/null @@ -1,26 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- add target -target("[targetname]") - - -- set kind - set_kind("static") - - -- add files - add_files("src/interface.c") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add files - add_files("src/test.c") - - diff --git a/xmake/templates/c/static_library/template.lua b/xmake/templates/c/static_library/template.lua deleted file mode 100644 index f05045e07..000000000 --- a/xmake/templates/c/static_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("static") - --- set description -set_description("The Static Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/c/static_library_tbox/project/src/_demo/main.c b/xmake/templates/c/static_library_tbox/project/src/_demo/main.c deleted file mode 100644 index 818ff6919..000000000 --- a/xmake/templates/c/static_library_tbox/project/src/_demo/main.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "[targetname]/interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * main - */ -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - // init tbox - if (!tb_init(tb_null, tb_null)) return -1; - - // trace - tb_trace_i("hello tbox!"); - - // test - tb_trace_i("add(1 + 1) = %d", add(1, 1)); - - // exit tbox - tb_exit(); - return 0; -} diff --git a/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua deleted file mode 100644 index c62ddcec5..000000000 --- a/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua +++ /dev/null @@ -1,18 +0,0 @@ --- add target -target("demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add defines - add_defines("__tb_prefix__=\"demo\"") - - -- add files - add_files("*.c") - - -- add packages - add_packages("tbox") - diff --git a/xmake/templates/c/static_library_tbox/project/src/_library/interface.c b/xmake/templates/c/static_library_tbox/project/src/_library/interface.c deleted file mode 100644 index a0ccb007b..000000000 --- a/xmake/templates/c/static_library_tbox/project/src/_library/interface.c +++ /dev/null @@ -1,12 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "interface.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * implementation - */ -tb_int_t add(tb_int_t a, tb_int_t b) -{ - return a + b; -} diff --git a/xmake/templates/c/static_library_tbox/project/src/_library/interface.h b/xmake/templates/c/static_library_tbox/project/src/_library/interface.h deleted file mode 100644 index f4f4a07e1..000000000 --- a/xmake/templates/c/static_library_tbox/project/src/_library/interface.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H - -/* ////////////////////////////////////////////////////////////////////////////////////// - * includes - */ -#include "tbox/tbox.h" - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_enter__ - - -/*! calculate add(a, b) - * - * @param a the first argument - * @param b the second argument - * - * @return the result - */ -tb_int_t add(tb_int_t a, tb_int_t b); - -/* ////////////////////////////////////////////////////////////////////////////////////// - * extern - */ -__tb_extern_c_leave__ - -#endif diff --git a/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua deleted file mode 100644 index 45967cabc..000000000 --- a/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua +++ /dev/null @@ -1,21 +0,0 @@ --- add target -target("[targetname]") - - -- set kind - set_kind("static") - - -- add defines - add_defines("__tb_prefix__=\"[targetname]\"") - - -- add the header files for installing - add_headerfiles("../([targetname]/**.h)") - - -- add includes directory - add_includedirs("..", {interface = true}) - - -- add packages - add_packages("tbox") - - -- add files - add_files("*.c") - diff --git a/xmake/templates/c/static_library_tbox/project/xmake.lua b/xmake/templates/c/static_library_tbox/project/xmake.lua deleted file mode 100644 index 1ebaa6e34..000000000 --- a/xmake/templates/c/static_library_tbox/project/xmake.lua +++ /dev/null @@ -1,69 +0,0 @@ --- version -set_xmakever("2.2.5") - --- set warning all as error -set_warnings("all", "error") - --- set language: c99, c++11 -set_languages("c99", "cxx11") - --- disable some compiler errors -add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") -add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") - --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") - - -- add defines for debug - add_defines("__tb_debug__") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- strip all symbols - set_strip("all") - - -- enable fastest optimization - set_optimize("fastest") -end - --- for the windows platform (msvc) -if is_plat("windows") then - - -- the release mode - if is_mode("release") then - - -- link libcmt.lib - add_cxflags("-MT") - - -- the debug mode - elseif is_mode("debug") then - - -- link libcmtd.lib - add_cxflags("-MTd") - end - - -- no msvcrt.lib - add_ldflags("-nodefaultlib:msvcrt.lib") -end - --- add syslinks -if is_plat("windows") then add_syslinks("ws2_32") -elseif is_plat("android") then add_syslinks("m", "c") -else add_syslinks("pthread", "dl", "m", "c") end - --- add requires -add_requires("tbox", {debug = is_mode("debug")}) - --- include project sources -includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c/static_library_tbox/template.lua b/xmake/templates/c/static_library_tbox/template.lua deleted file mode 100644 index 99f223e1b..000000000 --- a/xmake/templates/c/static_library_tbox/template.lua +++ /dev/null @@ -1,25 +0,0 @@ --- set name -set_name("static_tbox") - --- set description -set_description("The Static Library (tbox)") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") -add_macrofiles("src/_demo/main.c") -add_macrofiles("src/_demo/xmake.lua") -add_macrofiles("src/_library/xmake.lua") - --- set create script -on_create(function () - - -- rename target directory - os.mv("src/_library", "src/$(targetname)") - os.mv("src/_demo", "src/$(targetname)_demo") -end) diff --git a/xmake/templates/c/tbox.console/project/src/main.c b/xmake/templates/c/tbox.console/project/src/main.c new file mode 100644 index 000000000..ad676ef58 --- /dev/null +++ b/xmake/templates/c/tbox.console/project/src/main.c @@ -0,0 +1,20 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c/tbox.console/project/src/xmake.lua b/xmake/templates/c/tbox.console/project/src/xmake.lua new file mode 100644 index 000000000..3f528a7ec --- /dev/null +++ b/xmake/templates/c/tbox.console/project/src/xmake.lua @@ -0,0 +1,15 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("binary") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.c") + diff --git a/xmake/templates/c/tbox.console/project/xmake.lua b/xmake/templates/c/tbox.console/project/xmake.lua new file mode 100644 index 000000000..83a45434f --- /dev/null +++ b/xmake/templates/c/tbox.console/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.2") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src") diff --git a/xmake/templates/c/tbox.console/template.lua b/xmake/templates/c/tbox.console/template.lua new file mode 100644 index 000000000..f1edee39b --- /dev/null +++ b/xmake/templates/c/tbox.console/template.lua @@ -0,0 +1,15 @@ +-- set name +set_name("tbox.console") + +-- set description +set_description("The Console Program (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("src/xmake.lua") + diff --git a/xmake/templates/c/tbox.shared/project/src/_demo/main.c b/xmake/templates/c/tbox.shared/project/src/_demo/main.c new file mode 100644 index 000000000..818ff6919 --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/src/_demo/main.c @@ -0,0 +1,23 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "[targetname]/interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // test + tb_trace_i("add(1 + 1) = %d", add(1, 1)); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua b/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua new file mode 100644 index 000000000..c62ddcec5 --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua @@ -0,0 +1,18 @@ +-- add target +target("demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add defines + add_defines("__tb_prefix__=\"demo\"") + + -- add files + add_files("*.c") + + -- add packages + add_packages("tbox") + diff --git a/xmake/templates/c/tbox.shared/project/src/_library/interface.c b/xmake/templates/c/tbox.shared/project/src/_library/interface.c new file mode 100644 index 000000000..a0ccb007b --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/src/_library/interface.c @@ -0,0 +1,12 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ +tb_int_t add(tb_int_t a, tb_int_t b) +{ + return a + b; +} diff --git a/xmake/templates/c/tbox.shared/project/src/_library/interface.h b/xmake/templates/c/tbox.shared/project/src/_library/interface.h new file mode 100644 index 000000000..944af8121 --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/src/_library/interface.h @@ -0,0 +1,29 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +__tb_export__ tb_int_t add(tb_int_t a, tb_int_t b); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua b/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua new file mode 100644 index 000000000..cb36ba3b8 --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua @@ -0,0 +1,21 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add the header files for installing + add_headerfiles("../([targetname]/**.h)") + + -- add includes directory + add_includedirs("..", {interface = true}) + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.c") + diff --git a/xmake/templates/c/tbox.shared/project/xmake.lua b/xmake/templates/c/tbox.shared/project/xmake.lua new file mode 100644 index 000000000..1ebaa6e34 --- /dev/null +++ b/xmake/templates/c/tbox.shared/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.5") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c/tbox.shared/template.lua b/xmake/templates/c/tbox.shared/template.lua new file mode 100644 index 000000000..c64f17262 --- /dev/null +++ b/xmake/templates/c/tbox.shared/template.lua @@ -0,0 +1,25 @@ +-- set name +set_name("tbox.shared") + +-- set description +set_description("The Shared Library (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") +add_macrofiles("src/_demo/main.c") +add_macrofiles("src/_demo/xmake.lua") +add_macrofiles("src/_library/xmake.lua") + +-- set create script +on_create(function () + + -- rename target directory + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") +end) diff --git a/xmake/templates/c/tbox.static/project/src/_demo/main.c b/xmake/templates/c/tbox.static/project/src/_demo/main.c new file mode 100644 index 000000000..818ff6919 --- /dev/null +++ b/xmake/templates/c/tbox.static/project/src/_demo/main.c @@ -0,0 +1,23 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "[targetname]/interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * main + */ +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + // init tbox + if (!tb_init(tb_null, tb_null)) return -1; + + // trace + tb_trace_i("hello tbox!"); + + // test + tb_trace_i("add(1 + 1) = %d", add(1, 1)); + + // exit tbox + tb_exit(); + return 0; +} diff --git a/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua b/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua new file mode 100644 index 000000000..c62ddcec5 --- /dev/null +++ b/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua @@ -0,0 +1,18 @@ +-- add target +target("demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add defines + add_defines("__tb_prefix__=\"demo\"") + + -- add files + add_files("*.c") + + -- add packages + add_packages("tbox") + diff --git a/xmake/templates/c/tbox.static/project/src/_library/interface.c b/xmake/templates/c/tbox.static/project/src/_library/interface.c new file mode 100644 index 000000000..a0ccb007b --- /dev/null +++ b/xmake/templates/c/tbox.static/project/src/_library/interface.c @@ -0,0 +1,12 @@ +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "interface.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ +tb_int_t add(tb_int_t a, tb_int_t b) +{ + return a + b; +} diff --git a/xmake/templates/c/tbox.static/project/src/_library/interface.h b/xmake/templates/c/tbox.static/project/src/_library/interface.h new file mode 100644 index 000000000..f4f4a07e1 --- /dev/null +++ b/xmake/templates/c/tbox.static/project/src/_library/interface.h @@ -0,0 +1,29 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "tbox/tbox.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_enter__ + + +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +tb_int_t add(tb_int_t a, tb_int_t b); + +/* ////////////////////////////////////////////////////////////////////////////////////// + * extern + */ +__tb_extern_c_leave__ + +#endif diff --git a/xmake/templates/c/tbox.static/project/src/_library/xmake.lua b/xmake/templates/c/tbox.static/project/src/_library/xmake.lua new file mode 100644 index 000000000..45967cabc --- /dev/null +++ b/xmake/templates/c/tbox.static/project/src/_library/xmake.lua @@ -0,0 +1,21 @@ +-- add target +target("[targetname]") + + -- set kind + set_kind("static") + + -- add defines + add_defines("__tb_prefix__=\"[targetname]\"") + + -- add the header files for installing + add_headerfiles("../([targetname]/**.h)") + + -- add includes directory + add_includedirs("..", {interface = true}) + + -- add packages + add_packages("tbox") + + -- add files + add_files("*.c") + diff --git a/xmake/templates/c/tbox.static/project/xmake.lua b/xmake/templates/c/tbox.static/project/xmake.lua new file mode 100644 index 000000000..1ebaa6e34 --- /dev/null +++ b/xmake/templates/c/tbox.static/project/xmake.lua @@ -0,0 +1,69 @@ +-- version +set_xmakever("2.2.5") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- disable some compiler errors +add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") +add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") + +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- enable fastest optimization + set_optimize("fastest") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:msvcrt.lib") +end + +-- add syslinks +if is_plat("windows") then add_syslinks("ws2_32") +elseif is_plat("android") then add_syslinks("m", "c") +else add_syslinks("pthread", "dl", "m", "c") end + +-- add requires +add_requires("tbox", {debug = is_mode("debug")}) + +-- include project sources +includes("src/[targetname]", "src/[targetname]_demo") diff --git a/xmake/templates/c/tbox.static/template.lua b/xmake/templates/c/tbox.static/template.lua new file mode 100644 index 000000000..9ddc683f7 --- /dev/null +++ b/xmake/templates/c/tbox.static/template.lua @@ -0,0 +1,25 @@ +-- set name +set_name("tbox.static") + +-- set description +set_description("The Static Library (tbox)") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") +add_macrofiles("src/_demo/main.c") +add_macrofiles("src/_demo/xmake.lua") +add_macrofiles("src/_library/xmake.lua") + +-- set create script +on_create(function () + + -- rename target directory + os.mv("src/_library", "src/$(targetname)") + os.mv("src/_demo", "src/$(targetname)_demo") +end) diff --git a/xmake/templates/cuda/shared/project/inc/lib.cuh b/xmake/templates/cuda/shared/project/inc/lib.cuh new file mode 100644 index 000000000..5565e3eb5 --- /dev/null +++ b/xmake/templates/cuda/shared/project/inc/lib.cuh @@ -0,0 +1,22 @@ +#pragma once + +#include "cuda_runtime.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 cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size); + +#ifdef __cplusplus +} +#endif diff --git a/xmake/templates/cuda/shared/project/src/lib.cu b/xmake/templates/cuda/shared/project/src/lib.cu new file mode 100644 index 000000000..d2cff9ac2 --- /dev/null +++ b/xmake/templates/cuda/shared/project/src/lib.cu @@ -0,0 +1,98 @@ +#include +#include +#include "device_launch_parameters.h" + +__global__ void addKernel(int *c, const int *a, const int *b) +{ + int i = threadIdx.x; + c[i] = a[i] + b[i]; +} + +// Helper function for using CUDA to add vectors in parallel. +cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size) +{ + int *dev_a = 0; + int *dev_b = 0; + int *dev_c = 0; + cudaError_t cudaStatus; + + // Choose which GPU to run on, change this on a multi-GPU system. + cudaStatus = cudaSetDevice(0); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?"); + goto Error; + } + + // Allocate GPU buffers for three vectors (two input, one output) . + cudaStatus = cudaMalloc((void **)&dev_c, size * sizeof(int)); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMalloc failed!"); + goto Error; + } + + cudaStatus = cudaMalloc((void **)&dev_a, size * sizeof(int)); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMalloc failed!"); + goto Error; + } + + cudaStatus = cudaMalloc((void **)&dev_b, size * sizeof(int)); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMalloc failed!"); + goto Error; + } + + // Copy input vectors from host memory to GPU buffers. + cudaStatus = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMemcpy failed!"); + goto Error; + } + + cudaStatus = cudaMemcpy(dev_b, b, size * sizeof(int), cudaMemcpyHostToDevice); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMemcpy failed!"); + goto Error; + } + + // Launch a kernel on the GPU with one thread for each element. + addKernel<<<1, size>>>(dev_c, dev_a, dev_b); + + // Check for any errors launching the kernel + cudaStatus = cudaGetLastError(); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus)); + goto Error; + } + + // cudaDeviceSynchronize waits for the kernel to finish, and returns + // any errors encountered during the launch. + cudaStatus = cudaDeviceSynchronize(); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus); + goto Error; + } + + // Copy output vector from GPU buffer to host memory. + cudaStatus = cudaMemcpy(c, dev_c, size * sizeof(int), cudaMemcpyDeviceToHost); + if (cudaStatus != cudaSuccess) + { + fprintf(stderr, "cudaMemcpy failed!"); + goto Error; + } + +Error: + cudaFree(dev_c); + cudaFree(dev_a); + cudaFree(dev_b); + + return cudaStatus; +} diff --git a/xmake/templates/cuda/shared/project/xmake.lua b/xmake/templates/cuda/shared/project/xmake.lua new file mode 100644 index 000000000..ceef4438d --- /dev/null +++ b/xmake/templates/cuda/shared/project/xmake.lua @@ -0,0 +1,36 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- define target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add modes: debug and release + add_rules("mode.debug", "mode.release") + + -- add include dirs + add_includedirs("inc") + + -- generate relocatable device code for device linker of dependents. + -- if __device__ or __global__ functions will be called cross file, + -- or dynamic parallelism will be used, + -- this instruction should be opted in. + -- add_cuflags("-rdc=true") + + -- add files + add_files("src/**.cu") + + -- generate SASS code for SM architecture of current host + add_cugencodes("native") + + -- generate PTX code for the virtual architecture to guarantee compatibility + add_cugencodes("compute_30") + + -- -- generate SASS code for each SM architecture + -- add_cugencodes("sm_30", "sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75") + + -- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility + -- add_cugencodes("compute_75") diff --git a/xmake/templates/cuda/shared/template.lua b/xmake/templates/cuda/shared/template.lua new file mode 100644 index 000000000..6df920968 --- /dev/null +++ b/xmake/templates/cuda/shared/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("shared") + +-- set description +set_description("The Shared Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") \ No newline at end of file diff --git a/xmake/templates/cuda/shared_library/project/inc/lib.cuh b/xmake/templates/cuda/shared_library/project/inc/lib.cuh deleted file mode 100644 index 5565e3eb5..000000000 --- a/xmake/templates/cuda/shared_library/project/inc/lib.cuh +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "cuda_runtime.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 cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size); - -#ifdef __cplusplus -} -#endif diff --git a/xmake/templates/cuda/shared_library/project/src/lib.cu b/xmake/templates/cuda/shared_library/project/src/lib.cu deleted file mode 100644 index d2cff9ac2..000000000 --- a/xmake/templates/cuda/shared_library/project/src/lib.cu +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include "device_launch_parameters.h" - -__global__ void addKernel(int *c, const int *a, const int *b) -{ - int i = threadIdx.x; - c[i] = a[i] + b[i]; -} - -// Helper function for using CUDA to add vectors in parallel. -cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size) -{ - int *dev_a = 0; - int *dev_b = 0; - int *dev_c = 0; - cudaError_t cudaStatus; - - // Choose which GPU to run on, change this on a multi-GPU system. - cudaStatus = cudaSetDevice(0); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?"); - goto Error; - } - - // Allocate GPU buffers for three vectors (two input, one output) . - cudaStatus = cudaMalloc((void **)&dev_c, size * sizeof(int)); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMalloc failed!"); - goto Error; - } - - cudaStatus = cudaMalloc((void **)&dev_a, size * sizeof(int)); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMalloc failed!"); - goto Error; - } - - cudaStatus = cudaMalloc((void **)&dev_b, size * sizeof(int)); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMalloc failed!"); - goto Error; - } - - // Copy input vectors from host memory to GPU buffers. - cudaStatus = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMemcpy failed!"); - goto Error; - } - - cudaStatus = cudaMemcpy(dev_b, b, size * sizeof(int), cudaMemcpyHostToDevice); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMemcpy failed!"); - goto Error; - } - - // Launch a kernel on the GPU with one thread for each element. - addKernel<<<1, size>>>(dev_c, dev_a, dev_b); - - // Check for any errors launching the kernel - cudaStatus = cudaGetLastError(); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus)); - goto Error; - } - - // cudaDeviceSynchronize waits for the kernel to finish, and returns - // any errors encountered during the launch. - cudaStatus = cudaDeviceSynchronize(); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus); - goto Error; - } - - // Copy output vector from GPU buffer to host memory. - cudaStatus = cudaMemcpy(c, dev_c, size * sizeof(int), cudaMemcpyDeviceToHost); - if (cudaStatus != cudaSuccess) - { - fprintf(stderr, "cudaMemcpy failed!"); - goto Error; - } - -Error: - cudaFree(dev_c); - cudaFree(dev_a); - cudaFree(dev_b); - - return cudaStatus; -} diff --git a/xmake/templates/cuda/shared_library/project/xmake.lua b/xmake/templates/cuda/shared_library/project/xmake.lua deleted file mode 100644 index ceef4438d..000000000 --- a/xmake/templates/cuda/shared_library/project/xmake.lua +++ /dev/null @@ -1,36 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- define target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add modes: debug and release - add_rules("mode.debug", "mode.release") - - -- add include dirs - add_includedirs("inc") - - -- generate relocatable device code for device linker of dependents. - -- if __device__ or __global__ functions will be called cross file, - -- or dynamic parallelism will be used, - -- this instruction should be opted in. - -- add_cuflags("-rdc=true") - - -- add files - add_files("src/**.cu") - - -- generate SASS code for SM architecture of current host - add_cugencodes("native") - - -- generate PTX code for the virtual architecture to guarantee compatibility - add_cugencodes("compute_30") - - -- -- generate SASS code for each SM architecture - -- add_cugencodes("sm_30", "sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75") - - -- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility - -- add_cugencodes("compute_75") diff --git a/xmake/templates/cuda/shared_library/template.lua b/xmake/templates/cuda/shared_library/template.lua deleted file mode 100644 index 6df920968..000000000 --- a/xmake/templates/cuda/shared_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("shared") - --- set description -set_description("The Shared Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") \ No newline at end of file diff --git a/xmake/templates/cuda/static/project/inc/lib.cuh b/xmake/templates/cuda/static/project/inc/lib.cuh new file mode 100644 index 000000000..35255e31e --- /dev/null +++ b/xmake/templates/cuda/static/project/inc/lib.cuh @@ -0,0 +1,3 @@ +#pragma once + +__global__ void addKernel(int *c, const int *a, const int *b); \ No newline at end of file diff --git a/xmake/templates/cuda/static/project/src/lib.cu b/xmake/templates/cuda/static/project/src/lib.cu new file mode 100644 index 000000000..a5f054354 --- /dev/null +++ b/xmake/templates/cuda/static/project/src/lib.cu @@ -0,0 +1,7 @@ +#include + +__global__ void addKernel(int *c, const int *a, const int *b) +{ + int i = threadIdx.x; + c[i] = a[i] + b[i]; +} \ No newline at end of file diff --git a/xmake/templates/cuda/static/project/xmake.lua b/xmake/templates/cuda/static/project/xmake.lua new file mode 100644 index 000000000..3896fb238 --- /dev/null +++ b/xmake/templates/cuda/static/project/xmake.lua @@ -0,0 +1,36 @@ + +-- add modes: debug and release +add_rules("mode.debug", "mode.release") + +-- define target +target("[targetname]") + + -- set kind + set_kind("static") + + -- add modes: debug and release + add_rules("mode.debug", "mode.release") + + -- add include dirs + add_includedirs("inc") + + -- generate relocatable device code for device linker of dependents. + -- if neither __device__ and __global__ functions will be called cross file or be exported, + -- nor dynamic parallelism will be used, + -- this instruction could be omitted. + add_cuflags("-rdc=true") + + -- add files + add_files("src/**.cu") + + -- generate SASS code for SM architecture of current host + add_cugencodes("native") + + -- generate PTX code for the virtual architecture to guarantee compatibility + add_cugencodes("compute_30") + + -- -- generate SASS code for each SM architecture + -- add_cugencodes("sm_30", "sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75") + + -- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility + -- add_cugencodes("compute_75") diff --git a/xmake/templates/cuda/static/template.lua b/xmake/templates/cuda/static/template.lua new file mode 100644 index 000000000..ff9c56179 --- /dev/null +++ b/xmake/templates/cuda/static/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("static") + +-- set description +set_description("The Static Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") \ No newline at end of file diff --git a/xmake/templates/cuda/static_library/project/inc/lib.cuh b/xmake/templates/cuda/static_library/project/inc/lib.cuh deleted file mode 100644 index 35255e31e..000000000 --- a/xmake/templates/cuda/static_library/project/inc/lib.cuh +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -__global__ void addKernel(int *c, const int *a, const int *b); \ No newline at end of file diff --git a/xmake/templates/cuda/static_library/project/src/lib.cu b/xmake/templates/cuda/static_library/project/src/lib.cu deleted file mode 100644 index a5f054354..000000000 --- a/xmake/templates/cuda/static_library/project/src/lib.cu +++ /dev/null @@ -1,7 +0,0 @@ -#include - -__global__ void addKernel(int *c, const int *a, const int *b) -{ - int i = threadIdx.x; - c[i] = a[i] + b[i]; -} \ No newline at end of file diff --git a/xmake/templates/cuda/static_library/project/xmake.lua b/xmake/templates/cuda/static_library/project/xmake.lua deleted file mode 100644 index 3896fb238..000000000 --- a/xmake/templates/cuda/static_library/project/xmake.lua +++ /dev/null @@ -1,36 +0,0 @@ - --- add modes: debug and release -add_rules("mode.debug", "mode.release") - --- define target -target("[targetname]") - - -- set kind - set_kind("static") - - -- add modes: debug and release - add_rules("mode.debug", "mode.release") - - -- add include dirs - add_includedirs("inc") - - -- generate relocatable device code for device linker of dependents. - -- if neither __device__ and __global__ functions will be called cross file or be exported, - -- nor dynamic parallelism will be used, - -- this instruction could be omitted. - add_cuflags("-rdc=true") - - -- add files - add_files("src/**.cu") - - -- generate SASS code for SM architecture of current host - add_cugencodes("native") - - -- generate PTX code for the virtual architecture to guarantee compatibility - add_cugencodes("compute_30") - - -- -- generate SASS code for each SM architecture - -- add_cugencodes("sm_30", "sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75") - - -- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility - -- add_cugencodes("compute_75") diff --git a/xmake/templates/cuda/static_library/template.lua b/xmake/templates/cuda/static_library/template.lua deleted file mode 100644 index ff9c56179..000000000 --- a/xmake/templates/cuda/static_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("static") - --- set description -set_description("The Static Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") \ No newline at end of file diff --git a/xmake/templates/dlang/shared/project/src/interfaces.d b/xmake/templates/dlang/shared/project/src/interfaces.d new file mode 100644 index 000000000..3386c9124 --- /dev/null +++ b/xmake/templates/dlang/shared/project/src/interfaces.d @@ -0,0 +1,9 @@ +extern(C) int add(int a, int b) +{ + return a + b; +} + +extern(C) int sub(int a, int b) +{ + return a - b; +} diff --git a/xmake/templates/dlang/shared/project/src/main.d b/xmake/templates/dlang/shared/project/src/main.d new file mode 100644 index 000000000..3137de217 --- /dev/null +++ b/xmake/templates/dlang/shared/project/src/main.d @@ -0,0 +1,8 @@ +import std.stdio; +import interfaces; + +void main() +{ + printf("add: %d\n", interfaces.add(1, 1)); + printf("sub: %d\n", interfaces.sub(2, 1)); +} diff --git a/xmake/templates/dlang/shared/project/xmake.lua b/xmake/templates/dlang/shared/project/xmake.lua new file mode 100644 index 000000000..962994618 --- /dev/null +++ b/xmake/templates/dlang/shared/project/xmake.lua @@ -0,0 +1,53 @@ +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- enable fastest optimization + set_optimize("fastest") + + -- strip all symbols + set_strip("all") +end + +-- add target +target("[targetname]") + + -- set kind + set_kind("shared") + + -- add files + add_files("src/interfaces.d") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("test") + + -- add files + add_files("src/main.d") + + -- add links + add_links("[targetname]") + + -- add link directory + add_linkdirs("$(buildir)") + + -- add include directory + add_includedirs("$(projectdir)/src") + diff --git a/xmake/templates/dlang/shared/template.lua b/xmake/templates/dlang/shared/template.lua new file mode 100644 index 000000000..666542844 --- /dev/null +++ b/xmake/templates/dlang/shared/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("shared") + +-- set description +set_description("The Shared Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/dlang/shared_library/project/src/interfaces.d b/xmake/templates/dlang/shared_library/project/src/interfaces.d deleted file mode 100644 index 3386c9124..000000000 --- a/xmake/templates/dlang/shared_library/project/src/interfaces.d +++ /dev/null @@ -1,9 +0,0 @@ -extern(C) int add(int a, int b) -{ - return a + b; -} - -extern(C) int sub(int a, int b) -{ - return a - b; -} diff --git a/xmake/templates/dlang/shared_library/project/src/main.d b/xmake/templates/dlang/shared_library/project/src/main.d deleted file mode 100644 index 3137de217..000000000 --- a/xmake/templates/dlang/shared_library/project/src/main.d +++ /dev/null @@ -1,8 +0,0 @@ -import std.stdio; -import interfaces; - -void main() -{ - printf("add: %d\n", interfaces.add(1, 1)); - printf("sub: %d\n", interfaces.sub(2, 1)); -} diff --git a/xmake/templates/dlang/shared_library/project/xmake.lua b/xmake/templates/dlang/shared_library/project/xmake.lua deleted file mode 100644 index 962994618..000000000 --- a/xmake/templates/dlang/shared_library/project/xmake.lua +++ /dev/null @@ -1,53 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("[targetname]") - - -- set kind - set_kind("shared") - - -- add files - add_files("src/interfaces.d") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("test") - - -- add files - add_files("src/main.d") - - -- add links - add_links("[targetname]") - - -- add link directory - add_linkdirs("$(buildir)") - - -- add include directory - add_includedirs("$(projectdir)/src") - diff --git a/xmake/templates/dlang/shared_library/template.lua b/xmake/templates/dlang/shared_library/template.lua deleted file mode 100644 index 666542844..000000000 --- a/xmake/templates/dlang/shared_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("shared") - --- set description -set_description("The Shared Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/dlang/static/project/src/interfaces.d b/xmake/templates/dlang/static/project/src/interfaces.d new file mode 100644 index 000000000..3386c9124 --- /dev/null +++ b/xmake/templates/dlang/static/project/src/interfaces.d @@ -0,0 +1,9 @@ +extern(C) int add(int a, int b) +{ + return a + b; +} + +extern(C) int sub(int a, int b) +{ + return a - b; +} diff --git a/xmake/templates/dlang/static/project/src/main.d b/xmake/templates/dlang/static/project/src/main.d new file mode 100644 index 000000000..3137de217 --- /dev/null +++ b/xmake/templates/dlang/static/project/src/main.d @@ -0,0 +1,8 @@ +import std.stdio; +import interfaces; + +void main() +{ + printf("add: %d\n", interfaces.add(1, 1)); + printf("sub: %d\n", interfaces.sub(2, 1)); +} diff --git a/xmake/templates/dlang/static/project/xmake.lua b/xmake/templates/dlang/static/project/xmake.lua new file mode 100644 index 000000000..8cc9d7d9d --- /dev/null +++ b/xmake/templates/dlang/static/project/xmake.lua @@ -0,0 +1,53 @@ +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- enable fastest optimization + set_optimize("fastest") + + -- strip all symbols + set_strip("all") +end + +-- add target +target("[targetname]") + + -- set kind + set_kind("static") + + -- add files + add_files("src/interfaces.d") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("[targetname]") + + -- add files + add_files("src/main.d") + + -- add links + add_links("[targetname]") + + -- add link directory + add_linkdirs("$(buildir)") + + -- add include directory + add_includedirs("$(projectdir)/src") + diff --git a/xmake/templates/dlang/static/template.lua b/xmake/templates/dlang/static/template.lua new file mode 100644 index 000000000..f05045e07 --- /dev/null +++ b/xmake/templates/dlang/static/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("static") + +-- set description +set_description("The Static Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/dlang/static_library/project/src/interfaces.d b/xmake/templates/dlang/static_library/project/src/interfaces.d deleted file mode 100644 index 3386c9124..000000000 --- a/xmake/templates/dlang/static_library/project/src/interfaces.d +++ /dev/null @@ -1,9 +0,0 @@ -extern(C) int add(int a, int b) -{ - return a + b; -} - -extern(C) int sub(int a, int b) -{ - return a - b; -} diff --git a/xmake/templates/dlang/static_library/project/src/main.d b/xmake/templates/dlang/static_library/project/src/main.d deleted file mode 100644 index 3137de217..000000000 --- a/xmake/templates/dlang/static_library/project/src/main.d +++ /dev/null @@ -1,8 +0,0 @@ -import std.stdio; -import interfaces; - -void main() -{ - printf("add: %d\n", interfaces.add(1, 1)); - printf("sub: %d\n", interfaces.sub(2, 1)); -} diff --git a/xmake/templates/dlang/static_library/project/xmake.lua b/xmake/templates/dlang/static_library/project/xmake.lua deleted file mode 100644 index 8cc9d7d9d..000000000 --- a/xmake/templates/dlang/static_library/project/xmake.lua +++ /dev/null @@ -1,53 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("[targetname]") - - -- set kind - set_kind("static") - - -- add files - add_files("src/interfaces.d") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("[targetname]") - - -- add files - add_files("src/main.d") - - -- add links - add_links("[targetname]") - - -- add link directory - add_linkdirs("$(buildir)") - - -- add include directory - add_includedirs("$(projectdir)/src") - diff --git a/xmake/templates/dlang/static_library/template.lua b/xmake/templates/dlang/static_library/template.lua deleted file mode 100644 index f05045e07..000000000 --- a/xmake/templates/dlang/static_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("static") - --- set description -set_description("The Static Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/go/static/project/src/main.go b/xmake/templates/go/static/project/src/main.go new file mode 100644 index 000000000..f2b477453 --- /dev/null +++ b/xmake/templates/go/static/project/src/main.go @@ -0,0 +1,7 @@ +package main + +func main() { + + Run() +} + diff --git a/xmake/templates/go/static/project/src/test.go b/xmake/templates/go/static/project/src/test.go new file mode 100644 index 000000000..cf10523f9 --- /dev/null +++ b/xmake/templates/go/static/project/src/test.go @@ -0,0 +1,12 @@ +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)); +} diff --git a/xmake/templates/go/static/project/src/test/add.go b/xmake/templates/go/static/project/src/test/add.go new file mode 100644 index 000000000..98ffef600 --- /dev/null +++ b/xmake/templates/go/static/project/src/test/add.go @@ -0,0 +1,6 @@ +package module + +func Add(a int, b int) int { + return a + b; +} + diff --git a/xmake/templates/go/static/project/src/test/sub.go b/xmake/templates/go/static/project/src/test/sub.go new file mode 100644 index 000000000..a24a9abb7 --- /dev/null +++ b/xmake/templates/go/static/project/src/test/sub.go @@ -0,0 +1,6 @@ +package module + +func Sub(a int, b int) int { + return a - b; +} + diff --git a/xmake/templates/go/static/project/xmake.lua b/xmake/templates/go/static/project/xmake.lua new file mode 100644 index 000000000..ddf3b14c5 --- /dev/null +++ b/xmake/templates/go/static/project/xmake.lua @@ -0,0 +1,50 @@ +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- enable fastest optimization + set_optimize("fastest") + + -- strip all symbols + set_strip("all") +end + +-- add target +target("module") + + -- set kind + set_kind("static") + + -- add files + add_files("src/test/*.go") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("module") + + -- add files + add_files("src/*.go") + + -- add link directory + add_linkdirs("$(buildir)") + + -- add include directory + add_includedirs("$(buildir)") + diff --git a/xmake/templates/go/static/template.lua b/xmake/templates/go/static/template.lua new file mode 100644 index 000000000..f05045e07 --- /dev/null +++ b/xmake/templates/go/static/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("static") + +-- set description +set_description("The Static Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/go/static_library/project/src/main.go b/xmake/templates/go/static_library/project/src/main.go deleted file mode 100644 index f2b477453..000000000 --- a/xmake/templates/go/static_library/project/src/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -func main() { - - Run() -} - diff --git a/xmake/templates/go/static_library/project/src/test.go b/xmake/templates/go/static_library/project/src/test.go deleted file mode 100644 index cf10523f9..000000000 --- a/xmake/templates/go/static_library/project/src/test.go +++ /dev/null @@ -1,12 +0,0 @@ -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)); -} diff --git a/xmake/templates/go/static_library/project/src/test/add.go b/xmake/templates/go/static_library/project/src/test/add.go deleted file mode 100644 index 98ffef600..000000000 --- a/xmake/templates/go/static_library/project/src/test/add.go +++ /dev/null @@ -1,6 +0,0 @@ -package module - -func Add(a int, b int) int { - return a + b; -} - diff --git a/xmake/templates/go/static_library/project/src/test/sub.go b/xmake/templates/go/static_library/project/src/test/sub.go deleted file mode 100644 index a24a9abb7..000000000 --- a/xmake/templates/go/static_library/project/src/test/sub.go +++ /dev/null @@ -1,6 +0,0 @@ -package module - -func Sub(a int, b int) int { - return a - b; -} - diff --git a/xmake/templates/go/static_library/project/xmake.lua b/xmake/templates/go/static_library/project/xmake.lua deleted file mode 100644 index ddf3b14c5..000000000 --- a/xmake/templates/go/static_library/project/xmake.lua +++ /dev/null @@ -1,50 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("module") - - -- set kind - set_kind("static") - - -- add files - add_files("src/test/*.go") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("module") - - -- add files - add_files("src/*.go") - - -- add link directory - add_linkdirs("$(buildir)") - - -- add include directory - add_includedirs("$(buildir)") - diff --git a/xmake/templates/go/static_library/template.lua b/xmake/templates/go/static_library/template.lua deleted file mode 100644 index f05045e07..000000000 --- a/xmake/templates/go/static_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("static") - --- set description -set_description("The Static Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") diff --git a/xmake/templates/rust/static/project/src/interfaces.rs b/xmake/templates/rust/static/project/src/interfaces.rs new file mode 100644 index 000000000..277008ba4 --- /dev/null +++ b/xmake/templates/rust/static/project/src/interfaces.rs @@ -0,0 +1,5 @@ +pub fn add(a: i32, b: i32) -> i32 +{ + return a + b; +} + diff --git a/xmake/templates/rust/static/project/src/main.rs b/xmake/templates/rust/static/project/src/main.rs new file mode 100644 index 000000000..0cd4449d1 --- /dev/null +++ b/xmake/templates/rust/static/project/src/main.rs @@ -0,0 +1,7 @@ +extern crate interfaces; + +fn main() +{ + println!("hello xmake!"); + println!("add: {}", interfaces::add(1, 1)); +} diff --git a/xmake/templates/rust/static/project/xmake.lua b/xmake/templates/rust/static/project/xmake.lua new file mode 100644 index 000000000..c3a5b497a --- /dev/null +++ b/xmake/templates/rust/static/project/xmake.lua @@ -0,0 +1,48 @@ +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- enable fastest optimization + set_optimize("fastest") + + -- strip all symbols + set_strip("all") +end + +-- add target +target("interfaces") + + -- set kind + set_kind("static") + + -- add files + add_files("src/interfaces.rs") + +-- add target +target("[targetname]_demo") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("interfaces") + + -- add files + add_files("src/main.rs") + + -- add link directory + add_linkdirs("$(buildir)") + + diff --git a/xmake/templates/rust/static/template.lua b/xmake/templates/rust/static/template.lua new file mode 100644 index 000000000..f05045e07 --- /dev/null +++ b/xmake/templates/rust/static/template.lua @@ -0,0 +1,14 @@ +-- set name +set_name("static") + +-- set description +set_description("The Static Library") + +-- set project directory +set_projectdir("project") + +-- add macros +add_macros("targetname", "$(targetname)") + +-- add macro files +add_macrofiles("xmake.lua") diff --git a/xmake/templates/rust/static_library/project/src/interfaces.rs b/xmake/templates/rust/static_library/project/src/interfaces.rs deleted file mode 100644 index 277008ba4..000000000 --- a/xmake/templates/rust/static_library/project/src/interfaces.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub fn add(a: i32, b: i32) -> i32 -{ - return a + b; -} - diff --git a/xmake/templates/rust/static_library/project/src/main.rs b/xmake/templates/rust/static_library/project/src/main.rs deleted file mode 100644 index 0cd4449d1..000000000 --- a/xmake/templates/rust/static_library/project/src/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate interfaces; - -fn main() -{ - println!("hello xmake!"); - println!("add: {}", interfaces::add(1, 1)); -} diff --git a/xmake/templates/rust/static_library/project/xmake.lua b/xmake/templates/rust/static_library/project/xmake.lua deleted file mode 100644 index c3a5b497a..000000000 --- a/xmake/templates/rust/static_library/project/xmake.lua +++ /dev/null @@ -1,48 +0,0 @@ --- the debug mode -if is_mode("debug") then - - -- enable the debug symbols - set_symbols("debug") - - -- disable optimization - set_optimize("none") -end - --- the release mode -if is_mode("release") then - - -- set the symbols visibility: hidden - set_symbols("hidden") - - -- enable fastest optimization - set_optimize("fastest") - - -- strip all symbols - set_strip("all") -end - --- add target -target("interfaces") - - -- set kind - set_kind("static") - - -- add files - add_files("src/interfaces.rs") - --- add target -target("[targetname]_demo") - - -- set kind - set_kind("binary") - - -- add deps - add_deps("interfaces") - - -- add files - add_files("src/main.rs") - - -- add link directory - add_linkdirs("$(buildir)") - - diff --git a/xmake/templates/rust/static_library/template.lua b/xmake/templates/rust/static_library/template.lua deleted file mode 100644 index f05045e07..000000000 --- a/xmake/templates/rust/static_library/template.lua +++ /dev/null @@ -1,14 +0,0 @@ --- set name -set_name("static") - --- set description -set_description("The Static Library") - --- set project directory -set_projectdir("project") - --- add macros -add_macros("targetname", "$(targetname)") - --- add macro files -add_macrofiles("xmake.lua") -- cgit v1.3.1