Skip to content

Commit

Permalink
Windows fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Nov 30, 2020
1 parent 2764e9d commit 3138f2e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
15 changes: 9 additions & 6 deletions cmake/package_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions third_party/CudaArchitectureSelector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
message(STATUS "Configuring and building CAS")
ginkgo_load_git_package(CudaArchitectureSelector
"https://github.com/ginkgo-project/CudaArchitectureSelector.git"
"cba91d58e9bb847e572fedf8cc18f701ae035410")
Expand Down
1 change: 1 addition & 0 deletions third_party/gflags/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions third_party/git-cmake-format/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions third_party/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 15 additions & 13 deletions third_party/hwloc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
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"
)

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()
1 change: 1 addition & 0 deletions third_party/rapidjson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
message(STATUS "Configuring and building rapidjson")
ginkgo_load_git_package(rapidjson_external
"https://github.com/Tencent/rapidjson.git"
"88bd956d66d348f478bceebfdadb8e26c6844695"
Expand Down

0 comments on commit 3138f2e

Please sign in to comment.