diff --git a/test/main_properties.py b/test/main_properties.py index 2c9042cf5..a8843ddf8 100644 --- a/test/main_properties.py +++ b/test/main_properties.py @@ -14,13 +14,22 @@ lib b : b.cpp : BAR ; exe a : a.cpp b ; """) t.write("a.cpp", """ -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); int main() { foo(); } """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() -t.expect_addition("bin/$toolset/debug/main-target-b/b.o") +t.expect_addition("bin/$toolset/debug/main-target-b/b.obj") # This tests another bug: when source file was used by two main targets, # one without any requirements and another with free requirements, it @@ -36,7 +45,7 @@ int main() { return 0; } t.rm("bin") t.run_build_system() -t.expect_addition(["bin/$toolset/debug/a.o", "bin/$toolset/debug/main-target-b/a.o"]) +t.expect_addition(["bin/$toolset/debug/a.obj", "bin/$toolset/debug/main-target-b/a.obj"]) t.cleanup() diff --git a/test/use_requirements.py b/test/use_requirements.py index 7df9f4be4..a5af55443 100644 --- a/test/use_requirements.py +++ b/test/use_requirements.py @@ -9,7 +9,12 @@ t.write("Jamfile", """ lib b : b.cpp : : : FOO ; exe a : a.cpp b ; """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.write("a.cpp", """ #ifdef FOO void foo() {} @@ -28,7 +33,13 @@ t.write("Jamfile", """ lib b : b.cpp : : : FOO ; exe a : a.cpp : b ; """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""" +) t.write("a.cpp", """ #ifdef FOO int main() { return 0; } @@ -48,7 +59,12 @@ project : ; lib b : b.cpp ; """) -t.write("lib/b.cpp", "void foo() {}\n") +t.write("lib/b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() # Test that use requirements are inherited correctly @@ -74,7 +90,12 @@ project : ; lib b : b.cpp ; """) -t.write("lib/1/b.cpp", "void foo() {}\n") +t.write("lib/1/b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() t.run_build_system("--clean") @@ -94,11 +115,20 @@ t.write("Jamfile", """ """) t.write("a.cpp", """ #ifdef FOO -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); #endif int main() { foo(); } """) -t.write("c.cpp", "") +t.write("c.cpp", +""" +#ifdef _WIN32 +int __declspec(dllexport) must_export_something(); +#endif +""") t.run_build_system() t.run_build_system("--clean") @@ -134,7 +164,11 @@ exe hello : hello.cpp main ; """) t.write("main.cpp", """ -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); int main() { foo(); return 0; } """) @@ -146,7 +180,11 @@ import gcc ; """) t.write("libs/a.cpp", """ -void foo() {} +void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {} """) # This library should be build with the same properties as diff --git a/v2/test/main_properties.py b/v2/test/main_properties.py index 2c9042cf5..a8843ddf8 100644 --- a/v2/test/main_properties.py +++ b/v2/test/main_properties.py @@ -14,13 +14,22 @@ lib b : b.cpp : BAR ; exe a : a.cpp b ; """) t.write("a.cpp", """ -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); int main() { foo(); } """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() -t.expect_addition("bin/$toolset/debug/main-target-b/b.o") +t.expect_addition("bin/$toolset/debug/main-target-b/b.obj") # This tests another bug: when source file was used by two main targets, # one without any requirements and another with free requirements, it @@ -36,7 +45,7 @@ int main() { return 0; } t.rm("bin") t.run_build_system() -t.expect_addition(["bin/$toolset/debug/a.o", "bin/$toolset/debug/main-target-b/a.o"]) +t.expect_addition(["bin/$toolset/debug/a.obj", "bin/$toolset/debug/main-target-b/a.obj"]) t.cleanup() diff --git a/v2/test/use_requirements.py b/v2/test/use_requirements.py index 7df9f4be4..a5af55443 100644 --- a/v2/test/use_requirements.py +++ b/v2/test/use_requirements.py @@ -9,7 +9,12 @@ t.write("Jamfile", """ lib b : b.cpp : : : FOO ; exe a : a.cpp b ; """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.write("a.cpp", """ #ifdef FOO void foo() {} @@ -28,7 +33,13 @@ t.write("Jamfile", """ lib b : b.cpp : : : FOO ; exe a : a.cpp : b ; """) -t.write("b.cpp", "void foo() {}\n") +t.write("b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""" +) t.write("a.cpp", """ #ifdef FOO int main() { return 0; } @@ -48,7 +59,12 @@ project : ; lib b : b.cpp ; """) -t.write("lib/b.cpp", "void foo() {}\n") +t.write("lib/b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() # Test that use requirements are inherited correctly @@ -74,7 +90,12 @@ project : ; lib b : b.cpp ; """) -t.write("lib/1/b.cpp", "void foo() {}\n") +t.write("lib/1/b.cpp", +"""void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {}\n""") t.run_build_system() t.run_build_system("--clean") @@ -94,11 +115,20 @@ t.write("Jamfile", """ """) t.write("a.cpp", """ #ifdef FOO -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); #endif int main() { foo(); } """) -t.write("c.cpp", "") +t.write("c.cpp", +""" +#ifdef _WIN32 +int __declspec(dllexport) must_export_something(); +#endif +""") t.run_build_system() t.run_build_system("--clean") @@ -134,7 +164,11 @@ exe hello : hello.cpp main ; """) t.write("main.cpp", """ -void foo(); +void +#ifdef _WIN32 +__declspec(dllimport) +#endif +foo(); int main() { foo(); return 0; } """) @@ -146,7 +180,11 @@ import gcc ; """) t.write("libs/a.cpp", """ -void foo() {} +void +#ifdef _WIN32 +__declspec(dllexport) +#endif +foo() {} """) # This library should be build with the same properties as