-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cache entries for external library (#169)
- Fetched external libraries are now cached in .cache - Cache entry todo for pybind11
- Loading branch information
Showing
13 changed files
with
104 additions
and
101 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_QUIET FALSE) | ||
|
||
FetchContent_Declare( | ||
application | ||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
URL https://github.com/chengcli/application/archive/refs/tags/v0.7.tar.gz) | ||
|
||
FetchContent_MakeAvailable(application) | ||
|
||
include_directories(${application_SOURCE_DIR}) | ||
set(PACKAGE_NAME application) | ||
set(REPO_URL "https://github.com/chengcli/application") | ||
set(REPO_TAG "v0.7") | ||
add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_QUIET TRUE) | ||
|
||
FetchContent_Declare( | ||
gtest | ||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
URL https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz) | ||
|
||
set(PACKAGE_NAME gtest) | ||
set(REPO_URL "https://github.com/google/googletest") | ||
set(REPO_TAG "v1.13.0") | ||
set(INSTALL_GTEST OFF) | ||
FetchContent_MakeAvailable(gtest) | ||
|
||
add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
macro(add_package_noinclude name url tag patch option) | ||
string(ASCII 27 Esc) | ||
set(ColorReset "${Esc}[m") | ||
set(Yellow "${Esc}[33m") | ||
|
||
set(CACHE_DIR "${CMAKE_SOURCE_DIR}/.cache") | ||
set(CACHE_FILE "${CACHE_DIR}/${name}-${tag}.tar.gz") | ||
|
||
string(TOUPPER ${name} nameu) | ||
option(${nameu} "Build ${name}" ${option}) | ||
|
||
if(${${nameu}}) | ||
if(EXISTS ${CACHE_FILE}) | ||
if(NOT EXISTS ${CMAKE_BINARY_DIR}/_deps) | ||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps) | ||
endif() | ||
|
||
message( | ||
STATUS | ||
"${Yellow}Using cached library ${name}-${tag}.tar.gz${ColorReset}") | ||
|
||
FetchContent_Declare(${name} DOWNLOAD_COMMAND tar -xzf ${CACHE_FILE} -C | ||
${CMAKE_BINARY_DIR}/_deps) | ||
else() | ||
FetchContent_Declare( | ||
${name} | ||
GIT_REPOSITORY ${url} | ||
GIT_TAG ${tag} | ||
PATCH_COMMAND ${patch} | ||
UPDATE_DISCONNECTED TRUE) | ||
endif() | ||
|
||
FetchContent_MakeAvailable(${name}) | ||
|
||
if(NOT EXISTS ${CACHE_FILE}) | ||
message( | ||
STATUS | ||
"${Yellow}Creating cached library ${name}-${tag}.tar.gz${ColorReset}") | ||
execute_process(COMMAND tar -czf ${CACHE_DIR}/${name}-${tag}.tar.gz -C | ||
${CMAKE_BINARY_DIR}/_deps ${name}-src) | ||
endif() | ||
else() | ||
message(STATUS "${Yellow}Not building ${name}${ColorReset}") | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_QUIET FALSE) | ||
|
||
option(MINICHEM "Build minichem" OFF) | ||
|
||
if(MINICHEM) | ||
FetchContent_Declare( | ||
minichem | ||
GIT_REPOSITORY https://github.com/chengcli/mini_chem | ||
GIT_TAG main) | ||
FetchContent_MakeAvailable(minichem) | ||
|
||
include_directories(${minichem_SOURCE_DIR}) | ||
endif() | ||
|
||
set(PACKAGE_NAME minichem) | ||
set(REPO_URL "https://github.com/chengcli/mini_chem") | ||
set(REPO_TAG "3372a500f038f83228c9f8f944b3fb6b2dedc572") | ||
add_package(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" OFF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_QUIET FALSE) | ||
|
||
option(PYTHON_BINDINGS "Build Python Bindings" OFF) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,10 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_QUIET FALSE) | ||
|
||
macro(set_if_empty _variable) | ||
if("${${_variable}}" STREQUAL "") | ||
set(${_variable} ${ARGN}) | ||
endif() | ||
endmacro() | ||
|
||
set_if_empty(ACCOUNT $ENV{GH_ACCOUNT}) | ||
set_if_empty(TOKEN $ENV{GH_TOKEN}) | ||
|
||
option(RFM "Build RFM" OFF) | ||
|
||
if(RFM) | ||
FetchContent_Declare( | ||
rfm | ||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
URL https://${ACCOUNT}:${TOKEN}@github.com/luminoctum/rfm/archive/refs/tags/v5.20.2.tar.gz | ||
) | ||
|
||
FetchContent_MakeAvailable(rfm) | ||
endif() | ||
set(PACKAGE_NAME rfm) | ||
set(REPO_URL "https://${ACCOUNT}:${TOKEN}@github.com/luminoctum/rfm") | ||
set(REPO_TAG "v5.20.2") | ||
add_package_noinclude(${PACKAGE_NAME} ${REPO_URL} ${REPO_TAG} "" OFF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters