summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cppbuild.cc293
-rw-r--r--libcppbuild.cc128
-rw-r--r--libcppbuild.h3
3 files changed, 215 insertions, 209 deletions
diff --git a/cppbuild.cc b/cppbuild.cc
index eb8b78e..370e179 100644
--- a/cppbuild.cc
+++ b/cppbuild.cc
@@ -1,4 +1,4 @@
-#if 0
+#if 0/*
if [ "cppbuild" -ot "$0" ]
then
echo "Rebuilding cppbuild"
@@ -9,6 +9,7 @@ fi
echo "Launching cppbuild"
./cppbuild $*
exit $?
+*/
#endif
#include <vector>
@@ -17,156 +18,158 @@ exit $?
#include "libcppbuild.h"
-BuildConfiguration configs()
+std::vector<BuildConfiguration> configs()
{
return
{
- // target
- "plugingui",
-
- // source files
{
- "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",
- "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/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",
- "drumgizmo/plugingui/lodepng/lodepng.cpp",
- },
+ // target
+ "plugingui",
- // cxx flags
- {
- "-DUI_X11",
- "-g",
- "-Wall",
- "-Werror",
- "-std=c++11",
- "-Idrumgizmo/getoptpp",
- "-Idrumgizmo/",
- "-Idrumgizmo/hugin",
- "-Idrumgizmo/plugingui/",
- "-Idrumgizmo/src/",
- "-Idrumgizmo/zita-resampler/libs",
- "-Idrumgizmo/pugixml/src",
- },
+ // source files
+ {
+ "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",
+ "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/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",
+ "drumgizmo/plugingui/lodepng/lodepng.cpp",
+ },
- // c flags
- {
- "-g",
- "-Wall",
- "-Werror",
- },
+ // cxx flags
+ {
+ "-DUI_X11",
+ "-g",
+ "-Wall",
+ "-Werror",
+ "-std=c++11",
+ "-Idrumgizmo/getoptpp",
+ "-Idrumgizmo/",
+ "-Idrumgizmo/hugin",
+ "-Idrumgizmo/plugingui/",
+ "-Idrumgizmo/src/",
+ "-Idrumgizmo/zita-resampler/libs",
+ "-Idrumgizmo/pugixml/src",
+ },
- // linker flags
- {
- "-lm",
- "-lX11",
- "-lXext",
- "-pthread",
- "-lsndfile",
- }
+ // c flags
+ {
+ "-g",
+ "-Wall",
+ "-Werror",
+ },
+
+ // linker flags
+ {
+ "-lm",
+ "-lX11",
+ "-lXext",
+ "-pthread",
+ "-lsndfile",
+ }
+ },
};
}
diff --git a/libcppbuild.cc b/libcppbuild.cc
index c75f43e..bf1a7fa 100644
--- a/libcppbuild.cc
+++ b/libcppbuild.cc
@@ -30,62 +30,81 @@ int main(int argc, const char* argv[])
std::filesystem::path builddir(settings.builddir);
std::filesystem::create_directories(builddir);
- auto config = configs();
-
- std::vector<std::string> objects;
- std::vector<std::unique_ptr<Task>> tasks;
- for(const auto& file : config.sources)
+ auto build_configs = configs();
+ for(const auto& build_config : build_configs)
{
- tasks.emplace_back(std::make_unique<TaskCC>(config, settings, file));
- objects.push_back(tasks.back()->target());
- }
+ std::vector<std::string> objects;
+ std::vector<std::unique_ptr<Task>> tasks;
+ for(const auto& file : build_config.sources)
+ {
+ tasks.emplace_back(std::make_unique<TaskCC>(build_config, settings, file));
+ objects.push_back(tasks.back()->target());
+ }
- TaskLD task_ld(config, settings, config.target, objects);
+ TaskLD task_ld(build_config, settings, build_config.target, objects);
- if(argc == 2 && std::string(argv[1]) == "clean")
- {
- std::cout << "Cleaning\n";
- //std::filesystem::remove_all(builddir);
- for(auto& task : tasks)
+ if(argc == 2 && std::string(argv[1]) == "clean")
{
- if(task->clean() != 0)
+ std::cout << "Cleaning\n";
+ //std::filesystem::remove_all(builddir);
+ for(auto& task : tasks)
+ {
+ if(task->clean() != 0)
+ {
+ return 1;
+ }
+ }
+
+ if(task_ld.clean() != 0)
{
return 1;
}
- }
- if(task_ld.clean() != 0)
- {
- return 1;
+ return 0;
}
- return 0;
- }
-
- std::cout << "Building\n";
+ std::cout << "Building\n";
- std::list<std::future<int>> processes;
+ std::list<std::future<int>> processes;
- // Start all tasks
- auto task = tasks.begin();
- while(task != tasks.end())
- {
- while(processes.size() < settings.parallel_processes &&
- task != tasks.end())
+ // Start all tasks
+ auto task = tasks.begin();
+ while(task != tasks.end())
{
- if(!(*task)->dirty())
+ while(processes.size() < settings.parallel_processes &&
+ task != tasks.end())
{
+ if(!(*task)->dirty())
+ {
+ ++task;
+ continue;
+ }
+
+ processes.emplace_back(
+ std::async(std::launch::async,
+ [&t = *task]()
+ {
+ return t->run();
+ }));
++task;
- continue;
+ std::this_thread::sleep_for(2ms);
+ }
+
+ for(auto process = processes.begin();
+ process != processes.end();
+ ++process)
+ {
+ if(process->valid())
+ {
+ if(process->get() != 0)
+ {
+ return 1;
+ }
+ processes.erase(process);
+ break;
+ }
}
- processes.emplace_back(
- std::async(std::launch::async,
- [&t = *task]()
- {
- return t->run();
- }));
- ++task;
std::this_thread::sleep_for(2ms);
}
@@ -93,37 +112,20 @@ int main(int argc, const char* argv[])
process != processes.end();
++process)
{
- if(process->valid())
+ process->wait();
+ auto ret = process->get();
+ if(ret != 0)
{
- if(process->get() != 0)
- {
- return 1;
- }
- processes.erase(process);
- break;
+ return 1;
}
}
- std::this_thread::sleep_for(2ms);
- }
-
- for(auto process = processes.begin();
- process != processes.end();
- ++process)
- {
- process->wait();
- auto ret = process->get();
- if(ret != 0)
+ std::cout << "Linking\n";
+ if(task_ld.dirty())
{
- return 1;
+ return task_ld.run();
}
}
- std::cout << "Linking\n";
- if(task_ld.dirty())
- {
- return task_ld.run();
- }
-
return 0;
}
diff --git a/libcppbuild.h b/libcppbuild.h
index a7b82d7..6cc04ac 100644
--- a/libcppbuild.h
+++ b/libcppbuild.h
@@ -1,3 +1,4 @@
+// -*- c++ -*-
#pragma once
#include <string>
@@ -12,4 +13,4 @@ struct BuildConfiguration
std::vector<std::string> ldflags;
};
-BuildConfiguration configs();
+std::vector<BuildConfiguration> configs();