Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC Ninja fixes #6964

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion 3rdparty/boringssl/boringssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ ExternalProject_Add(
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ""
BUILD_BYPRODUCTS
<SOURCE_DIR>/$<$<BOOL:${WIN32}>:$<IF:$<CONFIG:Debug>,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX}
<SOURCE_DIR>/$<$<BOOL:${WIN32}>:$<IF:$<CONFIG:Debug>,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_boringssl SOURCE_DIR)
Expand Down
7 changes: 5 additions & 2 deletions 3rdparty/curl/curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ if(BUILD_CURL_FROM_SOURCE)
${ExternalProject_CMAKE_ARGS_hidden}
BUILD_BYPRODUCTS
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_curl INSTALL_DIR)
set(CURL_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(CURL_LIB_DIR ${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR})
if(MSVC)
if(MSVC AND ${CMAKE_GENERATOR} MATCHES "^Visual Studio.*")
set(CURL_LIBRARIES ${curl_lib_name}$<$<CONFIG:Debug>:-d>)
else()
set(CURL_LIBRARIES ${curl_lib_name})
Expand All @@ -79,7 +80,9 @@ else()
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ""
BUILD_BYPRODUCTS
<SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}
<SOURCE_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX}
)

ExternalProject_Get_Property(ext_curl SOURCE_DIR)
Expand Down
6 changes: 5 additions & 1 deletion 3rdparty/fmt/fmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ ExternalProject_Add(
ExternalProject_Get_Property(ext_fmt INSTALL_DIR)
set(FMT_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(FMT_LIB_DIR ${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR})
set(FMT_LIBRARIES ${FMT_LIB_NAME}$<$<PLATFORM_ID:Windows>:$<$<CONFIG:Debug>:d>>)
if (MSVC AND ${CMAKE_GENERATOR} MATCHES "^Visual Studio.*")
set(FMT_LIBRARIES ${FMT_LIB_NAME}$<$<CONFIG:Debug>:d>)
else()
set(FMT_LIBRARIES ${FMT_LIB_NAME})
endif()
28 changes: 18 additions & 10 deletions 3rdparty/ipp/ipp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ else()
set(IPP_SUBPATH "")
endif()

# Threading layer libs must be linked first.
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html
# Library dependency order:
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html
if (WIN32)
set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt)
else()
set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore)
endif()

foreach(item IN LISTS IPP_LIBRARIES)
list(APPEND IPP_BUILD_BYPRODUCTS <SOURCE_DIR>/${IPP_SUBPATH}lib/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX})
endforeach()

ExternalProject_Add(ext_ipp
PREFIX ipp
URL ${IPP_URL}
Expand All @@ -45,16 +59,10 @@ ExternalProject_Add(ext_ipp
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
BUILD_BYPRODUCTS
${IPP_BUILD_BYPRODUCTS}
)

ExternalProject_Get_Property(ext_ipp SOURCE_DIR)
set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/")
# Threading layer libs must be linked first.
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html
# Library dependency order:
# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html
if (WIN32)
set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt)
else()
set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore)
endif()
set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib")
6 changes: 5 additions & 1 deletion 3rdparty/libpng/libpng.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ ExternalProject_Add(
ExternalProject_Get_Property(ext_libpng INSTALL_DIR)
set(LIBPNG_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(LIBPNG_LIB_DIR ${INSTALL_DIR}/${Open3D_INSTALL_LIB_DIR})
set(LIBPNG_LIBRARIES ${LIBPNG_LIB_NAME}$<$<PLATFORM_ID:Windows>:$<$<CONFIG:Debug>:d>>)
if(MSVC AND ${CMAKE_GENERATOR} MATCHES "^Visual Studio.*")
set(LIBPNG_LIBRARIES ${LIBPNG_LIB_NAME}$<$<CONFIG:Debug>:d>)
else()
set(LIBPNG_LIBRARIES ${LIBPNG_LIB_NAME})
endif()
2 changes: 1 addition & 1 deletion 3rdparty/uvatlas/uvatlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ExternalProject_Add(
-Ddirectxmath_DIR=<INSTALL_DIR>
DEPENDS ext_directxheaders ext_directxmath
BUILD_BYPRODUCTS
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}uvatlas${CMAKE_STATIC_LIBRARY_SUFFIX}
<INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}UVAtlas${CMAKE_STATIC_LIBRARY_SUFFIX}
)


