|
| 1 | +const std = @import("std"); |
| 2 | + |
| 3 | +pub fn build(b: *std.Build) void { |
| 4 | + const cpputest_dep = b.dependency("cpputest", .{}); |
| 5 | + const target = b.standardTargetOptions(.{}); |
| 6 | + const optimize = b.standardOptimizeOption(.{}); |
| 7 | + |
| 8 | + const cpputest = b.addStaticLibrary(.{ |
| 9 | + .name = "CppUTest", |
| 10 | + .target = target, |
| 11 | + .optimize = optimize, |
| 12 | + .link_libc = true, |
| 13 | + }); |
| 14 | + |
| 15 | + cpputest.addCSourceFiles(.{ |
| 16 | + .root = cpputest_dep.path("src/CppUTest"), |
| 17 | + .files = &CPPUTEST_SRC, |
| 18 | + .flags = &FLAGS, |
| 19 | + }); |
| 20 | + cpputest.installHeadersDirectory(cpputest_dep.path("include/CppUTest"), "CppUTest", .{}); |
| 21 | + cpputest.addIncludePath(cpputest_dep.path("include")); |
| 22 | + cpputest.linkLibCpp(); |
| 23 | + |
| 24 | + const cpputest_ext = b.addStaticLibrary(.{ |
| 25 | + .name = "CppUTestExt", |
| 26 | + .target = target, |
| 27 | + .optimize = optimize, |
| 28 | + .link_libc = true, |
| 29 | + }); |
| 30 | + |
| 31 | + cpputest_ext.addCSourceFiles(.{ |
| 32 | + .root = cpputest_dep.path("src/CppUTestExt"), |
| 33 | + .files = &CPPUTEST_EXT_SRC, |
| 34 | + .flags = &FLAGS, |
| 35 | + }); |
| 36 | + cpputest_ext.installHeadersDirectory(cpputest_dep.path("include/CppUTestExt"), "CppUTestExt", .{}); |
| 37 | + cpputest_ext.addIncludePath(cpputest_dep.path("include")); |
| 38 | + cpputest_ext.linkLibCpp(); |
| 39 | + |
| 40 | + b.installArtifact(cpputest); |
| 41 | + b.installArtifact(cpputest_ext); |
| 42 | +} |
| 43 | + |
| 44 | +const CPPUTEST_SRC = [_][]const u8{ |
| 45 | + "CommandLineArguments.cpp", |
| 46 | + "CommandLineTestRunner.cpp", |
| 47 | + "JUnitTestOutput.cpp", |
| 48 | + "MemoryLeakDetector.cpp", |
| 49 | + "MemoryLeakWarningPlugin.cpp", |
| 50 | + "SimpleMutex.cpp", |
| 51 | + "SimpleString.cpp", |
| 52 | + "SimpleStringInternalCache.cpp", |
| 53 | + "TeamCityTestOutput.cpp", |
| 54 | + "TestFailure.cpp", |
| 55 | + "TestFilter.cpp", |
| 56 | + "TestHarness_c.cpp", |
| 57 | + "TestMemoryAllocator.cpp", |
| 58 | + "TestOutput.cpp", |
| 59 | + "TestPlugin.cpp", |
| 60 | + "TestRegistry.cpp", |
| 61 | + "TestResult.cpp", |
| 62 | + "TestTestingFixture.cpp", |
| 63 | + "Utest.cpp", |
| 64 | +}; |
| 65 | + |
| 66 | +const CPPUTEST_EXT_SRC = [_][]const u8{ |
| 67 | + "CodeMemoryReportFormatter.cpp", |
| 68 | + "GTest.cpp", |
| 69 | + "IEEE754ExceptionsPlugin.cpp", |
| 70 | + "MemoryReportAllocator.cpp", |
| 71 | + "MemoryReporterPlugin.cpp", |
| 72 | + "MemoryReportFormatter.cpp", |
| 73 | + "MockActualCall.cpp", |
| 74 | + "MockExpectedCall.cpp", |
| 75 | + "MockExpectedCallsList.cpp", |
| 76 | + "MockFailure.cpp", |
| 77 | + "MockNamedValue.cpp", |
| 78 | + "MockSupport_c.cpp", |
| 79 | + "MockSupport.cpp", |
| 80 | + "MockSupportPlugin.cpp", |
| 81 | + "OrderedTest.cpp", |
| 82 | +}; |
| 83 | + |
| 84 | +const FLAGS = [_][]const u8{ |
| 85 | + "-std=c++20", |
| 86 | +}; |
0 commit comments