2012-12-19 20:33:39 +08:00
|
|
|
include(LLVMParseArguments)
|
|
|
|
|
2014-02-19 21:01:03 +08:00
|
|
|
# Compile a source into an object file with COMPILER_RT_TEST_COMPILER using
|
2012-12-19 20:33:39 +08:00
|
|
|
# a provided compile flags and dependenices.
|
|
|
|
# clang_compile(<object> <source>
|
|
|
|
# CFLAGS <list of compile flags>
|
|
|
|
# DEPS <list of dependencies>)
|
|
|
|
macro(clang_compile object_file source)
|
|
|
|
parse_arguments(SOURCE "CFLAGS;DEPS" "" ${ARGN})
|
|
|
|
get_filename_component(source_rpath ${source} REALPATH)
|
2014-02-19 21:01:03 +08:00
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
list(APPEND SOURCE_DEPS clang)
|
|
|
|
endif()
|
2012-12-19 20:33:39 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${object_file}
|
2014-02-19 21:01:03 +08:00
|
|
|
COMMAND ${COMPILER_RT_TEST_COMPILER} ${SOURCE_CFLAGS} -c -o "${object_file}"
|
|
|
|
${source_rpath}
|
2012-12-19 20:33:39 +08:00
|
|
|
MAIN_DEPENDENCY ${source}
|
2014-02-19 21:01:03 +08:00
|
|
|
DEPENDS ${SOURCE_DEPS})
|
2012-12-19 20:33:39 +08:00
|
|
|
endmacro()
|