Skip to content

Commit

Permalink
deps built via ExternalProject_add use default dir structure of Fetch…
Browse files Browse the repository at this point in the history
…Content (CMAKE_BINARY_DIR/_deps, etc.)
  • Loading branch information
evaleev committed Aug 4, 2021
1 parent ea65d83 commit 51061e9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
10 changes: 5 additions & 5 deletions external/cutt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ else()
enable_language(C)

# set source and build path for cuTT in the TiledArray project
set(EXTERNAL_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/source/cutt)
set(EXTERNAL_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/cutt-src)
# cutt only supports in source build
set(EXTERNAL_BUILD_DIR ${PROJECT_BINARY_DIR}/external/build/cutt)
set(EXTERNAL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/external/cutt)
set(EXTERNAL_BUILD_DIR ${CMAKE_BINARY_DIR}/_deps/cutt-build)
set(EXTERNAL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})

if (NOT CUTT_URL)
set(CUTT_URL https://github.com/ValeevGroup/cutt.git)
Expand Down Expand Up @@ -92,8 +92,8 @@ else()

ExternalProject_Add(cutt
PREFIX ${CMAKE_INSTALL_PREFIX}
STAMP_DIR ${PROJECT_BINARY_DIR}/external/cutt-stamp
TMP_DIR ${PROJECT_BINARY_DIR}/external/tmp
STAMP_DIR ${CMAKE_BINARY_DIR}/_deps/cutt-ep-artifacts
TMP_DIR ${CMAKE_BINARY_DIR}/_deps/cutt-ep-artifacts # needed in case CMAKE_INSTALL_PREFIX is not writable
#--Download step--------------
DOWNLOAD_DIR ${EXTERNAL_SOURCE_DIR}
GIT_REPOSITORY ${CUTT_URL}
Expand Down
6 changes: 2 additions & 4 deletions external/eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ else()
include(ExternalProject)

# Set source and build path for Eigen3 in the TiledArray Project
set(EXTERNAL_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/source/eigen)
set(EXTERNAL_BUILD_DIR ${PROJECT_BINARY_DIR}/external/build/eigen)
set(EXTERNAL_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/eigen-src)
set(EXTERNAL_BUILD_DIR ${CMAKE_BINARY_DIR}/_deps/eigen-build)

message("** Will build Eigen from ${EIGEN3_URL}")

ExternalProject_Add(eigen3
PREFIX ${CMAKE_INSTALL_PREFIX}
STAMP_DIR ${EXTERNAL_BUILD_DIR}/stamp
TMP_DIR ${EXTERNAL_BUILD_DIR}/tmp
#--Download step--------------
DOWNLOAD_DIR ${EXTERNAL_SOURCE_DIR}
URL ${EIGEN3_URL}
Expand Down
16 changes: 8 additions & 8 deletions external/madness.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ else()

# Create a cache entry for MADNESS build variables.
# Note: This will not overwrite user specified values.
set(MADNESS_SOURCE_DIR "${PROJECT_BINARY_DIR}/external/madness-src" CACHE PATH
set(MADNESS_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/madness-src" CACHE PATH
"Path to the MADNESS source directory")
set(MADNESS_BINARY_DIR "${PROJECT_BINARY_DIR}/external/madness-build" CACHE PATH
set(MADNESS_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/madness-build" CACHE PATH
"Path to the MADNESS build directory")
set(MADNESS_URL "https://github.com/m-a-d-n-e-s-s/madness.git" CACHE STRING
"Path to the MADNESS repository")
Expand All @@ -152,16 +152,16 @@ else()
# If the MADNESS source directory is the default location and does not exist,
# MADNESS will be downloaded from git.
message(STATUS "Checking MADNESS source directory: ${MADNESS_SOURCE_DIR}")
if("${MADNESS_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}/external/madness-src")
if("${MADNESS_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}/_deps/madness-src")

# Create the external source directory
if(NOT EXISTS ${PROJECT_BINARY_DIR}/external)
# Create the source directory
if(NOT EXISTS ${CMAKE_BINARY_DIR}/_deps)
set(error_code 1)
execute_process(
COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/external"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/_deps"
RESULT_VARIABLE error_code)
if(error_code)
message(FATAL_ERROR "Failed to create directory \"${PROJECT_BINARY_DIR}/external\"")
message(FATAL_ERROR "Failed to create directory \"${CMAKE_BINARY_DIR}/_deps\"")
endif()
endif()

Expand All @@ -173,7 +173,7 @@ else()
while(error_code AND number_of_tries LESS 3)
execute_process(
COMMAND ${GIT_EXECUTABLE} clone ${MADNESS_URL} madness-src
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps
RESULT_VARIABLE error_code)
math(EXPR number_of_tries "${number_of_tries} + 1")
endwhile()
Expand Down
10 changes: 5 additions & 5 deletions external/umpire.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ else()
enable_language(C)

# set source and build path for Umpire in the TiledArray project
set(EXTERNAL_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/source/Umpire)
set(EXTERNAL_BUILD_DIR ${PROJECT_BINARY_DIR}/external/build/Umpire)
set(EXTERNAL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/external/Umpire)
set(EXTERNAL_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/umpire-src)
set(EXTERNAL_BUILD_DIR ${CMAKE_BINARY_DIR}/_deps/umpire-build)
set(EXTERNAL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})

if (NOT UMPIRE_URL)
set(UMPIRE_URL https://github.com/LLNL/Umpire.git)
Expand Down Expand Up @@ -107,8 +107,8 @@ else()

ExternalProject_Add(Umpire
PREFIX ${CMAKE_INSTALL_PREFIX}
STAMP_DIR ${PROJECT_BINARY_DIR}/external/Umpire-stamp
TMP_DIR ${PROJECT_BINARY_DIR}/external/tmp
STAMP_DIR ${CMAKE_BINARY_DIR}/_deps/umpire-ep-artifacts
TMP_DIR ${CMAKE_BINARY_DIR}/_deps/umpire-ep-artifacts # needed in case CMAKE_INSTALL_PREFIX is not writable
#--Download step--------------
DOWNLOAD_DIR ${EXTERNAL_SOURCE_DIR}
GIT_REPOSITORY ${UMPIRE_URL}
Expand Down

0 comments on commit 51061e9

Please sign in to comment.