Skip to content

Commit

Permalink
add -Dlocal= option to allow offline install
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 19, 2022
1 parent 709d82a commit 79319c0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.1.0
2.2.1.1
2 changes: 1 addition & 1 deletion cmake/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"git": "https://github.com/scivision/lapack.git",
"tag": "v3.10.1.3"
},
"scalapack": {
"scalapack_src": {
"tag": "v2.2.1",
"url": "https://github.com/Reference-ScaLAPACK/scalapack.git"
}
Expand Down
15 changes: 12 additions & 3 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION}")
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} Toolchain ${CMAKE_TOOLCHAIN_FILE}")

# default build all
if(NOT DEFINED arith)
if(local)
get_filename_component(local ${local} ABSOLUTE)

if(NOT IS_DIRECTORY ${local})
message(FATAL_ERROR "Local directory ${local} does not exist")
endif()
endif()

# --- other options

if(NOT arith)
set(arith "s;d")
endif()

Expand Down
40 changes: 32 additions & 8 deletions cmake/scalapack_src.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
include(FetchContent)

string(TOLOWER ${PROJECT_NAME}_src name)

file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)

if(local)

find_file(${name}_archive
NAMES ${name}.tar.bz2 ${name}.tar.gz ${name}.tar ${name}.zip ${name}.zstd ${name}.tar.xz
HINTS ${local}
NO_DEFAULT_PATH
)

if(NOT ${name}_archive)
message(FATAL_ERROR "Archive file for ${name} does not exist under ${local}")
endif()

message(STATUS "${name}: using source archive ${${name}_archive}")

FetchContent_Declare(${PROJECT_NAME}
URL ${${name}_archive}
)

else()

if(CMAKE_VERSION VERSION_LESS 3.19)
include(${CMAKE_CURRENT_LIST_DIR}/Modules/JsonParse.cmake)
sbeParseJson(meta json)
set(scalapack_url ${meta.scalapack.url})
set(scalapack_tag ${meta.scalapack.tag})
set(url ${meta.${name}.url})
set(tag ${meta.${name}.tag})
else()
string(JSON scalapack_url GET ${json} scalapack url)
string(JSON scalapack_tag GET ${json} scalapack tag)
string(JSON url GET ${json} ${name} url)
string(JSON tag GET ${json} ${name} tag)
endif()

set(FETCHCONTENT_QUIET no)

FetchContent_Declare(SCALAPACK
GIT_REPOSITORY ${scalapack_url}
GIT_TAG ${scalapack_tag}
FetchContent_Declare(${PROJECT_NAME}
GIT_REPOSITORY ${url}
GIT_TAG ${tag}
GIT_SHALLOW true
INACTIVITY_TIMEOUT 60
TLS_VERIFY true
)

FetchContent_Populate(SCALAPACK)
endif()

FetchContent_Populate(${PROJECT_NAME})

0 comments on commit 79319c0

Please sign in to comment.