build: add PIE (Position Independent Executable) option (#1013)
* build: add PIE (Position Independent Executable) option
This commit is contained in:
		
							parent
							
								
									8bd5358748
								
							
						
					
					
						commit
						b635317e2a
					
				@ -26,6 +26,7 @@ pub fn build(b: *std.build.Builder) !void {
 | 
				
			|||||||
    const exe_options = b.addOptions();
 | 
					    const exe_options = b.addOptions();
 | 
				
			||||||
    exe.addOptions("build_options", exe_options);
 | 
					    exe.addOptions("build_options", exe_options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const pie = b.option(bool, "pie", "Build a Position Independent Executable");
 | 
				
			||||||
    const enable_tracy = b.option(bool, "enable_tracy", "Whether tracy should be enabled.") orelse false;
 | 
					    const enable_tracy = b.option(bool, "enable_tracy", "Whether tracy should be enabled.") orelse false;
 | 
				
			||||||
    const coverage = b.option(bool, "generate_coverage", "Generate coverage data with kcov") orelse false;
 | 
					    const coverage = b.option(bool, "generate_coverage", "Generate coverage data with kcov") orelse false;
 | 
				
			||||||
    const coverage_output_dir = b.option([]const u8, "coverage_output_dir", "Output directory for coverage data") orelse b.pathJoin(&.{ b.install_prefix, "kcov" });
 | 
					    const coverage_output_dir = b.option([]const u8, "coverage_output_dir", "Output directory for coverage data") orelse b.pathJoin(&.{ b.install_prefix, "kcov" });
 | 
				
			||||||
@ -154,6 +155,7 @@ pub fn build(b: *std.build.Builder) !void {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    exe.pie = pie;
 | 
				
			||||||
    exe.install();
 | 
					    exe.install();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const gen_exe = b.addExecutable(.{
 | 
					    const gen_exe = b.addExecutable(.{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user