Build with Forge v0.0.x

This commit is contained in:
Charles Baker 2018-01-30 12:41:34 +13:00 • committed by Charles Baker
parent 10e50ad70c
commit 8519410c91
4 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1,48 @@
for _, forge in forge:builds('cc.*') do
local forge = forge:inherit {
warning_level = 0;
};
local library = forge:StaticLibrary '${lib}/UnitTest++_${architecture}' {
forge:Cxx '${obj}/%1' {
'RequiredCheckException.cpp',
'RequiredCheckTestReporter.cpp',
'CompositeTestReporter.cpp',
'Checks.cpp',
'TestReporter.cpp',
'Test.cpp',
'TestRunner.cpp',
'ThrowingTestReporter.cpp',
'XmlTestReporter.cpp',
'TestList.cpp',
'DeferredTestReporter.cpp',
'DeferredTestResult.cpp',
'CurrentTest.cpp',
'TestDetails.cpp',
'ReportAssert.cpp',
'TimeConstraint.cpp',
'TestResults.cpp',
'MemoryOutStream.cpp',
'AssertException.cpp',
'TestReporterStdout.cpp'
};
};
if forge:platform_matches('windows') then
library {
forge:Cxx '${obj}/%1' {
'Win32/TimeHelpers.cpp'
};
};
end
if forge:platform_matches('macos') or forge:platform_matches('linux') then
library {
forge:Cxx '${obj}/%1' {
'Posix/SignalTranslator.cpp',
'Posix/TimeHelpers.cpp'
};
};
end
end

56
forge.lua Normal file
View file

@ -0,0 +1,56 @@
variant = variant or 'debug';
local forge = require 'forge.cc' {
identifier = 'cc_${platform}_${architecture}';
platform = forge:operating_system();
bin = forge:root( ('%s/bin'):format(variant) );
lib = forge:root( ('%s/lib'):format(variant) );
obj = forge:root( ('%s/obj'):format(variant) );
include_directories = {
forge:root();
};
library_directories = {
forge:root( ('%s/lib'):format(variant) );
};
visual_studio = {
sln = forge:root( 'unittest-cpp.sln' );
};
xcode = {
xcodeproj = forge:root( 'unittest-cpp.xcodeproj' );
};
architecture = 'x86_64';
assertions = variant ~= 'shipping';
debug = variant ~= 'shipping';
debuggable = variant ~= 'shipping';
exceptions = true;
fast_floating_point = variant ~= 'debug';
incremental_linking = variant == 'debug';
link_time_code_generation = variant == 'shipping';
minimal_rebuild = variant == 'debug';
optimization = variant ~= 'debug';
run_time_checks = variant == 'debug';
runtime_library = variant == 'debug' and 'static_debug' or 'static_release';
run_time_type_info = true;
stack_size = 1048576;
standard = 'c++11';
string_pooling = variant == 'shipping';
strip = false;
warning_level = 3;
warnings_as_errors = true;
};
-- Bump the C++ standard to c++14 when building on Windows as that is the
-- closest standard supported by Microsoft Visual C++.
local settings = forge.settings;
if settings.platform == 'windows' then
settings.standard = 'c++14';
end
buildfile 'unittest-cpp.forge';
forge:all {
'tests/all',
'UnitTest++/all'
};

35
tests/tests.forge Normal file
View file

@ -0,0 +1,35 @@
local forge = forge:build('cc.*'):inherit {
warning_level = 0;
}
forge:all {
forge:Executable '${bin}/TestUnitTest++' {
'${lib}/UnitTest++_${architecture}';
forge:Cxx '${obj}/%1' {
'Main.cpp',
'TestAssertHandler.cpp',
'TestCheckMacros.cpp',
'TestChecks.cpp',
'TestCompositeTestReporter.cpp',
'TestCurrentTest.cpp',
'TestDeferredTestReporter.cpp',
'TestExceptions.cpp',
'TestLongMacros.cpp',
'TestMemoryOutStream.cpp',
'TestRequireMacrosWithExceptionsOff.cpp',
'TestRequireMacrosWithExceptionsOn.cpp',
'TestTest.cpp',
'TestTestList.cpp',
'TestTestMacros.cpp',
'TestTestResults.cpp',
'TestTestRunner.cpp',
'TestTestSuite.cpp',
'TestTimeConstraint.cpp',
'TestTimeConstraintMacro.cpp',
'TestUnitTestPP.cpp',
'TestXmlTestReporter.cpp'
};
};
};

3
unittest-cpp.forge Normal file
View file

@ -0,0 +1,3 @@
buildfile "tests/tests.forge";
buildfile 'UnitTest++/UnitTest++.forge';