mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 21:58:50 -05:00
Merge topic 'test-iar'
a772c2c384Tests/RunCMake/IAR: Extend tests to actually build9f52953df5Tests/RunCMake/IAR: Enable IAR extended keywordscc268d58e2Tests/RunCMake/IAR: Update architecture-specific link flagsbcddea5041Tests/RunCMake/IAR: Simplify test project cmake code Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9240
This commit is contained in:
@@ -8,6 +8,13 @@ if(RunCMake_GENERATOR MATCHES "Makefile|Ninja")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(run_toolchain case)
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
|
||||
run_cmake_with_options(${case} ${ARGN})
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .)
|
||||
endfunction()
|
||||
|
||||
foreach(_iar_toolchain IN LISTS _iar_toolchains)
|
||||
message(STATUS "Found IAR toolchain: ${_iar_toolchain}")
|
||||
cmake_path(GET _iar_toolchain PARENT_PATH BIN_DIR)
|
||||
@@ -15,16 +22,22 @@ foreach(_iar_toolchain IN LISTS _iar_toolchains)
|
||||
cmake_path(GET TOOLKIT_DIR FILENAME ARCH)
|
||||
|
||||
# Sets the minimal requirements for linking each target architecture
|
||||
if(ARCH STREQUAL rl78)
|
||||
set(LINK_OPTS
|
||||
"--config_def _STACK_SIZE=256 \
|
||||
--config_def _NEAR_HEAP_SIZE=0x400 \
|
||||
--config_def _FAR_HEAP_SIZE=4096 \
|
||||
--config_def _HUGE_HEAP_SIZE=0 \
|
||||
--config_def _NEAR_CONST_LOCATION_START=0x2000 \
|
||||
--config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 \
|
||||
--define_symbol _NEAR_CONST_LOCATION=0 \
|
||||
--config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf" )
|
||||
if(ARCH STREQUAL "avr")
|
||||
string(CONCAT LINK_OPTS
|
||||
"-I${TOOLKIT_DIR}/lib "
|
||||
"-f ${TOOLKIT_DIR}/src/template/lnk3s.xcl "
|
||||
)
|
||||
elseif(ARCH STREQUAL "rl78")
|
||||
string(CONCAT LINK_OPTS
|
||||
"--config_def _STACK_SIZE=256 "
|
||||
"--config_def _NEAR_HEAP_SIZE=0x400 "
|
||||
"--config_def _FAR_HEAP_SIZE=4096 "
|
||||
"--config_def _HUGE_HEAP_SIZE=0 "
|
||||
"--config_def _NEAR_CONST_LOCATION_START=0x2000 "
|
||||
"--config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 "
|
||||
"--define_symbol _NEAR_CONST_LOCATION=0 "
|
||||
"--config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf "
|
||||
)
|
||||
else()
|
||||
set(LINK_OPTS "")
|
||||
endif()
|
||||
@@ -35,30 +48,26 @@ foreach(_iar_toolchain IN LISTS _iar_toolchains)
|
||||
PATHS ${BIN_DIR}
|
||||
REQUIRED )
|
||||
|
||||
set(RunCMake_TEST_OPTIONS
|
||||
run_toolchain(iar-c
|
||||
-DCMAKE_SYSTEM_NAME=Generic
|
||||
-DCMAKE_C_COMPILER=${_iar_toolchain}
|
||||
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
|
||||
)
|
||||
run_cmake(iar-c)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS
|
||||
run_toolchain(iar-cxx
|
||||
-DCMAKE_SYSTEM_NAME=Generic
|
||||
-DCMAKE_CXX_COMPILER=${_iar_toolchain}
|
||||
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
|
||||
)
|
||||
run_cmake(iar-cxx)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS
|
||||
run_toolchain(iar-asm
|
||||
-DCMAKE_SYSTEM_NAME=Generic
|
||||
-DCMAKE_ASM_COMPILER=${IAR_ASSEMBLER}
|
||||
)
|
||||
run_cmake(iar-asm)
|
||||
)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS
|
||||
run_toolchain(iar-lib
|
||||
-DCMAKE_SYSTEM_NAME=Generic
|
||||
-DCMAKE_C_COMPILER=${_iar_toolchain}
|
||||
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
|
||||
)
|
||||
run_cmake(iar-lib)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
enable_language(ASM)
|
||||
|
||||
add_executable(exec-asm)
|
||||
target_sources(exec-asm PRIVATE module.asm)
|
||||
add_executable(exec-asm module.asm)
|
||||
target_link_options(exec-asm PRIVATE ${LINKER_OPTS})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
enable_language(C)
|
||||
|
||||
add_executable(exec-c)
|
||||
target_sources(exec-c PRIVATE module.c)
|
||||
add_executable(exec-c module.c)
|
||||
target_compile_options(exec-c PRIVATE -e)
|
||||
target_link_options(exec-c PRIVATE ${LINKER_OPTS})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
enable_language(CXX)
|
||||
|
||||
add_executable(exec-cxx)
|
||||
target_sources(exec-cxx PRIVATE module.cxx)
|
||||
add_executable(exec-cxx module.cxx)
|
||||
target_compile_options(exec-cxx PRIVATE -e)
|
||||
target_link_options(exec-cxx PRIVATE ${LINKER_OPTS})
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
enable_language(C)
|
||||
|
||||
add_library(iar-test-lib)
|
||||
target_sources(iar-test-lib PRIVATE libmod.c)
|
||||
add_library(iar-test-lib libmod.c)
|
||||
|
||||
add_executable(exec-lib-c)
|
||||
target_sources(exec-lib-c PRIVATE module.c)
|
||||
add_executable(exec-lib-c module.c)
|
||||
target_compile_options(exec-lib-c PRIVATE -e)
|
||||
target_compile_definitions(exec-lib-c PRIVATE __USE_LIBFUN)
|
||||
target_link_libraries(exec-lib-c LINK_PUBLIC iar-test-lib)
|
||||
target_link_libraries(exec-lib-c PRIVATE iar-test-lib)
|
||||
target_link_options(exec-lib-c PRIVATE ${LINKER_OPTS})
|
||||
|
||||
Reference in New Issue
Block a user