-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test case triggering warning after adding nasm language
- Loading branch information
Showing
10 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
project('cmake nasm dependency', ['c', 'cpp']) | ||
|
||
if get_option('backend').startswith('vs') | ||
error('MESON_SKIP_TEST: nasm is not supported by vs backend') | ||
endif | ||
|
||
# This test aims to trigger CMakeToolchain.update_cmake_compiler_state() _twice_, | ||
# as the 2nd CMake compilers state update resulted in a warning | ||
# "Failed to determine CMake compilers state" after nasm was added as a language. | ||
|
||
# First dependency triggers initial compilers state update | ||
sub_dep_1 = dependency('cmTest1') | ||
# Add nasm as a language.. | ||
add_languages('nasm', required: true, native: false) | ||
# ...and check for 2nd dependency. Together with cmake_skip_compiler_test = 'always', | ||
# this triggers another CMake compilers state update, this time with nasm | ||
# in the mix | ||
sub_dep_2 = dependency('cmTest2') | ||
|
||
exe1 = executable('exe1', ['main.c'], dependencies: [sub_dep_1, sub_dep_2]) | ||
test('test1', exe1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[properties] | ||
cmake_skip_compiler_test = 'always' |
5 changes: 5 additions & 0 deletions
5
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest1.wrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[wrap-file] | ||
method = cmake | ||
|
||
[provide] | ||
cmTest1 = cmTest1_dep |
5 changes: 5 additions & 0 deletions
5
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest1/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required(VERSION ${CMAKE_VERSION}) | ||
|
||
project(cmTest1) | ||
|
||
add_library(cmTest1 STATIC cmTest.c) |
8 changes: 8 additions & 0 deletions
8
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest1/cmTest.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <stdint.h> | ||
|
||
extern const int32_t cmTestArea; | ||
|
||
int32_t cmTestFunc(void) | ||
{ | ||
return cmTestArea; | ||
} |
5 changes: 5 additions & 0 deletions
5
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest2.wrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[wrap-file] | ||
method = cmake | ||
|
||
[provide] | ||
cmTest2 = cmTest2_dep |
24 changes: 24 additions & 0 deletions
24
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest2/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION ${CMAKE_VERSION}) | ||
|
||
project(cmTest2) | ||
|
||
#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") | ||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Aa][Rr][Mm]") | ||
SET(TEST_PROCESSOR "arm") | ||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "[Aa][Aa][Rr][Cc][Hh]64") | ||
SET(TEST_PROCESSOR "arm") | ||
else () | ||
message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform ${CMAKE_SYSTEM_PROCESSOR}") | ||
endif () | ||
|
||
enable_language(ASM_NASM) | ||
|
||
add_library(cmTest2 STATIC cmTestAsm.asm) |
4 changes: 4 additions & 0 deletions
4
test cases/cmake/28 cmake nasm dependency/subprojects/cmTest2/cmTestAsm.asm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SECTION .rdata | ||
GLOBAL cmTestArea | ||
cmTestArea: | ||
dd 4242 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"stdout": [ | ||
{ | ||
"line": ".*CMake Toolchain: Failed to determine CMake compilers state.*", | ||
"match": "re", | ||
"count": 0 | ||
} | ||
] | ||
} |