blob: 6092d613b4d8ff4031465121b10fef7580a39a91 [file] [log] [blame] [edit]
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
function(vec_cc_binary)
cmake_parse_arguments(
_RULE
""
"NAME"
"SRCS;COPTS;DEFINES;LINKOPTS;DATA;DEPS;LABELS"
${ARGN}
)
set(_NAME "${_RULE_NAME}")
project(${_RULE_NAME})
set (CMAKE_CXX_STANDARD 17)
set(_ELF_NAME "${_RULE_NAME}.elf")
add_executable(${_ELF_NAME})
target_include_directories(${_ELF_NAME} PUBLIC ${CMAKE_SOURCE_DIR})
set_target_properties(${_ELF_NAME} PROPERTIES LINK_DEPENDS "${LINKER_SCRIPT}")
target_sources(${_ELF_NAME}
PRIVATE
${_RULE_SRCS}
)
target_link_libraries(${_ELF_NAME}
PUBLIC
${_RULE_DEPS}
springbok
)
target_compile_options(${_ELF_NAME}
PUBLIC
${VEC_DEFAULT_COPTS}
${_RULE_COPTS}
)
target_link_options(${_ELF_NAME}
PUBLIC
${_RULE_LINKOPTS}
${VEC_DEFAULT_LINKOPTS}
-T ${LINKER_SCRIPT}
)
endfunction()