diff --git a/onqtam/doctest/2.3.3/doctest_llar.gox b/onqtam/doctest/2.3.3/doctest_llar.gox new file mode 100644 index 0000000..0bfa3aa --- /dev/null +++ b/onqtam/doctest/2.3.3/doctest_llar.gox @@ -0,0 +1,71 @@ +import ( + "os" + "path/filepath" +) + +const consumerSource = `#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include + +TEST_CASE("testing the factorial function") { + CHECK(1 == 1); +} +` + +id "onqtam/doctest" + +fromVer "2.3.3" + +onBuild ctx => { + installDir := ctx.outputDir + + // Use the upstream install rules so the CMake consumer receives the + // complete Config, Version, Targets, and helper-script set. + c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir) + c.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5" + c.define "CMAKE_INSTALL_LIBDIR", "lib" + c.defineBool "DOCTEST_WITH_TESTS", false + c.defineBool "DOCTEST_WITH_MAIN_IN_STATIC_LIB", false + c.configure + c.build + c.install + + licenseDir := filepath.join(installDir, "licenses") + os.mkdirAll(licenseDir, 0o755)! + os.writeFile( + filepath.join(licenseDir, "LICENSE.txt"), + os.readFile(filepath.join(ctx.SourceDir, "LICENSE.txt"))!, + 0o644, + )! + + pcDir := filepath.join(installDir, "lib", "pkgconfig") + os.mkdirAll(pcDir, 0o755)! + pc := pkgconfig.new( + name = "doctest", + description = "C++11/14/17/20 single header testing framework", + version = "2.3.3", + cflags = ["-I$${includedir}"], + )! + out := os.create(filepath.join(pcDir, "doctest.pc"))! + pc.writeTo(out)! + out.close()! + + pkgconfig.use installDir + ctx.setMetadata pkgconfig.lookup("doctest")! +} + +onTest ctx => { + installDir := ctx.outputDir + testDir := filepath.join(ctx.SourceDir, "_llar_consumer") + os.mkdirAll(testDir, 0o755)! + + consumer := filepath.join(testDir, "consumer.cpp") + os.writeFile(consumer, []byte(consumerSource), 0o644)! + + pkgconfig.use installDir + flagsFile := filepath.join(testDir, "doctest.flags") + os.writeFile(flagsFile, []byte(pkgconfig.lookup("doctest")!), 0o644)! + + binary := filepath.join(testDir, "consumer") + exec! "c++", "-std=c++11", consumer, "-o", binary, "@"+flagsFile + exec! binary +} diff --git a/onqtam/doctest/versions.json b/onqtam/doctest/versions.json new file mode 100644 index 0000000..30d6aae --- /dev/null +++ b/onqtam/doctest/versions.json @@ -0,0 +1,4 @@ +{ + "path": "onqtam/doctest", + "deps": {} +}