Build with Forge v0.9.0

This commit is contained in:
Charles Baker 2022-08-12 16:01:36 +12:00
parent 7b4bf35ea9
commit d492fc597d
5 changed files with 31 additions and 29 deletions

View file

@ -8,8 +8,9 @@ package.path = table.concat( paths, ';' );
variant = variant or 'debug';
local cc = require 'forge.cc' {
identifier = 'cc_${platform}';
local forge = require( 'forge' ):load( variant );
local cc = forge.Toolset 'cc_${platform}' {
platform = operating_system();
bin = root( ('%s/bin'):format(variant) );
lib = root( ('%s/lib'):format(variant) );
@ -47,11 +48,12 @@ local cc = require 'forge.cc' {
warnings_as_errors = true;
};
cc:install( 'forge.cc' );
-- Bump the C++ standard to c++14 when building on Windows as that is the
-- lowest standard supported by Microsoft Visual C++.
local settings = cc.settings;
if settings.platform == 'windows' then
settings.standard = 'c++14';
if cc.platform == 'windows' then
cc.standard = 'c++14';
end
local lalr = require 'forge.lalr';

View file

@ -3,13 +3,13 @@ buildfile 'lalrc/lalrc.forge';
buildfile 'lalr_examples/lalr_examples.forge';
buildfile 'lalr_test/lalr_test.forge';
for _, toolset in toolsets('cc.*') do
toolset:StaticLibrary '${lib}/lalr_${platform}_${architecture}' {
toolset:Cxx '${obj}/%1' {
for _, cc in toolsets('^cc.*') do
cc:StaticLibrary '${lib}/lalr_${platform}_${architecture}' {
cc:Cxx '${obj}/%1' {
'ErrorPolicy.cpp',
};
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
'Grammar.cpp',
'GrammarAction.cpp',
'GrammarCompiler.cpp',
@ -24,7 +24,7 @@ for _, toolset in toolsets('cc.*') do
'GrammarTransition.cpp'
};
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
'RegexAction.cpp',
'RegexCharacter.cpp',
'RegexCompiler.cpp',

View file

@ -1,12 +1,12 @@
for _, toolset in toolsets('cc.*') do
local toolset = toolset:inherit {
for _, cc in toolsets('^cc.*') do
local cc = cc:inherit {
warning_level = 0;
};
local lalr_examples = toolset:Executable '${bin}/lalr_examples' {
local lalr_examples = cc:Executable '${bin}/lalr_examples' {
'${lib}/lalr_${platform}_${architecture}';
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
"lalr_examples.cpp",
"lalr_error_handling_calculator_example.cpp",
"lalr_hello_world_example.cpp",
@ -19,23 +19,23 @@ for _, toolset in toolsets('cc.*') do
-- If the Lalrc target prototype has been defined then use it to rebuild
-- the example parse tables from grammars. Otherwise just use the source
-- files directly.
if toolset.Lalrc then
if cc.Lalrc then
lalr_examples {
toolset:Cxx '${obj}/%1' {
toolset:Lalrc '${obj}/%1.cpp' {
cc:Cxx '${obj}/%1' {
cc:Lalrc '${obj}/%1.cpp' {
'error_handling_calculator.g';
};
toolset:Lalrc '${obj}/%1.cpp' {
cc:Lalrc '${obj}/%1.cpp' {
'json.g';
};
toolset:Lalrc '${obj}/%1.cpp' {
cc:Lalrc '${obj}/%1.cpp' {
'xml.g';
};
};
};
else
lalr_examples {
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
'calculator.cpp',
'json.cpp',
'xml.cpp',
@ -43,7 +43,7 @@ for _, toolset in toolsets('cc.*') do
};
end
toolset:all {
cc:all {
lalr_examples;
};
end

View file

@ -1,11 +1,11 @@
for _, toolset in toolsets('cc.*') do
toolset:all {
toolset:Executable '${bin}/lalr_test' {
for _, cc in toolsets('^cc.*') do
cc:all {
cc:Executable '${bin}/lalr_test' {
'${lib}/lalr_${platform}_${architecture}';
'${lib}/UnitTest++_${platform}_${architecture}';
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
'main.cpp',
'TestParsers.cpp',
'TestPrecedenceDirectives.cpp',

View file

@ -1,9 +1,9 @@
for _, toolset in toolsets('cc.*') do
toolset:all {
toolset:Executable '${bin}/lalrc' {
for _, cc in toolsets('^cc.*') do
cc:all {
cc:Executable '${bin}/lalrc' {
'${lib}/lalr_${platform}_${architecture}';
toolset:Cxx '${obj}/%1' {
cc:Cxx '${obj}/%1' {
'lalrc.cpp'
};
};