mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
Add a test case triggering warning after adding nasm language
This commit is contained in:
1 parent
245448ad8f
commit
41d62c9cab
7 files changed
+85
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int32_t cmTestFunc(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (cmTestFunc() > 4200)
|
||||
{
|
||||
printf("Test success.\n");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Test failure.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
project('cmake nasm dependency', ['c', 'cpp'])
|
||||
|
||||
if meson.is_cross_build()
|
||||
error('MESON_SKIP_TEST: skip this on cross builds')
|
||||
endif
|
||||
|
||||
if get_option('backend').startswith('vs')
|
||||
error('MESON_SKIP_TEST: nasm is not supported by vs backend')
|
||||
endif
|
||||
|
||||
if not add_languages('nasm', required: false, native: false)
|
||||
error('MESON_SKIP_TEST: nasm not found')
|
||||
endif
|
||||
|
||||
# Using this dependency triggers CMakeToolchain.update_cmake_compiler_state(),
|
||||
# and with nasm as a language, resulted in a warning
|
||||
# "Failed to determine CMake compilers state" after nasm was added as a language.
|
||||
sub_dep = dependency('cmTest')
|
||||
|
||||
exe1 = executable('exe1', ['main.c'], dependencies: [sub_dep])
|
||||
test('test1', exe1)
|
||||
@@ -0,0 +1,5 @@
|
||||
[wrap-file]
|
||||
method = cmake
|
||||
|
||||
[provide]
|
||||
cmTest = cmTest_dep
|
||||
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
|
||||
project(cmTest)
|
||||
|
||||
#Detect processor
|
||||
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Aa][Mm][Dd]64")
|
||||
SET(TEST_PROCESSOR "x86_64")
|
||||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Xx]86_64")
|
||||
SET(TEST_PROCESSOR "x86_64")
|
||||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Ii]386")
|
||||
SET(TEST_PROCESSOR "x86")
|
||||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Ii]686")
|
||||
SET(TEST_PROCESSOR "x86")
|
||||
else ()
|
||||
message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
endif ()
|
||||
|
||||
enable_language(ASM_NASM)
|
||||
|
||||
add_library(cmTest STATIC cmTest.c cmTestAsm.asm)
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern const int32_t cmTestArea;
|
||||
|
||||
int32_t cmTestFunc(void)
|
||||
{
|
||||
return cmTestArea;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
SECTION .rdata
|
||||
GLOBAL cmTestArea
|
||||
cmTestArea:
|
||||
dd 4242
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"stdout": [
|
||||
{
|
||||
"line": ".*CMake Toolchain: Failed to determine CMake compilers state.*",
|
||||
"match": "re",
|
||||
"count": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user