Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite committed Sep 21, 2024
0 parents commit 71e3678
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zig-out
.zig-cache
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) Matthew Knight

This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use
of this software.

Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.
41 changes: 41 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const googletest_dep = b.dependency("googletest", .{});

const gtest = b.addStaticLibrary(.{
.name = "gtest",
.target = target,
.optimize = optimize,
.link_libc = true,
});
gtest.linkLibCpp();
gtest.addCSourceFile(.{
.file = googletest_dep.path("googletest/src/gtest-all.cc"),
.flags = &.{},
});
gtest.addIncludePath(googletest_dep.path("googletest/include"));
gtest.addIncludePath(googletest_dep.path("googletest"));
gtest.installHeadersDirectory(googletest_dep.path("googletest/include"), ".", .{});

b.installArtifact(gtest);

const gtest_main = b.addStaticLibrary(.{
.name = "gtest_main",
.target = target,
.optimize = optimize,
.link_libc = true,
});
gtest_main.linkLibCpp();
gtest_main.addCSourceFile(.{
.file = googletest_dep.path("googletest/src/gtest_main.cc"),
.flags = &.{},
});
gtest_main.addIncludePath(googletest_dep.path("googletest/include"));
gtest_main.addIncludePath(googletest_dep.path("googletest"));
gtest_main.installHeadersDirectory(googletest_dep.path("googletest/include"), ".", .{});
b.installArtifact(gtest_main);
}
15 changes: 15 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.{
.name = "googletest",
.version = "1.15.2",
.dependencies = .{
.googletest = .{
.url = "https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz",
.hash = "122001093b5794ecf5a5b53887622c75d633af2b0c3402a266ce45c6aa4d179c53ba",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"LICENSE",
},
}

0 comments on commit 71e3678

Please sign in to comment.