From 43521c0de70396fc3e56bab82ddd047868e5a60d Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Thu, 4 Apr 2019 14:51:09 -0700 Subject: [PATCH] update --- cmake/CMakeLists.txt | 7 ++----- cmake/onnxruntime.cmake | 2 +- cmake/onnxruntime_common.cmake | 2 +- cmake/onnxruntime_python.cmake | 9 ++++++--- cmake/onnxruntime_unittests.cmake | 7 +++---- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b0d577beb6..cc01c0a8bc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -281,8 +281,6 @@ add_subdirectory(external/date EXCLUDE_FROM_ALL) add_subdirectory(external/gsl EXCLUDE_FROM_ALL) add_subdirectory(external/re2 EXCLUDE_FROM_ALL) set_target_properties(re2 PROPERTIES FOLDER "External/re2") -add_library(date ALIAS tz) -set_target_properties(tz PROPERTIES FOLDER "External/tz") add_library(gsl ALIAS GSL) # bounds checking behavior. @@ -296,7 +294,7 @@ include(eigen) #onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn, jemalloc, # mkldnn/mklml, openblas, onnxruntime_codegen_tvm, tvm, nnvm_compiler and pthread # pthread is always at the last -set(onnxruntime_EXTERNAL_LIBRARIES onnx onnx_proto protobuf::libprotobuf tz re2) +set(onnxruntime_EXTERNAL_LIBRARIES onnx onnx_proto protobuf::libprotobuf re2) function(onnxruntime_add_include_to_target dst_target) foreach(src_target ${ARGN}) @@ -572,13 +570,12 @@ include(onnxruntime_mlas.cmake) if(WIN32) list(APPEND onnxruntime_EXTERNAL_LIBRARIES Shlwapi) - set(onnxruntime_EXTERNAL_LIBRARIES_DEBUG ${onnxruntime_EXTERNAL_LIBRARIES} Dbghelp) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES debug Dbghelp) else() if(onnxruntime_USE_NSYNC) list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync_cpp) endif() list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${CMAKE_DL_LIBS} Threads::Threads) - set(onnxruntime_EXTERNAL_LIBRARIES_DEBUG ${onnxruntime_EXTERNAL_LIBRARIES}) endif() #The following files may use the 'onnxruntime_libs' and 'onnxruntime_EXTERNAL_LIBRARIES' vars diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index 957d1997a3..e614d27f0d 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -68,7 +68,7 @@ target_link_libraries(onnxruntime PRIVATE onnxruntime_graph onnxruntime_common onnxruntime_mlas - debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES}) + ${onnxruntime_EXTERNAL_LIBRARIES}) set_property(TARGET onnxruntime APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRUNTIME_SO_LINK_FLAG}) set_target_properties(onnxruntime PROPERTIES LINK_DEPENDS ${SYMBOL_FILE}) diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake index ccf59247fd..bc670ed0fb 100644 --- a/cmake/onnxruntime_common.cmake +++ b/cmake/onnxruntime_common.cmake @@ -37,7 +37,7 @@ source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_common_src}) add_library(onnxruntime_common ${onnxruntime_common_src}) -onnxruntime_add_include_to_target(onnxruntime_common gsl date) +onnxruntime_add_include_to_target(onnxruntime_common gsl date_interface) target_include_directories(onnxruntime_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") if(onnxruntime_USE_NSYNC) diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index dd5f27e933..7081edcf2e 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -84,16 +84,19 @@ set(onnxruntime_pybind11_state_dependencies add_dependencies(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_dependencies}) if (MSVC) # if MSVC, pybind11 looks for release version of python lib (pybind11/detail/common.h undefs _DEBUG) - target_link_libraries(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_libs} ${PYTHON_LIBRARY_RELEASE} ${ONNXRUNTIME_SO_LINK_FLAG} debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES}) + target_link_libraries(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_libs} + ${PYTHON_LIBRARY_RELEASE} ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_EXTERNAL_LIBRARIES}) elseif (APPLE) set_target_properties(onnxruntime_pybind11_state PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - target_link_libraries(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_libs} debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES} ${ONNXRUNTIME_SO_LINK_FLAG}) + target_link_libraries(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_libs} ${onnxruntime_EXTERNAL_LIBRARIES} + ${ONNXRUNTIME_SO_LINK_FLAG}) set_target_properties(onnxruntime_pybind11_state PROPERTIES INSTALL_RPATH "@loader_path" BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH FALSE) else() - target_link_libraries(onnxruntime_pybind11_state PRIVATE ${onnxruntime_pybind11_state_libs} ${PYTHON_LIBRARY} ${ONNXRUNTIME_SO_LINK_FLAG} debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES}) + target_link_libraries(onnxruntime_pybind11_state PRIVATE ${onnxruntime_pybind11_state_libs} ${PYTHON_LIBRARY} + ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_EXTERNAL_LIBRARIES}) set_target_properties(onnxruntime_pybind11_state PROPERTIES LINK_FLAGS "-Xlinker -rpath=\$ORIGIN") endif() diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index c25d3fadd7..3914679c4c 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -31,10 +31,9 @@ function(AddTest) if(_UT_DYN) target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest gmock onnxruntime ${CMAKE_DL_LIBS} Threads::Threads) else() - target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest gmock debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} - optimized ${onnxruntime_EXTERNAL_LIBRARIES}) + target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest gmock ${onnxruntime_EXTERNAL_LIBRARIES}) endif() - onnxruntime_add_include_to_target(${_UT_TARGET} gsl eigen) + onnxruntime_add_include_to_target(${_UT_TARGET} date_interface gsl eigen) target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR}) if (WIN32) @@ -404,7 +403,7 @@ set(onnx_test_libs ${ONNXRUNTIME_TEST_LIBS} onnx_test_data_proto) -list(APPEND onnx_test_libs debug ${onnxruntime_EXTERNAL_LIBRARIES_DEBUG} optimized ${onnxruntime_EXTERNAL_LIBRARIES} libprotobuf) # test code uses delimited parsing and hence needs to link with the full protobuf +list(APPEND onnx_test_libs ${onnxruntime_EXTERNAL_LIBRARIES} libprotobuf) # test code uses delimited parsing and hence needs to link with the full protobuf add_executable(onnx_test_runner ${onnx_test_runner_src_dir}/main.cc) target_link_libraries(onnx_test_runner PRIVATE onnx_test_runner_common ${GETOPT_LIB_WIDE} ${onnx_test_libs})