1
1
const std = @import ("std" );
2
- const FileSource = std .Build .FileSource ;
2
+ const Path = std .Build .LazyPath ;
3
3
4
4
pub fn build (b : * std.Build ) void {
5
5
const target = b .standardTargetOptions (.{});
6
6
const optimize = b .standardOptimizeOption (.{});
7
+
7
8
const tests = b .option (bool , "Tests" , "Build tests [default: false]" ) orelse false ;
8
9
9
10
const config = b .addConfigHeader (.{
@@ -22,16 +23,21 @@ pub fn build(b: *std.Build) void {
22
23
.optimize = optimize ,
23
24
});
24
25
lib .addConfigHeader (config );
25
- lib .addIncludePath ("." );
26
+ lib .addIncludePath (Path . relative ( "." ) );
26
27
lib .addCSourceFiles (&.{
27
28
"sigc++/connection.cc" ,
28
29
"sigc++/functors/slot_base.cc" ,
29
30
"sigc++/signal_base.cc" ,
30
31
"sigc++/trackable.cc" ,
31
32
}, cxxFlags );
33
+ lib .pie = true ;
34
+ switch (optimize ) {
35
+ .Debug , .ReleaseSafe = > lib .bundle_compiler_rt = true ,
36
+ else = > lib .strip = true ,
37
+ }
32
38
lib .linkLibCpp ();
33
39
lib .installHeadersDirectoryOptions (.{
34
- .source_dir = FileSource .relative ("sigc++" ),
40
+ .source_dir = Path .relative ("sigc++" ),
35
41
.install_dir = .header ,
36
42
.install_subdir = "sigc++" ,
37
43
.exclude_extensions = &.{
@@ -110,8 +116,8 @@ fn buildTest(b: *std.Build, info: BuildInfo) void {
110
116
for (info .lib .include_dirs .items ) | include | {
111
117
test_exe .include_dirs .append (include ) catch {};
112
118
}
113
- test_exe .addCSourceFile (info .path , cxxFlags );
114
- test_exe .addCSourceFile ("tests/testutilities.cc" , cxxFlags );
119
+ test_exe .addCSourceFile (.{ . file = Path . relative ( info .path ), . flags = cxxFlags } );
120
+ test_exe .addCSourceFile (.{ . file = Path . relative ( "tests/testutilities.cc" ), . flags = cxxFlags } );
115
121
test_exe .linkLibrary (info .lib );
116
122
test_exe .linkLibCpp ();
117
123
b .installArtifact (test_exe );
0 commit comments