summaryrefslogtreecommitdiffstats
path: root/Tests/VSNASM
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/VSNASM')
-rw-r--r--Tests/VSNASM/CMakeLists.txt20
-rw-r--r--Tests/VSNASM/bar.asm13
-rw-r--r--Tests/VSNASM/foo.asm7
-rw-r--r--Tests/VSNASM/include/foo-proc.asm7
-rw-r--r--Tests/VSNASM/main.c6
5 files changed, 53 insertions, 0 deletions
diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt
new file mode 100644
index 0000000..821d022
--- /dev/null
+++ b/Tests/VSNASM/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(VSNASM C ASM_NASM)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ add_definitions(-DTESTx64)
+ string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
+else()
+ add_definitions(-DTESTi386)
+endif()
+
+# Test quoting for definitions with spaces.
+add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0")
+
+# Test quoting for file names with spaces. The file is generated because CMake
+# itself cannot have files with spaces.
+file(READ bar.asm BAR_ASM_CONTENTS)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm")
diff --git a/Tests/VSNASM/bar.asm b/Tests/VSNASM/bar.asm
new file mode 100644
index 0000000..b486d82
--- /dev/null
+++ b/Tests/VSNASM/bar.asm
@@ -0,0 +1,13 @@
+section .text
+%ifdef TEST2x64
+global bar
+%else
+global _bar
+%endif
+%ifdef TESTx64
+bar:
+%else
+_bar:
+%endif
+ mov EAX_COMMA_SPACE_ZERO
+ ret
diff --git a/Tests/VSNASM/foo.asm b/Tests/VSNASM/foo.asm
new file mode 100644
index 0000000..aba0673
--- /dev/null
+++ b/Tests/VSNASM/foo.asm
@@ -0,0 +1,7 @@
+section .text
+%ifdef TEST2x64
+global foo
+%else
+global _foo
+%endif
+%include "foo-proc.asm"
diff --git a/Tests/VSNASM/include/foo-proc.asm b/Tests/VSNASM/include/foo-proc.asm
new file mode 100644
index 0000000..eb5bb2b
--- /dev/null
+++ b/Tests/VSNASM/include/foo-proc.asm
@@ -0,0 +1,7 @@
+%ifdef TESTx64
+foo:
+%else
+_foo:
+%endif
+ mov EAX_COMMA_SPACE_ZERO
+ ret
diff --git a/Tests/VSNASM/main.c b/Tests/VSNASM/main.c
new file mode 100644
index 0000000..b1401b6
--- /dev/null
+++ b/Tests/VSNASM/main.c
@@ -0,0 +1,6 @@
+extern int foo(void);
+extern int bar(void);
+int main(void)
+{
+ return foo() + bar();
+}