From 9c5ba2e3b715fec11219bf9e1f57b2c67f1b7fa9 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 26 Aug 2021 19:56:27 +0200 Subject: Bootstrap --- bootstrap.sh | 2 +- cppbuild.cc | 153 +++++-------------------------------------- examples/cppbuild.cc | 156 ++++++++++++++++++++++++++++++++++++++++++++ examples/subdir/cppbuild.cc | 75 +++++++++++++++++++++ subdir/cppbuild.cc | 75 --------------------- toolchain.cc | 17 ----- toolchain.h | 14 ---- 7 files changed, 250 insertions(+), 242 deletions(-) create mode 100644 examples/cppbuild.cc create mode 100644 examples/subdir/cppbuild.cc delete mode 100644 subdir/cppbuild.cc delete mode 100644 toolchain.cc delete mode 100644 toolchain.h diff --git a/bootstrap.sh b/bootstrap.sh index 29b422b..3605a51 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,2 +1,2 @@ #!/bin/bash -g++ -std=c++17 -pthread libcppbuild.a -o cppbuild +g++ -std=c++17 -I. -pthread *.cc -o cppbuild diff --git a/cppbuild.cc b/cppbuild.cc index d3d21be..c78def1 100644 --- a/cppbuild.cc +++ b/cppbuild.cc @@ -2,155 +2,38 @@ namespace { -BuildConfigurations myConfigs() +BuildConfigurations cppbuildConfigs() { return { { - .type = TargetType::Executable, - .target = "plugingui", + .type = TargetType::StaticLibrary, + .target = "libcppbuild.a", .sources = { - "drumgizmo/zita-resampler/libs/cresampler.cc", - "drumgizmo/zita-resampler/libs/resampler-table.cc", - "drumgizmo/zita-resampler/libs/resampler.cc", - "drumgizmo/zita-resampler/libs/vresampler.cc", - "drumgizmo/hugin/hugin.c", - "drumgizmo/pugixml/src/pugixml.cpp", - }, - .depends = { - "libplugingui.so", - }, - .cxxflags = { - "-DUI_X11", - "-O3", - "-g", - "-Wall", - "-Werror", - "-std=c++11", - "-Idrumgizmo/getoptpp", - "-Idrumgizmo/", - "-Idrumgizmo/hugin", - "-Idrumgizmo/plugingui/", - "-Idrumgizmo/src/", - "-Idrumgizmo/zita-resampler/libs", - "-Idrumgizmo/pugixml/src", - }, - .cflags = { - "-g", - //"-O3", - "-Wall", - "-Werror", - }, - .ldflags = { - "-lm", - "-lX11", - "-lXext", - "-lsndfile", - "-pthread", - } - }, - }; -} - -BuildConfigurations myConfigs2() -{ - return - { - { - .type = TargetType::DynamicLibrary, - .target = "libplugingui.so", - .sources = { - "drumgizmo/plugingui/abouttab.cc", - "drumgizmo/plugingui/bleedcontrolframecontent.cc", - "drumgizmo/plugingui/button.cc", - "drumgizmo/plugingui/button_base.cc", - "drumgizmo/plugingui/checkbox.cc", - "drumgizmo/plugingui/colour.cc", - "drumgizmo/plugingui/combobox.cc", - "drumgizmo/plugingui/dialog.cc", - "drumgizmo/plugingui/diskstreamingframecontent.cc", - "drumgizmo/plugingui/drumkitframecontent.cc", - "drumgizmo/plugingui/drumkittab.cc", - "drumgizmo/plugingui/eventhandler.cc", - "drumgizmo/plugingui/filebrowser.cc", - "drumgizmo/plugingui/font.cc", - "drumgizmo/plugingui/frame.cc", - "drumgizmo/plugingui/helpbutton.cc", - "drumgizmo/plugingui/humaniservisualiser.cc", - "drumgizmo/plugingui/humanizerframecontent.cc", - "drumgizmo/plugingui/image.cc", - "drumgizmo/plugingui/imagecache.cc", - "drumgizmo/plugingui/knob.cc", - "drumgizmo/plugingui/label.cc", - "drumgizmo/plugingui/layout.cc", - "drumgizmo/plugingui/led.cc", - "drumgizmo/plugingui/lineedit.cc", - "drumgizmo/plugingui/listbox.cc", - "drumgizmo/plugingui/listboxbasic.cc", - "drumgizmo/plugingui/listboxthin.cc", - "drumgizmo/plugingui/maintab.cc", - "drumgizmo/plugingui/mainwindow.cc", - "drumgizmo/plugingui/nativewindow_x11.cc", - "drumgizmo/plugingui/painter.cc", - "drumgizmo/plugingui/pixelbuffer.cc", - "drumgizmo/plugingui/pluginconfig.cc", - "drumgizmo/plugingui/powerbutton.cc", - "drumgizmo/plugingui/powerwidget.cc", - "drumgizmo/plugingui/progressbar.cc", - "drumgizmo/plugingui/resamplingframecontent.cc", - "drumgizmo/plugingui/resource.cc", - "drumgizmo/plugingui/resource_data.cc", - "drumgizmo/plugingui/sampleselectionframecontent.cc", - "drumgizmo/plugingui/scrollbar.cc", - "drumgizmo/plugingui/slider.cc", - "drumgizmo/plugingui/stackedwidget.cc", - "drumgizmo/plugingui/statusframecontent.cc", - "drumgizmo/plugingui/tabbutton.cc", - "drumgizmo/plugingui/tabwidget.cc", - "drumgizmo/plugingui/testmain.cc", - "drumgizmo/plugingui/textedit.cc", - "drumgizmo/plugingui/texture.cc", - "drumgizmo/plugingui/texturedbox.cc", - "drumgizmo/plugingui/timingframecontent.cc", - "drumgizmo/plugingui/toggle.cc", - "drumgizmo/plugingui/tooltip.cc", - "drumgizmo/plugingui/uitranslation.cc", - "drumgizmo/plugingui/utf8.cc", - "drumgizmo/plugingui/verticalline.cc", - "drumgizmo/plugingui/visualizerframecontent.cc", - "drumgizmo/plugingui/voicelimitframecontent.cc", - "drumgizmo/plugingui/widget.cc", - "drumgizmo/plugingui/window.cc", - "drumgizmo/plugingui/lodepng/lodepng.cpp", - }, - .depends = { - "src.a", + "build.cc", + "configure.cc", + "execute.cc", + "libcppbuild.cc", + "rebuild.cc", + "task.cc", + "task_ar.cc", + "task_cc.cc", + "task_ld.cc", + "task_so.cc", + "tasks.cc", }, .cxxflags = { - "-DUI_X11", + "-std=c++17", "-O3", - "-g", + "-s", "-Wall", "-Werror", - "-std=c++11", - "-Idrumgizmo/getoptpp", - "-Idrumgizmo/", - "-Idrumgizmo/hugin", - "-Idrumgizmo/plugingui/", - "-Idrumgizmo/src/", - "-Idrumgizmo/zita-resampler/libs", - "-Idrumgizmo/pugixml/src", + "-I.", }, - .cflags = {}, - .ldflags = {} } }; } - -//int a = reg(__FILE__, myConfigs); -//int b = reg(__FILE__, myConfigs2); } // Convenience macro -REG(myConfigs); -REG(myConfigs2); +REG(cppbuildConfigs); diff --git a/examples/cppbuild.cc b/examples/cppbuild.cc new file mode 100644 index 0000000..d3d21be --- /dev/null +++ b/examples/cppbuild.cc @@ -0,0 +1,156 @@ +#include "libcppbuild.h" + +namespace +{ +BuildConfigurations myConfigs() +{ + return + { + { + .type = TargetType::Executable, + .target = "plugingui", + .sources = { + "drumgizmo/zita-resampler/libs/cresampler.cc", + "drumgizmo/zita-resampler/libs/resampler-table.cc", + "drumgizmo/zita-resampler/libs/resampler.cc", + "drumgizmo/zita-resampler/libs/vresampler.cc", + "drumgizmo/hugin/hugin.c", + "drumgizmo/pugixml/src/pugixml.cpp", + }, + .depends = { + "libplugingui.so", + }, + .cxxflags = { + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-Idrumgizmo/getoptpp", + "-Idrumgizmo/", + "-Idrumgizmo/hugin", + "-Idrumgizmo/plugingui/", + "-Idrumgizmo/src/", + "-Idrumgizmo/zita-resampler/libs", + "-Idrumgizmo/pugixml/src", + }, + .cflags = { + "-g", + //"-O3", + "-Wall", + "-Werror", + }, + .ldflags = { + "-lm", + "-lX11", + "-lXext", + "-lsndfile", + "-pthread", + } + }, + }; +} + +BuildConfigurations myConfigs2() +{ + return + { + { + .type = TargetType::DynamicLibrary, + .target = "libplugingui.so", + .sources = { + "drumgizmo/plugingui/abouttab.cc", + "drumgizmo/plugingui/bleedcontrolframecontent.cc", + "drumgizmo/plugingui/button.cc", + "drumgizmo/plugingui/button_base.cc", + "drumgizmo/plugingui/checkbox.cc", + "drumgizmo/plugingui/colour.cc", + "drumgizmo/plugingui/combobox.cc", + "drumgizmo/plugingui/dialog.cc", + "drumgizmo/plugingui/diskstreamingframecontent.cc", + "drumgizmo/plugingui/drumkitframecontent.cc", + "drumgizmo/plugingui/drumkittab.cc", + "drumgizmo/plugingui/eventhandler.cc", + "drumgizmo/plugingui/filebrowser.cc", + "drumgizmo/plugingui/font.cc", + "drumgizmo/plugingui/frame.cc", + "drumgizmo/plugingui/helpbutton.cc", + "drumgizmo/plugingui/humaniservisualiser.cc", + "drumgizmo/plugingui/humanizerframecontent.cc", + "drumgizmo/plugingui/image.cc", + "drumgizmo/plugingui/imagecache.cc", + "drumgizmo/plugingui/knob.cc", + "drumgizmo/plugingui/label.cc", + "drumgizmo/plugingui/layout.cc", + "drumgizmo/plugingui/led.cc", + "drumgizmo/plugingui/lineedit.cc", + "drumgizmo/plugingui/listbox.cc", + "drumgizmo/plugingui/listboxbasic.cc", + "drumgizmo/plugingui/listboxthin.cc", + "drumgizmo/plugingui/maintab.cc", + "drumgizmo/plugingui/mainwindow.cc", + "drumgizmo/plugingui/nativewindow_x11.cc", + "drumgizmo/plugingui/painter.cc", + "drumgizmo/plugingui/pixelbuffer.cc", + "drumgizmo/plugingui/pluginconfig.cc", + "drumgizmo/plugingui/powerbutton.cc", + "drumgizmo/plugingui/powerwidget.cc", + "drumgizmo/plugingui/progressbar.cc", + "drumgizmo/plugingui/resamplingframecontent.cc", + "drumgizmo/plugingui/resource.cc", + "drumgizmo/plugingui/resource_data.cc", + "drumgizmo/plugingui/sampleselectionframecontent.cc", + "drumgizmo/plugingui/scrollbar.cc", + "drumgizmo/plugingui/slider.cc", + "drumgizmo/plugingui/stackedwidget.cc", + "drumgizmo/plugingui/statusframecontent.cc", + "drumgizmo/plugingui/tabbutton.cc", + "drumgizmo/plugingui/tabwidget.cc", + "drumgizmo/plugingui/testmain.cc", + "drumgizmo/plugingui/textedit.cc", + "drumgizmo/plugingui/texture.cc", + "drumgizmo/plugingui/texturedbox.cc", + "drumgizmo/plugingui/timingframecontent.cc", + "drumgizmo/plugingui/toggle.cc", + "drumgizmo/plugingui/tooltip.cc", + "drumgizmo/plugingui/uitranslation.cc", + "drumgizmo/plugingui/utf8.cc", + "drumgizmo/plugingui/verticalline.cc", + "drumgizmo/plugingui/visualizerframecontent.cc", + "drumgizmo/plugingui/voicelimitframecontent.cc", + "drumgizmo/plugingui/widget.cc", + "drumgizmo/plugingui/window.cc", + "drumgizmo/plugingui/lodepng/lodepng.cpp", + }, + .depends = { + "src.a", + }, + .cxxflags = { + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-Idrumgizmo/getoptpp", + "-Idrumgizmo/", + "-Idrumgizmo/hugin", + "-Idrumgizmo/plugingui/", + "-Idrumgizmo/src/", + "-Idrumgizmo/zita-resampler/libs", + "-Idrumgizmo/pugixml/src", + }, + .cflags = {}, + .ldflags = {} + } + }; +} + +//int a = reg(__FILE__, myConfigs); +//int b = reg(__FILE__, myConfigs2); +} + +// Convenience macro +REG(myConfigs); +REG(myConfigs2); diff --git a/examples/subdir/cppbuild.cc b/examples/subdir/cppbuild.cc new file mode 100644 index 0000000..03b70e6 --- /dev/null +++ b/examples/subdir/cppbuild.cc @@ -0,0 +1,75 @@ +#include "../libcppbuild.h" + +namespace +{ +BuildConfigurations myConfigs() +{ + return + { + { + .target = "src.a", + .sources = { + "../drumgizmo/src/audiocache.cc", + "../drumgizmo/src/audiocacheeventhandler.cc", + "../drumgizmo/src/audiocachefile.cc", + "../drumgizmo/src/audiocacheidmanager.cc", + "../drumgizmo/src/audiofile.cc", + "../drumgizmo/src/audioinputengine.cc", + "../drumgizmo/src/audioinputenginemidi.cc", + "../drumgizmo/src/audiooutputengine.cc", + "../drumgizmo/src/bytesizeparser.cc", + "../drumgizmo/src/channel.cc", + "../drumgizmo/src/channelmixer.cc", + "../drumgizmo/src/configfile.cc", + "../drumgizmo/src/configparser.cc", + "../drumgizmo/src/dgxmlparser.cc", + "../drumgizmo/src/directory.cc", + "../drumgizmo/src/domloader.cc", + "../drumgizmo/src/drumgizmo.cc", + "../drumgizmo/src/drumgizmoconf.cc", + "../drumgizmo/src/drumkit.cc", + "../drumgizmo/src/drumkitloader.cc", + "../drumgizmo/src/events.cc", + "../drumgizmo/src/events_ds.cc", + "../drumgizmo/src/inputprocessor.cc", + "../drumgizmo/src/instrument.cc", + "../drumgizmo/src/latencyfilter.cc", + "../drumgizmo/src/midimapparser.cc", + "../drumgizmo/src/midimapper.cc", + "../drumgizmo/src/path.cc", + "../drumgizmo/src/powerlist.cc", + "../drumgizmo/src/powermap.cc", + "../drumgizmo/src/powermapfilter.cc", + "../drumgizmo/src/random.cc", + "../drumgizmo/src/sample.cc", + "../drumgizmo/src/sample_selection.cc", + "../drumgizmo/src/sem.cc", + "../drumgizmo/src/staminafilter.cc", + "../drumgizmo/src/thread.cc", + "../drumgizmo/src/translation.cc", + "../drumgizmo/src/velocityfilter.cc", + "../drumgizmo/src/versionstr.cc", + "../drumgizmo/src/zrwrapper.cc", + }, + .cxxflags = { + "-fPIC", + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-I../drumgizmo/getoptpp", + "-I../drumgizmo/", + "-I../drumgizmo/hugin", + "-I../drumgizmo/plugingui/", + "-I ../drumgizmo/src/", + "-I ../drumgizmo/zita-resampler/libs", + "-I ../drumgizmo/pugixml/src", + }, + } + }; +} + +int a = reg(__FILE__, myConfigs); +} diff --git a/subdir/cppbuild.cc b/subdir/cppbuild.cc deleted file mode 100644 index 03b70e6..0000000 --- a/subdir/cppbuild.cc +++ /dev/null @@ -1,75 +0,0 @@ -#include "../libcppbuild.h" - -namespace -{ -BuildConfigurations myConfigs() -{ - return - { - { - .target = "src.a", - .sources = { - "../drumgizmo/src/audiocache.cc", - "../drumgizmo/src/audiocacheeventhandler.cc", - "../drumgizmo/src/audiocachefile.cc", - "../drumgizmo/src/audiocacheidmanager.cc", - "../drumgizmo/src/audiofile.cc", - "../drumgizmo/src/audioinputengine.cc", - "../drumgizmo/src/audioinputenginemidi.cc", - "../drumgizmo/src/audiooutputengine.cc", - "../drumgizmo/src/bytesizeparser.cc", - "../drumgizmo/src/channel.cc", - "../drumgizmo/src/channelmixer.cc", - "../drumgizmo/src/configfile.cc", - "../drumgizmo/src/configparser.cc", - "../drumgizmo/src/dgxmlparser.cc", - "../drumgizmo/src/directory.cc", - "../drumgizmo/src/domloader.cc", - "../drumgizmo/src/drumgizmo.cc", - "../drumgizmo/src/drumgizmoconf.cc", - "../drumgizmo/src/drumkit.cc", - "../drumgizmo/src/drumkitloader.cc", - "../drumgizmo/src/events.cc", - "../drumgizmo/src/events_ds.cc", - "../drumgizmo/src/inputprocessor.cc", - "../drumgizmo/src/instrument.cc", - "../drumgizmo/src/latencyfilter.cc", - "../drumgizmo/src/midimapparser.cc", - "../drumgizmo/src/midimapper.cc", - "../drumgizmo/src/path.cc", - "../drumgizmo/src/powerlist.cc", - "../drumgizmo/src/powermap.cc", - "../drumgizmo/src/powermapfilter.cc", - "../drumgizmo/src/random.cc", - "../drumgizmo/src/sample.cc", - "../drumgizmo/src/sample_selection.cc", - "../drumgizmo/src/sem.cc", - "../drumgizmo/src/staminafilter.cc", - "../drumgizmo/src/thread.cc", - "../drumgizmo/src/translation.cc", - "../drumgizmo/src/velocityfilter.cc", - "../drumgizmo/src/versionstr.cc", - "../drumgizmo/src/zrwrapper.cc", - }, - .cxxflags = { - "-fPIC", - "-DUI_X11", - "-O3", - "-g", - "-Wall", - "-Werror", - "-std=c++11", - "-I../drumgizmo/getoptpp", - "-I../drumgizmo/", - "-I../drumgizmo/hugin", - "-I../drumgizmo/plugingui/", - "-I ../drumgizmo/src/", - "-I ../drumgizmo/zita-resampler/libs", - "-I ../drumgizmo/pugixml/src", - }, - } - }; -} - -int a = reg(__FILE__, myConfigs); -} diff --git a/toolchain.cc b/toolchain.cc deleted file mode 100644 index 0a8ea98..0000000 --- a/toolchain.cc +++ /dev/null @@ -1,17 +0,0 @@ -#include "toolchain.h" - -#include "libcppbuild.h" - -std::string getTool(Tool tool) -{ - auto prefix = getConfiguration("prefix"); - - switch(tool) - { - case Tool::CCompiler: - case Tool::CppCompiler: - case Tool::Archiver: - case Tool::Linker: - break; - } -} diff --git a/toolchain.h b/toolchain.h deleted file mode 100644 index d3de9a1..0000000 --- a/toolchain.h +++ /dev/null @@ -1,14 +0,0 @@ -// -*- c++ -*- -#pragma once - -#include - -enum class Tool -{ - CCompiler, - CppCompiler, - Archiver, - Linker, -} - -std::string getTool(Tool tool); -- cgit v1.2.3