forked from OSchip/llvm-project
29 lines
1.1 KiB
CMake
29 lines
1.1 KiB
CMake
function(mlir_tablegen ofn)
|
|
tablegen(MLIR ${ARGV} "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
|
|
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
|
PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
# TODO: This is to handle the current static registration, but should be
|
|
# factored out a bit.
|
|
function(whole_archive_link target)
|
|
add_dependencies(${target} ${ARGN})
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
|
set(link_flags "-L${CMAKE_BINARY_DIR}/lib ")
|
|
FOREACH(LIB ${ARGN})
|
|
string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ")
|
|
ENDFOREACH(LIB)
|
|
elseif(MSVC)
|
|
FOREACH(LIB ${ARGN})
|
|
string(CONCAT link_flags ${link_flags} "/WHOLEARCHIVE:${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/${LIB}.lib ")
|
|
ENDFOREACH(LIB)
|
|
else()
|
|
set(link_flags "-L${CMAKE_BINARY_DIR}/lib -Wl,--whole-archive,")
|
|
FOREACH(LIB ${ARGN})
|
|
string(CONCAT link_flags ${link_flags} "-l${LIB},")
|
|
ENDFOREACH(LIB)
|
|
string(CONCAT link_flags ${link_flags} "--no-whole-archive")
|
|
endif()
|
|
set_target_properties(${target} PROPERTIES LINK_FLAGS ${link_flags})
|
|
endfunction(whole_archive_link)
|