Expand Down
15 changes: 10 additions & 5 deletions 3rdparty/vtk/vtk_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ set(VTK_LIBRARIES
vtksys-${VTK_VERSION}${VTK_LIB_SUFFIX}
)

foreach(item IN LISTS VTK_LIBRARIES)
list(APPEND VTK_BUILD_BYPRODUCTS <INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX})
endforeach()


if(BUILD_VTK_FROM_SOURCE)

foreach(item IN LISTS VTK_LIBRARIES)
list(APPEND VTK_BUILD_BYPRODUCTS <INSTALL_DIR>/${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX})
endforeach()

ExternalProject_Add(
ext_vtk
PREFIX vtk
Expand Down Expand Up @@ -294,6 +294,10 @@ if(BUILD_VTK_FROM_SOURCE)

else() #### download prebuilt vtk

foreach(item IN LISTS VTK_LIBRARIES)
list(APPEND VTK_BUILD_BYPRODUCTS <SOURCE_DIR>/lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX})
endforeach()

if(LINUX_AARCH64)
message(FATAL "No precompiled vtk for platform. Enable BUILD_VTK_FROM_SOURCE")
elseif(APPLE_AARCH64)
Expand Down Expand Up @@ -334,7 +338,8 @@ else() #### download prebuilt vtk
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ""
BUILD_BYPRODUCTS
${VTK_BUILD_BYPRODUCTS}
)

ExternalProject_Get_Property(ext_vtk SOURCE_DIR)
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/zeromq/zeromq_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ ExternalProject_Add(
)

if(WIN32)
# On windows the lib name is more complicated
set(ZEROMQ_LIBRARIES ${lib_name}$<$<CONFIG:Debug>:gd>${lib_suffix})

# On windows we need to link some additional libs. We will use them
# directly as targets in find_dependencies.cmake.
# The following code is taken from the zeromq CMakeLists.txt and collects
Expand All @@ -95,6 +92,9 @@ if(WIN32)
if(HAVE_IPHLPAPI)
list(APPEND ZEROMQ_ADDITIONAL_LIBS iphlpapi)
endif()
endif()
if(MSVC AND ${CMAKE_GENERATOR} MATCHES "^Visual Studio.*")
set(ZEROMQ_LIBRARIES ${lib_name}$<$<CONFIG:Debug>:gd>${lib_suffix})
else()
set(ZEROMQ_LIBRARIES ${lib_name}${lib_suffix})
endif()
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/zlib/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ExternalProject_Add(
ExternalProject_Get_Property(ext_zlib INSTALL_DIR)
set(ZLIB_INCLUDE_DIRS ${INSTALL_DIR}/include/) # "/" is critical.
set(ZLIB_LIB_DIR ${INSTALL_DIR}/lib)
if(MSVC)
if(MSVC AND ${CMAKE_GENERATOR} MATCHES "^Visual Studio.*")
set(ZLIB_LIBRARIES ${lib_name}$<$<CONFIG:Debug>:d>)
else()
set(ZLIB_LIBRARIES ${lib_name})
Expand Down
5 changes: 4 additions & 1 deletion cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ open3d_show_and_abort_on_warning(tests)
open3d_set_global_properties(tests)
# On Windows, running tests from the build folder needs tbb.dll to be in the same folder.
if (WIN32)
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
message(STATUS "GENERATOR_IS_MULTI_CONFIG: ${IS_MULTI_CONFIG}")
add_custom_command(
TARGET tests
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:tbb> "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/"
COMMAND echo "RUNTIME_OUTPUT_DIRECTORY: $<TARGET_PROPERTY:tests,RUNTIME_OUTPUT_DIRECTORY>/$<$<BOOL:${IS_MULTI_CONFIG}>:$<CONFIG>>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:TBB::tbb> $<TARGET_PROPERTY:tests,RUNTIME_OUTPUT_DIRECTORY>/$<$<BOOL:${IS_MULTI_CONFIG}>:$<CONFIG>>
)
endif()

Expand Down
Loading