mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
Tests/RunCMake/Emscripten: Add tests covering try_compile COPY_FILE
Compiler inspection relies on `try_compile`'s `COPY_FILE` option to copy the `.wasm` file because the `.js` does not have the `INFO:size` string. Issue: #27421
This commit is contained in:
2
Tests/RunCMake/Emscripten/C-CheckTypeSize-stdout.txt
Normal file
2
Tests/RunCMake/Emscripten/C-CheckTypeSize-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- SIZEOF_INT='[1-9][0-9]*'
|
||||
-- HAVE_SIZEOF_INT='TRUE'
|
||||
6
Tests/RunCMake/Emscripten/C-CheckTypeSize.cmake
Normal file
6
Tests/RunCMake/Emscripten/C-CheckTypeSize.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
enable_language(C)
|
||||
|
||||
include(CheckTypeSize)
|
||||
check_type_size(int SIZEOF_INT)
|
||||
message(STATUS "SIZEOF_INT='${SIZEOF_INT}'")
|
||||
message(STATUS "HAVE_SIZEOF_INT='${HAVE_SIZEOF_INT}'")
|
||||
2
Tests/RunCMake/Emscripten/C-enable-stdout.txt
Normal file
2
Tests/RunCMake/Emscripten/C-enable-stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
-- CMAKE_C_BYTE_ORDER='LITTLE_ENDIAN'
|
||||
-- CMAKE_C_SIZEOF_DATA_PTR='[1-9][0-9]*'
|
||||
7
Tests/RunCMake/Emscripten/C-enable.cmake
Normal file
7
Tests/RunCMake/Emscripten/C-enable.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
enable_language(C)
|
||||
foreach(var IN ITEMS
|
||||
CMAKE_C_BYTE_ORDER
|
||||
CMAKE_C_SIZEOF_DATA_PTR
|
||||
)
|
||||
message(STATUS "${var}='${${var}}'")
|
||||
endforeach()
|
||||
@@ -40,6 +40,12 @@ foreach(_emscripten_toolchain IN LISTS _emscripten_toolchains)
|
||||
set(cxx_comp ${BIN_DIR}/em++${EMCC_SUFFIX})
|
||||
set(comp_ar ${BIN_DIR}/emar${EMCC_SUFFIX})
|
||||
|
||||
# Compiler inspection.
|
||||
run_cmake_with_options(C-enable
|
||||
-DCMAKE_SYSTEM_NAME=Emscripten
|
||||
-DCMAKE_C_COMPILER=${c_comp}
|
||||
)
|
||||
|
||||
# Create an executable from .c sources only.
|
||||
run_toolchain(C-exe
|
||||
-DCMAKE_SYSTEM_NAME=Emscripten
|
||||
@@ -76,4 +82,9 @@ foreach(_emscripten_toolchain IN LISTS _emscripten_toolchains)
|
||||
)
|
||||
run_cmake_target(C-WHOLE_ARCHIVE link-exe main)
|
||||
run_cmake_target(C-WHOLE_ARCHIVE circular-exe main_circular)
|
||||
|
||||
run_cmake_with_options(C-CheckTypeSize
|
||||
-DCMAKE_SYSTEM_NAME=Emscripten
|
||||
-DCMAKE_C_COMPILER=${c_comp}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user