From 2410b912fe371fb41ac745bece20a447296ff51b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Dec 2013 11:14:23 +0100 Subject: [PATCH] Merge some GenerateExportHeader subtests. --- .../GenerateExportHeader/CMakeLists.txt | 5 +--- .../lib_shared_and_static/CMakeLists.txt | 16 ++++++++++-- .../libshared_and_static.h | 26 +++++++++---------- .../override_symbol/CMakeLists.txt | 11 -------- .../override_symbol/main.cpp | 9 ------- .../override_symbol/someclass.cpp | 7 ----- .../override_symbol/someclass.h | 8 ------ .../prefix/CMakeLists.txt | 15 ----------- .../GenerateExportHeader/prefix/main.cpp | 8 ------ .../prefix/useprefixclass.cpp | 7 ----- .../prefix/useprefixclass.h | 13 ---------- .../visibility_preset/CMakeLists.txt | 17 ------------ .../visibility_preset/main.cpp | 9 ------- .../visibility_preset/visibility_preset.cpp | 7 ----- .../visibility_preset/visibility_preset.h | 13 ---------- 15 files changed, 28 insertions(+), 143 deletions(-) delete mode 100644 Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/override_symbol/main.cpp delete mode 100644 Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp delete mode 100644 Tests/Module/GenerateExportHeader/override_symbol/someclass.h delete mode 100644 Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/prefix/main.cpp delete mode 100644 Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp delete mode 100644 Tests/Module/GenerateExportHeader/prefix/useprefixclass.h delete mode 100644 Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt delete mode 100644 Tests/Module/GenerateExportHeader/visibility_preset/main.cpp delete mode 100644 Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp delete mode 100644 Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 9b0f0c011..bf867a94f 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -57,7 +57,7 @@ endif() include(GenerateExportHeader) -add_subdirectory(visibility_preset) +add_subdirectory(lib_shared_and_static) add_compiler_export_flags() @@ -79,11 +79,8 @@ endmacro() macro_add_test_library(libshared) macro_add_test_library(libstatic) -add_subdirectory(lib_shared_and_static) -add_subdirectory(override_symbol) add_subdirectory(nodeprecated) -add_subdirectory(prefix) if(NOT BORLAND) add_subdirectory(c_identifier) endif() diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt index be0387fd5..c1be12556 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -5,7 +5,15 @@ project(lib_shared_and_static) include(GenerateExportHeader) -add_compiler_export_flags() +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden") + message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") +endif() +if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden") + message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -14,9 +22,13 @@ set(lib_SRCS ) add_library(shared_variant SHARED ${lib_SRCS}) +set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) add_library(static_variant ${lib_SRCS}) -generate_export_header(shared_variant BASE_NAME libshared_and_static) +generate_export_header(shared_variant + BASE_NAME libshared_and_static + PREFIX_NAME MYPREFIX_ +) set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h index 049bfe9c4..5ad77f4a9 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -4,51 +4,51 @@ #include "libshared_and_static_export.h" -class LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic { public: int libshared_and_static() const; int libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; class LibsharedAndStaticNotExported { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -class LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded { public: int libshared_and_static() const; - int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const; - int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const; int libshared_and_static_not_exported() const; - int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const; }; -LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); +MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); -LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); +MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated(); int libshared_and_static_not_exported(); -int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); #endif diff --git a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt b/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt deleted file mode 100644 index aeeef20ee..000000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -project(override_symbol) - -add_library(somelib SHARED someclass.cpp) - -set_target_properties(somelib PROPERTIES DEFINE_SYMBOL SOMELIB_MAKEDLL) - -generate_export_header(somelib) - -add_executable(consumer main.cpp) - -target_link_libraries(consumer somelib) diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp deleted file mode 100644 index eec46d3f2..000000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "someclass.h" - -int main(int, char**) -{ - SomeClass sc; - sc.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp deleted file mode 100644 index 427ec297c..000000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "someclass.h" - -void SomeClass::someMethod() const -{ - -} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h b/Tests/Module/GenerateExportHeader/override_symbol/someclass.h deleted file mode 100644 index ae5e84454..000000000 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h +++ /dev/null @@ -1,8 +0,0 @@ - -#include "somelib_export.h" - -class SOMELIB_EXPORT SomeClass -{ -public: - void someMethod() const; -}; diff --git a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt b/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt deleted file mode 100644 index bd64df283..000000000 --- a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -project(use_prefix) - -set(use_prefix_lib_SRCS - useprefixclass.cpp -) - -add_library(use_prefix_lib SHARED useprefixclass.cpp) - -generate_export_header(use_prefix_lib - PREFIX_NAME MYPREFIX_ -) - -add_executable(use_prefix main.cpp) - -target_link_libraries(use_prefix use_prefix_lib) \ No newline at end of file diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp deleted file mode 100644 index 507f6fd15..000000000 --- a/Tests/Module/GenerateExportHeader/prefix/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "useprefixclass.h" - -int main(int argc, char **argv) -{ - UsePrefixClass upc; - return upc.someMethod(); -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp deleted file mode 100644 index 1fd2cb2b4..000000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "useprefixclass.h" - -int UsePrefixClass::someMethod() const -{ - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h deleted file mode 100644 index f5e31b507..000000000 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef USEPREFIXCLASS_H -#define USEPREFIXCLASS_H - -#include "use_prefix_lib_export.h" - -class MYPREFIX_USE_PREFIX_LIB_EXPORT UsePrefixClass -{ -public: - int someMethod() const; -}; - -#endif diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt deleted file mode 100644 index 2571d2224..000000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ - -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() -if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden") - message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory") -endif() - -add_library(visibility_preset SHARED visibility_preset.cpp) -generate_export_header(visibility_preset) - -add_executable(visibility_preset_exe main.cpp) - -target_link_libraries(visibility_preset_exe visibility_preset) diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp deleted file mode 100644 index 89c397784..000000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "visibility_preset.h" - -int main() -{ - VisibilityPreset vp; - vp.someMethod(); - return 0; -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp deleted file mode 100644 index c97dec6e2..000000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "visibility_preset.h" - -void VisibilityPreset::someMethod() -{ - -} diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h deleted file mode 100644 index 8becbe189..000000000 --- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef VISIBILITY_PRESET_H -#define VISIBILITY_PRESET_H - -#include "visibility_preset_export.h" - -class VISIBILITY_PRESET_EXPORT VisibilityPreset -{ -public: - void someMethod(); -}; - -#endif