From 3138f2e356aea7dc8916c96a5bf9974c2e8602d8 Mon Sep 17 00:00:00 2001 From: Pratik Nayak Date: Mon, 30 Nov 2020 15:12:14 +0100 Subject: [PATCH] Windows fix. --- cmake/package_helpers.cmake | 15 ++++++---- .../CudaArchitectureSelector/CMakeLists.txt | 1 + third_party/gflags/CMakeLists.txt | 1 + third_party/git-cmake-format/CMakeLists.txt | 1 + third_party/gtest/CMakeLists.txt | 1 + third_party/hwloc/CMakeLists.txt | 28 ++++++++++--------- third_party/rapidjson/CMakeLists.txt | 1 + 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/cmake/package_helpers.cmake b/cmake/package_helpers.cmake index b812464ad07..b9f7ddbb814 100644 --- a/cmake/package_helpers.cmake +++ b/cmake/package_helpers.cmake @@ -219,10 +219,13 @@ endmacro(ginkgo_find_package) # \param hash Extra specifications for the package finder # function(ginkgo_download_file url filename hash_type hash) - if(NOT EXISTS ${filename}) - file(DOWNLOAD ${url} ${filename} - TIMEOUT 60 # seconds - EXPECTED_HASH ${hash_type}=${hash} - TLS_VERIFY ON) - endif() + file(DOWNLOAD ${url} ${filename} + TIMEOUT 60 # seconds + EXPECTED_HASH "${hash_type}=${hash}" + TLS_VERIFY ON) + if(EXISTS ${filename}) + message(STATUS "${filename} downloaded from ${url}") + else() + message(ERROR "Download of ${filename} failed.") + endif() endfunction(ginkgo_download_file) diff --git a/third_party/CudaArchitectureSelector/CMakeLists.txt b/third_party/CudaArchitectureSelector/CMakeLists.txt index 03fdd72e485..e4d53a76a56 100644 --- a/third_party/CudaArchitectureSelector/CMakeLists.txt +++ b/third_party/CudaArchitectureSelector/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "Configuring and building CAS") ginkgo_load_git_package(CudaArchitectureSelector "https://github.com/ginkgo-project/CudaArchitectureSelector.git" "cba91d58e9bb847e572fedf8cc18f701ae035410") diff --git a/third_party/gflags/CMakeLists.txt b/third_party/gflags/CMakeLists.txt index 20c921241c3..44618b89228 100644 --- a/third_party/gflags/CMakeLists.txt +++ b/third_party/gflags/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "Configuring and building gflags") if(MSVC) # cmake links dynamic runtime libraries by default in Visual Studio # use the ginkgo's flags to use the same runtime libraries as ginkgo diff --git a/third_party/git-cmake-format/CMakeLists.txt b/third_party/git-cmake-format/CMakeLists.txt index b8e3d623050..ad709c14152 100644 --- a/third_party/git-cmake-format/CMakeLists.txt +++ b/third_party/git-cmake-format/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "Configuring and building git-cmake-format") ginkgo_load_git_package(git-cmake-format "https://github.com/ginkgo-project/git-cmake-format.git" "29c23665d624e1cae1308bec651706fdaa8fe38b" diff --git a/third_party/gtest/CMakeLists.txt b/third_party/gtest/CMakeLists.txt index 9d13c970cc7..31da9c5eda3 100644 --- a/third_party/gtest/CMakeLists.txt +++ b/third_party/gtest/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "Configuring and building gtest") if(MSVC) # Force using shared runtime library when MSVC builds shared libraries ginkgo_load_git_package(gtest_external diff --git a/third_party/hwloc/CMakeLists.txt b/third_party/hwloc/CMakeLists.txt index a77af05a46e..ffa970ddc42 100644 --- a/third_party/hwloc/CMakeLists.txt +++ b/third_party/hwloc/CMakeLists.txt @@ -1,19 +1,21 @@ message(STATUS "Configuring and building HWLOC") -if(WIN32) +if(MSVC OR WIN32) + message(STATUS "Downloading HWLOC binaries for win32") ginkgo_download_file("https://download.open-mpi.org/release/hwloc/v2.3/hwloc-win32-build-2.3.0.zip" "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip" "SHA1" "1d53dc8db809dd19d8281556f5f3785105aba97f" ) file(ARCHIVE_EXTRACT INPUT "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip") -elseif(WIN64) - ginkgo_download_file("https://download.open-mpi.org/release/hwloc/v2.3/hwloc-win64-build-2.3.0.zip" - "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip" - "SHA1" - "943e0ca50262dcf256b5956c73faded0141e06b9" - ) - file(ARCHIVE_EXTRACT INPUT "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip") +# elseif(WIN64) +# ginkgo_download_file("https://download.open-mpi.org/release/hwloc/v2.3/hwloc-win64-build-2.3.0.zip" +# "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip" +# "SHA1" +# "943e0ca50262dcf256b5956c73faded0141e06b9" +# ) +# file(ARCHIVE_EXTRACT INPUT "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc.zip") else() + message(STATUS "Downloading HWLOC tars and building") ginkgo_load_and_configure_package(hwloc_external "https://download.open-mpi.org/release/hwloc/v2.3/hwloc-2.3.0.tar.gz" "SHA1=69d8e2f088d365cf5e86d04f049c6b1e09e2b9c3" "${CMAKE_BINARY_DIR}/third_party/hwloc/src/configure" @@ -21,14 +23,14 @@ ginkgo_load_and_configure_package(hwloc_external "https://download.open-mpi.org/ endif() -if(WIN32 OR WIN64) +if(MSVC OR WIN32) add_library(hwloc STATIC IMPORTED GLOBAL) add_dependencies(hwloc hwloc_external) - set_target_properties(hwloc PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/third_party/hwloc/hwloc/lib/libhwloc.a" ) - set_target_properties(hwloc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/third_party/hwloc/hwloc/include") + set_target_properties(hwloc PROPERTIES IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc/lib/libhwloc.a" ) + set_target_properties(hwloc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_BINARY_DIR}/third_party/hwloc/hwloc/include") else() add_library(hwloc SHARED IMPORTED GLOBAL) add_dependencies(hwloc hwloc_external ) - set_target_properties(hwloc PROPERTIES IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/third_party/hwloc/build/hwloc/.libs/libhwloc.so" ) - set_target_properties(hwloc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/third_party/hwloc/build/include") + set_target_properties(hwloc PROPERTIES IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/third_party/hwloc/build/hwloc/.libs/libhwloc.so" ) + set_target_properties(hwloc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_BINARY_DIR}/third_party/hwloc/build/include") endif() diff --git a/third_party/rapidjson/CMakeLists.txt b/third_party/rapidjson/CMakeLists.txt index bd2ae7899b1..58118263a18 100644 --- a/third_party/rapidjson/CMakeLists.txt +++ b/third_party/rapidjson/CMakeLists.txt @@ -1,3 +1,4 @@ +message(STATUS "Configuring and building rapidjson") ginkgo_load_git_package(rapidjson_external "https://github.com/Tencent/rapidjson.git" "88bd956d66d348f478bceebfdadb8e26c6844695"