Logo: Relish

  1. Sign in

Project: Weyland 0.1.0

Build output layout

Weyland will always write the output of a build into a particular directory
layout. Object files go into the obj directory for the package they belong
to, library files to the lib directory, and executables to the bin
directory.

Scenarios
Weyland adds a build directory for the root package
Given
a file named "Weylandfile" with:
require 'weyland/c'

Weyland::package("layout_example") do |pkg|
	pkg.c_program("layout_example", sources: [ "src/test.c" ])
end
And
a file named "src/test.c" with:
#include <stdio.h>

int main(int argc, char** argv) {
	printf("This is a test program!\n");
}
When
I run weyland
Then
the exit status should be 0
And
a directory named "build/layout_example" should exist
And
a directory named "build/layout_example/obj" should exist
And
a directory named "build/layout_example/obj/layout_example" should exist
And
a directory named "build/layout_example/bin" should exist
Weyland adds output directories for each package
Given
a file named "Weylandfile" with:
require 'weyland/c'

Weyland::package("layout_example") do |pkg|
	pkg.c_program "layout_example", sources: [ "src/main.c" ], depends_on: [ "adder:adder" ]
end 
And
a file named "Dependencies" with:
[ Weyland::package("adder"){|pkg| pkg.repository = "deps/adder"} ]
And
a file named "src/main.c" with:
#include <stdio.h>
#include "adder/add.h"

int main(int argc, char** argv) {
	printf("%d\n", add(1, 2));
}
And
a file named "deps/adder/Weylandfile" with:
require 'weyland/c'

Weyland::package("adder") do |pkg|
	pkg.c_staticlib "adder", sources: [ "src/add.c" ], include_dirs: [ "include" ], exports: [ :include_dirs ]
end 
And
a file named "deps/adder/include/adder/add.h" with:
int add(int a, int b);
And
a file named "deps/adder/src/add.c" with:
#include "adder/add.h"

int add(int a, int b) {
	return a + b;
}
When
I run weyland
Then
the exit status should be 0
And
a directory named "build/layout_example/obj/layout_example" should exist
And
a directory named "build/adder/obj/adder" should exist
And
a directory named "build/adder/lib" should exist
And
a directory named "build/layout_example/bin" should exist

Last published over 5 years ago by smkell.