diff --git a/test/alternatives.py b/test/alternatives.py index 3a4bc3712..e1cf3f919 100644 --- a/test/alternatives.py +++ b/test/alternatives.py @@ -28,7 +28,7 @@ exe a : a_empty.cpp : release ; exe a : a.cpp : debug ; """) -t.run_build_system(pass_toolset=0) +t.run_build_system() t.expect_addition("bin/$toolset/debug/a.exe") diff --git a/test/default_build.py b/test/default_build.py index a968ed075..b24772261 100644 --- a/test/default_build.py +++ b/test/default_build.py @@ -48,8 +48,11 @@ t.write("a/Jamfile", """ exe a : a.cpp ../b/b ; """) t.write("a/a.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); -int main() { foo(); } +int main() { foo(); return 0; } """) t.write("b/Jamfile", """ @@ -57,6 +60,9 @@ t.write("b/Jamfile", """ """) t.write("b/b.cpp", """ #ifdef FOO +#ifdef _WIN32 +__declspec(dllexport) +#endif void foo() {} #endif """) diff --git a/test/default_features.py b/test/default_features.py index 44f2143d7..ac18043d2 100644 --- a/test/default_features.py +++ b/test/default_features.py @@ -25,6 +25,9 @@ t.write("Jamfile", """ exe hello : hello.cpp d/l ; """) t.write("hello.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); int main() { @@ -38,6 +41,9 @@ t.write("d/Jamfile", """ lib l : l.cpp : on:FOO ; """) t.write("l.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif #ifdef FOO void foo() {} #endif diff --git a/test/make_rule.py b/test/make_rule.py index 58e9fab2b..02b690b87 100644 --- a/test/make_rule.py +++ b/test/make_rule.py @@ -5,7 +5,7 @@ from BoostBuild import Tester from string import find -t = Tester(pass_toolset=0) +t = Tester(pass_toolset=1) t.write("project-root.jam", "") t.write("Jamfile", """ @@ -39,24 +39,11 @@ exe a : dir/hello1.cpp ; exe b : dir/hello1.cpp/true ; """) -t.write("project-root.jam", """ -import gcc ; - -rule copy-file ( targets * : sources * : * ) -{ - copy-file-action $(targets) : $(sources) ; -} - -actions copy-file-action -{ - cp $(>) $(<) -} - -IMPORT $(__name__) : copy-file : : copy-file ; -""") +t.write("project-root.jam", "") t.write("dir/Jamfile", """ -make hello1.cpp : hello.cpp : copy-file ; +import common ; +make hello1.cpp : hello.cpp : common.copy ; """) @@ -67,6 +54,6 @@ int main() } """) t.run_build_system("-d2") -t.fail_test(t.stdout().count("copy-file") != 1) +t.fail_test(t.stdout().count("common.copy") != 1) t.cleanup() diff --git a/test/prebuilt.py b/test/prebuilt.py index df1796daa..ffc817433 100644 --- a/test/prebuilt.py +++ b/test/prebuilt.py @@ -13,6 +13,7 @@ t.run_build_system("debug release", subdir="ext") # Then pretend that we don't have the sources for the external project, # and can only use compiled binaries t.copy("ext/Jamfile2", "ext/Jamfile") +t.expand_toolset("ext/Jamfile") # Now check that we can build the main project, and that # correct prebuilt file is picked, depending of variant. diff --git a/test/prebuilt/ext/Jamfile2 b/test/prebuilt/ext/Jamfile2 index 2e85ad2a3..b26f9de54 100644 --- a/test/prebuilt/ext/Jamfile2 +++ b/test/prebuilt/ext/Jamfile2 @@ -4,19 +4,19 @@ import modules ; local dll-suffix = so ; if [ modules.peek : OS ] in NT CYGWIN { - dll-suffix = dll ; + dll-suffix = lib ; } project ext ; lib a : - : bin/gcc/debug/a.$(dll-suffix) debug + : bin/$toolset/debug/a.$(dll-suffix) debug : : debug ; lib a : - : bin/gcc/release/a.$(dll-suffix) release + : bin/$toolset/release/a.$(dll-suffix) release : : release ; diff --git a/test/prebuilt/ext/a.cpp b/test/prebuilt/ext/a.cpp index e96b8c679..b10a8968c 100644 --- a/test/prebuilt/ext/a.cpp +++ b/test/prebuilt/ext/a.cpp @@ -8,6 +8,9 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllexport) +#endif #ifdef RELEASE void release() {} #else diff --git a/test/prebuilt/ext/debug/a.h b/test/prebuilt/ext/debug/a.h index c421ffc1c..115f94ab8 100644 --- a/test/prebuilt/ext/debug/a.h +++ b/test/prebuilt/ext/debug/a.h @@ -8,4 +8,7 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllimport) +#endif void debug(); diff --git a/test/prebuilt/ext/release/a.h b/test/prebuilt/ext/release/a.h index 55103274d..c23a9890e 100644 --- a/test/prebuilt/ext/release/a.h +++ b/test/prebuilt/ext/release/a.h @@ -8,4 +8,7 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllimport) +#endif void release(); diff --git a/test/prebuilt/hello.cpp b/test/prebuilt/hello.cpp index e2f2bfb6d..880940682 100644 --- a/test/prebuilt/hello.cpp +++ b/test/prebuilt/hello.cpp @@ -17,4 +17,5 @@ int main() #else debug(); #endif + return 0; } diff --git a/test/project_dependencies.py b/test/project_dependencies.py index 88cd413e3..383a3cfc1 100644 --- a/test/project_dependencies.py +++ b/test/project_dependencies.py @@ -12,7 +12,12 @@ t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", "build-project src ;") t.write("lib/Jamfile", "lib lib1 : lib1.cpp ;") -t.write("lib/lib1.cpp", "void foo() {}\n") +t.write("lib/lib1.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {}\n +""") t.write("src/Jamfile", """ project : requirements ../lib/lib1 @@ -22,6 +27,9 @@ exe a : a.cpp ; exe b : b.cpp ; """) t.write("src/a.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); int main() { foo(); return 0; } """) diff --git a/test/searched_lib.py b/test/searched_lib.py index 54d845d24..a7c8e6be9 100644 --- a/test/searched_lib.py +++ b/test/searched_lib.py @@ -5,17 +5,30 @@ from BoostBuild import Tester import string +import os t = Tester() # To start with, we have to prepate a library to link with -t.write("lib/project-root.jam", "import gcc ; ") +t.write("lib/project-root.jam", "") t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;") -t.write("lib/test_lib.cpp", "void foo() {}\n"); +t.write("lib/test_lib.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {} +"""); t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/test_lib.dll") -t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") +# Auto adjusting of suffixes does not work, since we need to +# change dll to lib. +# +if os.name == 'nt': + t.copy("lib/bin/$toolset/debug/test_lib.lib", "lib/test_lib.lib") +else: + t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") + # A regression test: property referring to @@ -39,6 +52,9 @@ lib test_lib : : test_lib ../../lib ; lib a : a.cpp : : : test_lib ; """) t.write('d/d2/a.cpp', """ +#ifdef _WIN32 +__declspec(dllexport) int force_library_creation_for_a; +#endif """) t.run_build_system() diff --git a/test/test_all.py b/test/test_all.py index 3f8c09ef0..7f249f37d 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -85,11 +85,11 @@ tests = [ "project_test1", "alternatives", "unused", "default_features", - "railsys", "print", ] if os.name == 'posix': tests.append("symlink") + tests.append("railsys") # Actually, needs QT run_tests(critical_tests, tests) diff --git a/v2/test/alternatives.py b/v2/test/alternatives.py index 3a4bc3712..e1cf3f919 100644 --- a/v2/test/alternatives.py +++ b/v2/test/alternatives.py @@ -28,7 +28,7 @@ exe a : a_empty.cpp : release ; exe a : a.cpp : debug ; """) -t.run_build_system(pass_toolset=0) +t.run_build_system() t.expect_addition("bin/$toolset/debug/a.exe") diff --git a/v2/test/default_build.py b/v2/test/default_build.py index a968ed075..b24772261 100644 --- a/v2/test/default_build.py +++ b/v2/test/default_build.py @@ -48,8 +48,11 @@ t.write("a/Jamfile", """ exe a : a.cpp ../b/b ; """) t.write("a/a.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); -int main() { foo(); } +int main() { foo(); return 0; } """) t.write("b/Jamfile", """ @@ -57,6 +60,9 @@ t.write("b/Jamfile", """ """) t.write("b/b.cpp", """ #ifdef FOO +#ifdef _WIN32 +__declspec(dllexport) +#endif void foo() {} #endif """) diff --git a/v2/test/default_features.py b/v2/test/default_features.py index 44f2143d7..ac18043d2 100644 --- a/v2/test/default_features.py +++ b/v2/test/default_features.py @@ -25,6 +25,9 @@ t.write("Jamfile", """ exe hello : hello.cpp d/l ; """) t.write("hello.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); int main() { @@ -38,6 +41,9 @@ t.write("d/Jamfile", """ lib l : l.cpp : on:FOO ; """) t.write("l.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif #ifdef FOO void foo() {} #endif diff --git a/v2/test/make_rule.py b/v2/test/make_rule.py index 58e9fab2b..02b690b87 100644 --- a/v2/test/make_rule.py +++ b/v2/test/make_rule.py @@ -5,7 +5,7 @@ from BoostBuild import Tester from string import find -t = Tester(pass_toolset=0) +t = Tester(pass_toolset=1) t.write("project-root.jam", "") t.write("Jamfile", """ @@ -39,24 +39,11 @@ exe a : dir/hello1.cpp ; exe b : dir/hello1.cpp/true ; """) -t.write("project-root.jam", """ -import gcc ; - -rule copy-file ( targets * : sources * : * ) -{ - copy-file-action $(targets) : $(sources) ; -} - -actions copy-file-action -{ - cp $(>) $(<) -} - -IMPORT $(__name__) : copy-file : : copy-file ; -""") +t.write("project-root.jam", "") t.write("dir/Jamfile", """ -make hello1.cpp : hello.cpp : copy-file ; +import common ; +make hello1.cpp : hello.cpp : common.copy ; """) @@ -67,6 +54,6 @@ int main() } """) t.run_build_system("-d2") -t.fail_test(t.stdout().count("copy-file") != 1) +t.fail_test(t.stdout().count("common.copy") != 1) t.cleanup() diff --git a/v2/test/prebuilt.py b/v2/test/prebuilt.py index df1796daa..ffc817433 100644 --- a/v2/test/prebuilt.py +++ b/v2/test/prebuilt.py @@ -13,6 +13,7 @@ t.run_build_system("debug release", subdir="ext") # Then pretend that we don't have the sources for the external project, # and can only use compiled binaries t.copy("ext/Jamfile2", "ext/Jamfile") +t.expand_toolset("ext/Jamfile") # Now check that we can build the main project, and that # correct prebuilt file is picked, depending of variant. diff --git a/v2/test/prebuilt/ext/Jamfile2 b/v2/test/prebuilt/ext/Jamfile2 index 2e85ad2a3..b26f9de54 100644 --- a/v2/test/prebuilt/ext/Jamfile2 +++ b/v2/test/prebuilt/ext/Jamfile2 @@ -4,19 +4,19 @@ import modules ; local dll-suffix = so ; if [ modules.peek : OS ] in NT CYGWIN { - dll-suffix = dll ; + dll-suffix = lib ; } project ext ; lib a : - : bin/gcc/debug/a.$(dll-suffix) debug + : bin/$toolset/debug/a.$(dll-suffix) debug : : debug ; lib a : - : bin/gcc/release/a.$(dll-suffix) release + : bin/$toolset/release/a.$(dll-suffix) release : : release ; diff --git a/v2/test/prebuilt/ext/a.cpp b/v2/test/prebuilt/ext/a.cpp index e96b8c679..b10a8968c 100644 --- a/v2/test/prebuilt/ext/a.cpp +++ b/v2/test/prebuilt/ext/a.cpp @@ -8,6 +8,9 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllexport) +#endif #ifdef RELEASE void release() {} #else diff --git a/v2/test/prebuilt/ext/debug/a.h b/v2/test/prebuilt/ext/debug/a.h index c421ffc1c..115f94ab8 100644 --- a/v2/test/prebuilt/ext/debug/a.h +++ b/v2/test/prebuilt/ext/debug/a.h @@ -8,4 +8,7 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllimport) +#endif void debug(); diff --git a/v2/test/prebuilt/ext/release/a.h b/v2/test/prebuilt/ext/release/a.h index 55103274d..c23a9890e 100644 --- a/v2/test/prebuilt/ext/release/a.h +++ b/v2/test/prebuilt/ext/release/a.h @@ -8,4 +8,7 @@ // http://www.boost.org // +#ifdef _WIN32 +__declspec(dllimport) +#endif void release(); diff --git a/v2/test/prebuilt/hello.cpp b/v2/test/prebuilt/hello.cpp index e2f2bfb6d..880940682 100644 --- a/v2/test/prebuilt/hello.cpp +++ b/v2/test/prebuilt/hello.cpp @@ -17,4 +17,5 @@ int main() #else debug(); #endif + return 0; } diff --git a/v2/test/project_dependencies.py b/v2/test/project_dependencies.py index 88cd413e3..383a3cfc1 100644 --- a/v2/test/project_dependencies.py +++ b/v2/test/project_dependencies.py @@ -12,7 +12,12 @@ t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", "build-project src ;") t.write("lib/Jamfile", "lib lib1 : lib1.cpp ;") -t.write("lib/lib1.cpp", "void foo() {}\n") +t.write("lib/lib1.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {}\n +""") t.write("src/Jamfile", """ project : requirements ../lib/lib1 @@ -22,6 +27,9 @@ exe a : a.cpp ; exe b : b.cpp ; """) t.write("src/a.cpp", """ +#ifdef _WIN32 +__declspec(dllimport) +#endif void foo(); int main() { foo(); return 0; } """) diff --git a/v2/test/searched_lib.py b/v2/test/searched_lib.py index 54d845d24..a7c8e6be9 100644 --- a/v2/test/searched_lib.py +++ b/v2/test/searched_lib.py @@ -5,17 +5,30 @@ from BoostBuild import Tester import string +import os t = Tester() # To start with, we have to prepate a library to link with -t.write("lib/project-root.jam", "import gcc ; ") +t.write("lib/project-root.jam", "") t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;") -t.write("lib/test_lib.cpp", "void foo() {}\n"); +t.write("lib/test_lib.cpp", """ +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {} +"""); t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/test_lib.dll") -t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") +# Auto adjusting of suffixes does not work, since we need to +# change dll to lib. +# +if os.name == 'nt': + t.copy("lib/bin/$toolset/debug/test_lib.lib", "lib/test_lib.lib") +else: + t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") + # A regression test: property referring to @@ -39,6 +52,9 @@ lib test_lib : : test_lib ../../lib ; lib a : a.cpp : : : test_lib ; """) t.write('d/d2/a.cpp', """ +#ifdef _WIN32 +__declspec(dllexport) int force_library_creation_for_a; +#endif """) t.run_build_system() diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 3f8c09ef0..7f249f37d 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -85,11 +85,11 @@ tests = [ "project_test1", "alternatives", "unused", "default_features", - "railsys", "print", ] if os.name == 'posix': tests.append("symlink") + tests.append("railsys") # Actually, needs QT run_tests(critical_tests, tests)