From 346093c99e84114ce373fc9cdc6d9cb896d30b0e Mon Sep 17 00:00:00 2001 From: Daniel Donenfeld Date: Thu, 6 Dec 2018 11:47:52 -0800 Subject: [PATCH] Add asm generation target (off by default) and function to add a test to generate asm. Add existing span test to set of asm tests. (Note: this commit does not change any CI system or introduce any automatic diffing) --- tests/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2d37a51..6b28415 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -171,3 +171,36 @@ endfunction() add_gsl_test_noexcept(no_exception_throw_tests) add_gsl_test_noexcept(no_exception_ensure_tests) + +set(ASM_LOCATION ${CMAKE_SOURCE_DIR}\\asm\\${CMAKE_GENERATOR}) +file(MAKE_DIRECTORY ${ASM_LOCATION}) + +add_custom_target(asm_tests) + +function(add_gsl_asm_test name) + add_library(${name}_asm ${name}.cpp) + + target_compile_options(${name}_asm PRIVATE + $<$: + /FA + /Fa${ASM_LOCATION}\\${name}_asm.asm + > + ${GSL_CPLUSPLUS_OPT} + $<$>: + -S + -o ${ASM_LOCATION}\${name}.s + > + ) + + target_link_libraries(${name}_asm + GSL + test_catch + gsl_tests_config + ) + add_dependencies(${name}_asm catch) + add_dependencies(asm_tests ${name}_asm) + # group all tests under GSL_tests + set_property(TARGET ${name}_asm PROPERTY FOLDER "GSL_tests") +endfunction() + +add_gsl_asm_test(span_tests) \ No newline at end of file