summaryrefslogtreecommitdiffstats
path: root/Tests/CxxOnly
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CxxOnly')
-rw-r--r--Tests/CxxOnly/CMakeLists.txt13
-rw-r--r--Tests/CxxOnly/cxxonly.cxx23
-rw-r--r--Tests/CxxOnly/libcxx1.cxx6
-rw-r--r--Tests/CxxOnly/libcxx1.h5
-rw-r--r--Tests/CxxOnly/libcxx2.cxx6
-rw-r--r--Tests/CxxOnly/libcxx2.h15
-rw-r--r--Tests/CxxOnly/test.CPP1
-rw-r--r--Tests/CxxOnly/testCxxModule.cxx9
8 files changed, 78 insertions, 0 deletions
diff --git a/Tests/CxxOnly/CMakeLists.txt b/Tests/CxxOnly/CMakeLists.txt
new file mode 100644
index 0000000..e62f3c7
--- /dev/null
+++ b/Tests/CxxOnly/CMakeLists.txt
@@ -0,0 +1,13 @@
+# a simple CXX only test case
+project (CxxOnly CXX)
+
+set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
+if(WIN32)
+ set(EXTRA_SRCS test.CPP)
+endif()
+add_library(testcxx1.my STATIC libcxx1.cxx ${EXTRA_SRCS})
+add_library(testcxx2 SHARED libcxx2.cxx)
+add_executable (CxxOnly cxxonly.cxx)
+target_link_libraries(CxxOnly testcxx1.my testcxx2)
+
+add_library(testCxxModule MODULE testCxxModule.cxx)
diff --git a/Tests/CxxOnly/cxxonly.cxx b/Tests/CxxOnly/cxxonly.cxx
new file mode 100644
index 0000000..0911a07
--- /dev/null
+++ b/Tests/CxxOnly/cxxonly.cxx
@@ -0,0 +1,23 @@
+#include "libcxx1.h"
+#include "libcxx2.h"
+#ifdef _MSC_VER
+extern int testCPP;
+#endif
+
+#include <stdio.h>
+
+int main()
+{
+#ifdef _MSC_VER
+ testCPP = 1;
+#endif
+ if (LibCxx1Class::Method() != 2.0) {
+ printf("Problem with libcxx1\n");
+ return 1;
+ }
+ if (LibCxx2Class::Method() != 1.0) {
+ printf("Problem with libcxx2\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/Tests/CxxOnly/libcxx1.cxx b/Tests/CxxOnly/libcxx1.cxx
new file mode 100644
index 0000000..da18019
--- /dev/null
+++ b/Tests/CxxOnly/libcxx1.cxx
@@ -0,0 +1,6 @@
+#include "libcxx1.h"
+
+float LibCxx1Class::Method()
+{
+ return 2.0;
+}
diff --git a/Tests/CxxOnly/libcxx1.h b/Tests/CxxOnly/libcxx1.h
new file mode 100644
index 0000000..9452a64
--- /dev/null
+++ b/Tests/CxxOnly/libcxx1.h
@@ -0,0 +1,5 @@
+class LibCxx1Class
+{
+public:
+ static float Method();
+};
diff --git a/Tests/CxxOnly/libcxx2.cxx b/Tests/CxxOnly/libcxx2.cxx
new file mode 100644
index 0000000..453039c
--- /dev/null
+++ b/Tests/CxxOnly/libcxx2.cxx
@@ -0,0 +1,6 @@
+#include "libcxx2.h"
+
+float LibCxx2Class::Method()
+{
+ return 1.0;
+}
diff --git a/Tests/CxxOnly/libcxx2.h b/Tests/CxxOnly/libcxx2.h
new file mode 100644
index 0000000..1d97fa0
--- /dev/null
+++ b/Tests/CxxOnly/libcxx2.h
@@ -0,0 +1,15 @@
+#ifdef _WIN32
+#ifdef testcxx2_EXPORTS
+#define CM_TEST_LIB_EXPORT __declspec(dllexport)
+#else
+#define CM_TEST_LIB_EXPORT __declspec(dllimport)
+#endif
+#else
+#define CM_TEST_LIB_EXPORT
+#endif
+
+class CM_TEST_LIB_EXPORT LibCxx2Class
+{
+public:
+ static float Method();
+};
diff --git a/Tests/CxxOnly/test.CPP b/Tests/CxxOnly/test.CPP
new file mode 100644
index 0000000..8a3cde2
--- /dev/null
+++ b/Tests/CxxOnly/test.CPP
@@ -0,0 +1 @@
+int testCPP;
diff --git a/Tests/CxxOnly/testCxxModule.cxx b/Tests/CxxOnly/testCxxModule.cxx
new file mode 100644
index 0000000..039e8bb
--- /dev/null
+++ b/Tests/CxxOnly/testCxxModule.cxx
@@ -0,0 +1,9 @@
+#ifdef _WIN32
+#define TEST_EXPORT __declspec(dllexport)
+#else
+#define TEST_EXPORT
+#endif
+TEST_EXPORT int testCxxModule(void)
+{
+ return 0;
+}