From 8519410c913927bea200f194bb7f9c04ed0b373a Mon Sep 17 00:00:00 2001 From: Charles Baker Date: Tue, 30 Jan 2018 12:41:34 +1300 Subject: [PATCH] Build with Forge v0.0.x --- UnitTest++/UnitTest++.forge | 48 +++++++++++++++++++++++++++++++ forge.lua | 56 +++++++++++++++++++++++++++++++++++++ tests/tests.forge | 35 +++++++++++++++++++++++ unittest-cpp.forge | 3 ++ 4 files changed, 142 insertions(+) create mode 100644 UnitTest++/UnitTest++.forge create mode 100644 forge.lua create mode 100644 tests/tests.forge create mode 100644 unittest-cpp.forge diff --git a/UnitTest++/UnitTest++.forge b/UnitTest++/UnitTest++.forge new file mode 100644 index 0000000..c315d38 --- /dev/null +++ b/UnitTest++/UnitTest++.forge @@ -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 diff --git a/forge.lua b/forge.lua new file mode 100644 index 0000000..5efc482 --- /dev/null +++ b/forge.lua @@ -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' +}; diff --git a/tests/tests.forge b/tests/tests.forge new file mode 100644 index 0000000..f29eae4 --- /dev/null +++ b/tests/tests.forge @@ -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' + }; + }; +}; diff --git a/unittest-cpp.forge b/unittest-cpp.forge new file mode 100644 index 0000000..5533423 --- /dev/null +++ b/unittest-cpp.forge @@ -0,0 +1,3 @@ + +buildfile "tests/tests.forge"; +buildfile 'UnitTest++/UnitTest++.forge';