add flexilib-interface module for flexilib client builds
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 1m28s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	AWS-Zig Build / build-zig-0.11.0-amd64-host (push) Successful in 1m28s
				
			This commit is contained in:
		
							parent
							
								
									30d27e3002
								
							
						
					
					
						commit
						e5396cb0e5
					
				
					 1 changed files with 15 additions and 7 deletions
				
			
		|  | @ -6,9 +6,17 @@ const builtin = @import("builtin"); | |||
| /// For flexilib, we will need the main file to have a pub fn named | ||||
| /// "handler". If it is not called that, a pub const handler = ... can be | ||||
| /// used instead | ||||
| pub fn configureBuild(b: *std.build.Builder, exe: *std.Build.Step.Compile, build_root_src: []const u8) !void { | ||||
| pub fn configureBuild(b: *std.build.Builder, cs: *std.Build.Step.Compile, build_root_src: []const u8) !void { | ||||
|     const package_step = b.step("flexilib", "Create a flexilib dynamic library"); | ||||
| 
 | ||||
|     // We'll need to add the interface module here as well | ||||
|     const flexilib_dep = b.dependency("flexilib", .{ | ||||
|         .target = cs.target, | ||||
|         .optimize = cs.optimize, | ||||
|     }); | ||||
|     const flexilib_module = flexilib_dep.module("flexilib-interface"); | ||||
|     cs.addModule("flexilib-interface", flexilib_module); | ||||
| 
 | ||||
|     // const exe = b.addExecutable(.{ | ||||
|     //     .name = "universal-lambda-example", | ||||
|     //     // In this case the main source file is merely a path, however, in more | ||||
|  | @ -19,16 +27,16 @@ pub fn configureBuild(b: *std.build.Builder, exe: *std.Build.Step.Compile, build | |||
|     // }); | ||||
|     // | ||||
|     const lib = b.addSharedLibrary(.{ | ||||
|         .name = exe.name, | ||||
|         .name = cs.name, | ||||
|         .root_source_file = .{ .path = b.pathJoin(&[_][]const u8{ build_root_src, "flexilib.zig" }) }, | ||||
|         .target = exe.target, | ||||
|         .optimize = exe.optimize, | ||||
|         .target = cs.target, | ||||
|         .optimize = cs.optimize, | ||||
|     }); | ||||
| 
 | ||||
|     // We will not free this, as the rest of the build system will use it. | ||||
|     // This should be ok because our allocator is, I believe, an arena | ||||
|     var module_dependencies = try b.allocator.alloc(std.Build.ModuleDependency, exe.modules.count()); | ||||
|     var iterator = exe.modules.iterator(); | ||||
|     var module_dependencies = try b.allocator.alloc(std.Build.ModuleDependency, cs.modules.count()); | ||||
|     var iterator = cs.modules.iterator(); | ||||
| 
 | ||||
|     var i: usize = 0; | ||||
|     while (iterator.next()) |entry| : (i += 1) { | ||||
|  | @ -40,7 +48,7 @@ pub fn configureBuild(b: *std.build.Builder, exe: *std.Build.Step.Compile, build | |||
|     } | ||||
|     lib.addAnonymousModule("flexilib_handler", .{ | ||||
|         // Source file can be anywhere on disk, does not need to be a subdirectory | ||||
|         .source_file = exe.root_src.?, | ||||
|         .source_file = cs.root_src.?, | ||||
|         .dependencies = module_dependencies, | ||||
|     }); | ||||
|     package_step.dependOn(&b.addInstallArtifact(lib, .{}).step); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue