150
|
1 function(mlir_tablegen ofn)
|
|
2 tablegen(MLIR ${ARGV} "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
|
|
3 set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
|
4 PARENT_SCOPE)
|
|
5 endfunction()
|
|
6
|
|
7 # TODO: This is to handle the current static registration, but should be
|
|
8 # factored out a bit.
|
|
9 function(whole_archive_link target)
|
|
10 add_dependencies(${target} ${ARGN})
|
|
11 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
|
12 set(link_flags "-L${CMAKE_BINARY_DIR}/lib ")
|
|
13 FOREACH(LIB ${ARGN})
|
|
14 string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ")
|
|
15 ENDFOREACH(LIB)
|
|
16 elseif(MSVC)
|
|
17 FOREACH(LIB ${ARGN})
|
|
18 string(CONCAT link_flags ${link_flags} "/WHOLEARCHIVE:${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/${LIB}.lib ")
|
|
19 ENDFOREACH(LIB)
|
|
20 else()
|
|
21 set(link_flags "-L${CMAKE_BINARY_DIR}/lib -Wl,--whole-archive,")
|
|
22 FOREACH(LIB ${ARGN})
|
|
23 string(CONCAT link_flags ${link_flags} "-l${LIB},")
|
|
24 ENDFOREACH(LIB)
|
|
25 string(CONCAT link_flags ${link_flags} "--no-whole-archive")
|
|
26 endif()
|
|
27 set_target_properties(${target} PROPERTIES LINK_FLAGS ${link_flags})
|
|
28 endfunction(whole_archive_link)
|