Merge pull request #3 from doru1004/fix-build

Fix build
This commit is contained in:
Tian Jin 2019-12-23 11:41:04 -05:00 committed by GitHub
commit 3b7a1c17b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -153,10 +153,10 @@ set(MLIRWholeArchiveLibs
function(whole_archive_link target lib_dir)
get_property(link_flags TARGET ${target} PROPERTY LINK_FLAGS)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(link_flags "${link_flags} -L${lib_dir} ")
set(link_flags "${link_flags} -L${lib_dir} ")
foreach(LIB ${ARGN})
string(CONCAT link_flags ${link_flags}
"-Wl,-force_load ${lib_dir}/lib${LIB}.a ")
"-Wl,-force_load, ${lib_dir}/lib${LIB}.a ")
endforeach(LIB)
elseif(MSVC)
foreach(LIB ${ARGN})
@ -177,9 +177,9 @@ function(whole_archive_link_mlir target)
endfunction(whole_archive_link_mlir)
function(whole_archive_link_onnf target)
foreach(LIB ${ARGN})
add_dependencies(${target} ${LIB})
endforeach(LIB)
foreach(lib_target ${ARGN})
add_dependencies(${target} ${lib_target})
endforeach(lib_target)
whole_archive_link(${target} ${CMAKE_BINARY_DIR}/lib ${ARGN})
endfunction(whole_archive_link_onnf)

View File

@ -70,9 +70,9 @@ add_subdirectory(runtime)
add_executable(onnf main.cpp)
target_link_libraries(onnf builder compiler ${MLIRLibs} onnf_transform)
whole_archive_link_mlir(onnf ${MLIRWholeArchiveLibs})
target_link_libraries(onnf builder ${MLIRLibs} onnf_transform)
set_target_properties(onnf PROPERTIES LINK_FLAGS "-lz")
whole_archive_link_mlir(onnf ${MLIRWholeArchiveLibs})
target_include_directories(onnf PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(onnf PRIVATE ${CMAKE_BINARY_DIR})