Skip to content

Commit

Permalink
simpler dep handling + versions (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan authored Sep 5, 2024
1 parent ad0537d commit 951578d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 64 deletions.
18 changes: 18 additions & 0 deletions res/cmake/dep.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@


function(phare_git_get_or_update name dir url branch)
if (NOT EXISTS ${dir})
execute_process(
COMMAND ${Git} clone ${url} ${dir} -b ${branch} --recursive --depth 1 --shallow-submodules
)
else()
if(devMode)
message("downloading latest ${name} updates")
execute_process(COMMAND ${Git} pull origin ${branch} WORKING_DIRECTORY ${dir})
endif(devMode)
endif()
endfunction(phare_git_get_or_update)

function(phare_github_get_or_update name dir repo branch)
phare_git_get_or_update(${name} ${dir} https://github.com/${repo} ${branch})
endfunction(phare_github_get_or_update)

include("${PHARE_PROJECT_DIR}/res/cmake/dep/cppdict.cmake")
add_subdirectory(subprojects/cppdict)

Expand Down
11 changes: 1 addition & 10 deletions res/cmake/dep/caliper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ if (withCaliper)
set(CALIPER_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/caliper)
set(CALIPER_BIN ${CMAKE_CURRENT_BINARY_DIR}/subprojects/caliper)

if (NOT EXISTS ${CALIPER_SRCDIR})
execute_process(
COMMAND ${Git} clone https://github.com/LLNL/Caliper ${CALIPER_SRCDIR} -b master --recursive --depth 10
)
else()
if(devMode)
message("downloading latest Caliper updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${CALIPER_SRCDIR})
endif(devMode)
endif()
phare_github_get_or_update(Caliper ${CALIPER_SRCDIR} LLNL/Caliper master)

option(CALIPER_OPTION_PREFIX ON)
set(CALIPER_OPTION_PREFIX ON)
Expand Down
12 changes: 2 additions & 10 deletions res/cmake/dep/cppdict.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@


set(CPPDICT_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/cppdict)
set(CPPDICT_VERSION master)
phare_github_get_or_update(cppdict ${CPPDICT_SRCDIR} LaboratoryOfPlasmaPhysics/cppdict ${CPPDICT_VERSION})

if (NOT EXISTS ${CPPDICT_SRCDIR})
execute_process(
COMMAND ${Git} clone https://github.com/LaboratoryOfPlasmaPhysics/cppdict ${CPPDICT_SRCDIR} -b master --recursive --depth 10
)
else()
if(devMode)
message("downloading latest cppdict updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${CPPDICT_SRCDIR})
endif(devMode)
endif()
13 changes: 2 additions & 11 deletions res/cmake/dep/highfive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@ set (PHARE_HAS_HIGHFIVE "0")
if(HighFive)

set (HIGHFIVE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/highfive)
set (HIGHFIVE_VERSION master)

if (NOT EXISTS ${HIGHFIVE_SRC})
execute_process(
COMMAND ${Git} clone https://github.com/BlueBrain/HighFive ${HIGHFIVE_SRC} -b master --depth 1
)

else()
if(devMode)
message("downloading latest HighFive updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${HIGHFIVE_SRC})
endif(devMode)
endif()
phare_github_get_or_update(HighFive ${HIGHFIVE_SRC} BlueBrain/HighFive ${HIGHFIVE_VERSION})

include_directories(
${HIGHFIVE_SRC}/include
Expand Down
14 changes: 1 addition & 13 deletions res/cmake/dep/phlop.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@
if (withPhlop)

set(PHLOP_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/phlop)

if (NOT EXISTS ${PHLOP_SRCDIR})
execute_process(
COMMAND ${Git} clone https://github.com/PhilipDeegan/phlop ${PHLOP_SRCDIR} -b master --recursive --depth 1
)
else()
if(devMode)
message("downloading latest phlop updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${PHLOP_SRCDIR})
endif(devMode)
endif()

phare_github_get_or_update(phlop ${PHLOP_SRCDIR} PhilipDeegan/phlop master)
include_directories(${PHLOP_SRCDIR}/inc)

endif(withPhlop)

12 changes: 2 additions & 10 deletions res/cmake/dep/pybind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,9 @@ function(get_pybind)

message("downloading subproject pybind11")
set(PYBIND11_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/pybind11)
set(PYBIND11_VERSION master)

if (NOT EXISTS ${PYBIND11_SRCDIR})
execute_process(
COMMAND ${Git} clone https://github.com/pybind/pybind11 ${PYBIND11_SRCDIR} --depth 1 -b master
)
else()
if(devMode)
message("downloading latest pybind11 updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${PYBIND11_SRCDIR})
endif(devMode)
endif()
phare_github_get_or_update(pybind11 ${PYBIND11_SRCDIR} pybind/pybind11 ${PYBIND11_VERSION})

add_subdirectory(${PYBIND11_SRCDIR})

Expand Down
12 changes: 2 additions & 10 deletions res/cmake/dep/samrai.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ if (NOT SAMRAI_FOUND)
if(DEFINED SAMRAI_ROOT)
find_package(SAMRAI PATHS ${SAMRAI_ROOT} REQUIRED)
else()
set(SAMRAI_VERSION develop)
set(SAMRAI_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/samrai)
set(SAMRAI_BIN ${CMAKE_CURRENT_BINARY_DIR}/subprojects/samrai)

if (NOT EXISTS ${SAMRAI_SRCDIR})
execute_process(
COMMAND ${Git} clone https://github.com/LLNL/SAMRAI ${SAMRAI_SRCDIR} -b develop --recursive --depth 10
)
else()
if(devMode)
message("downloading latest SAMRAI updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${SAMRAI_SRCDIR})
endif(devMode)
endif()
phare_github_get_or_update(SAMRAI ${SAMRAI_SRCDIR} LLNL/SAMRAI ${SAMRAI_VERSION})

if (NOT CMAKE_BUILD_TYPE STREQUAL "Release")
# enable samrai assertions if not in release mode
Expand Down

0 comments on commit 951578d

Please sign in to comment.