summaryrefslogtreecommitdiffstats
path: root/test cases/cmake/25 assembler/subprojects
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/cmake/25 assembler/subprojects
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/cmake/25 assembler/subprojects')
-rw-r--r--test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt45
-rw-r--r--test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c8
-rw-r--r--test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s4
3 files changed, 57 insertions, 0 deletions
diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt b/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt
new file mode 100644
index 0000000..bb8834d
--- /dev/null
+++ b/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(cmTest)
+
+#Detect processor
+if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "amd64")
+ SET(TEST_PROCESSOR "x86_64")
+elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
+ SET(TEST_PROCESSOR "x86_64")
+elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i386")
+ SET(TEST_PROCESSOR "x86")
+elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i686")
+ SET(TEST_PROCESSOR "x86")
+elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
+ SET(TEST_PROCESSOR "arm")
+elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
+ SET(TEST_PROCESSOR "arm")
+else ()
+ message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform")
+endif ()
+
+#Detect ABI
+if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+ SET(TEST_ABI "sysv")
+elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
+ SET(TEST_ABI "sysv")
+elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "NetBSD")
+ SET(TEST_ABI "sysv")
+elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
+ SET(TEST_ABI "sysv")
+else ()
+ message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform")
+endif ()
+
+SET(TEST_PLATFORM "${TEST_PROCESSOR}-${TEST_ABI}")
+
+if ( ("${TEST_PLATFORM}" MATCHES "x86_64-sysv")
+ OR ("${TEST_PLATFORM}" MATCHES "x86-sysv")
+ OR ("${TEST_PLATFORM}" MATCHES "arm-sysv"))
+ SET(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+ enable_language(ASM)
+ SET(TEST_SOURCE "cmTestAsm.s")
+endif ()
+
+add_library(cmTest STATIC cmTest.c ${TEST_SOURCE})
diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c b/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c
new file mode 100644
index 0000000..e32415c
--- /dev/null
+++ b/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c
@@ -0,0 +1,8 @@
+#include <stdint.h>
+
+extern const int32_t cmTestArea;
+
+int32_t cmTestFunc(void)
+{
+ return cmTestArea;
+}
diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s b/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s
new file mode 100644
index 0000000..8aa83a6
--- /dev/null
+++ b/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s
@@ -0,0 +1,4 @@
+.text
+.globl cmTestArea
+cmTestArea:
+ .long 4242