Add more integration tests for SharedLibrary and backwards compatibility
This commit is contained in:
1 parent
aa192d7567
commit
db2ec82a25
8 files changed
+118
No files matched your search
@@ -0,0 +1,6 @@
|
||||
Rscons::Environment.new do |env|
|
||||
File.open("foo.xyz", "wb") do |fh|
|
||||
fh.puts("hi")
|
||||
end
|
||||
env.SharedObject("foo.o", "foo.xyz")
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CPPPATH"] << "src/lib"
|
||||
libmine = env.SharedLibrary("libmine", Dir["src/lib/*.cc"])
|
||||
env.Program("test-shared.exe",
|
||||
Dir["src/*.cc"],
|
||||
"LIBPATH" => %w[.],
|
||||
"LIBS" => %w[mine])
|
||||
env.build_after("test-shared.exe", libmine.to_s)
|
||||
env.Program("test-static.exe",
|
||||
Dir["src/**/*.cc"])
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
Rscons::Environment.new do |env|
|
||||
env["CPPPATH"] << "src/lib"
|
||||
env["SHLD"] = "gcc"
|
||||
libmine = env.SharedLibrary("libmine", Dir["src/lib/*.c"])
|
||||
env.Program("test-shared.exe",
|
||||
Dir["src/*.c"],
|
||||
"LIBPATH" => %w[.],
|
||||
"LIBS" => %w[mine])
|
||||
env.build_after("test-shared.exe", libmine.to_s)
|
||||
env.Program("test-static.exe",
|
||||
Dir["src/**/*.c"])
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void one(void)
|
||||
{
|
||||
printf("Hi from one()\n");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void two(void)
|
||||
{
|
||||
printf("Hi from two()\n");
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "one.h"
|
||||
#include "two.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
one();
|
||||
two();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
class MyObject < Rscons::Builder
|
||||
def produces?(target, source, env)
|
||||
target.end_with?(".o") and source.end_with?(".xyz")
|
||||
end
|
||||
|
||||
def run(target, sources, cache, env, vars)
|
||||
cflags = env.expand_varref("${CFLAGS}", vars)
|
||||
vars = vars.merge(
|
||||
"CFLAGS" => cflags + %w[-x c],
|
||||
"CSUFFIX" => ".xyz")
|
||||
env.run_builder(env.builders["Object"], target, sources, cache, vars)
|
||||
end
|
||||
end
|
||||
|
||||
Rscons::Environment.new do |env|
|
||||
env.add_builder(MyObject.new)
|
||||
File.open("test.xyz", "w") do |fh|
|
||||
fh.puts <<EOF
|
||||
#include <stdio.h>
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
printf("XYZ!\\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
env.Program("test", "test.xyz")
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user