Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkout PyNE submodule as part of CMake #734

Merged
merged 7 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
type: string
docker:
- image: svalinn/dagmc-ci-ubuntu-18.04-housekeeping:latest
auth:
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PASS
working_directory: /root/build_dir/DAGMC
Expand Down Expand Up @@ -36,16 +36,12 @@ jobs:
default: "OFF"
docker:
- image: svalinn/dagmc-ci-ubuntu-<< parameters.img >>-<< parameters.compiler >>-ext-hdf5_<< parameters.hdf5 >>-moab_<< parameters.moab >>:latest
auth:
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PASS
working_directory: /root/build_dir/DAGMC
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- run:
name: Setup environment
command: |
Expand All @@ -66,7 +62,7 @@ workflows:
version: 2
pull_request: # Run only for PullRequest
jobs:

- house_keeping:
context: dockerhub
matrix:
Expand Down
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(DAGMC_VERSION ${DAGMC_MAJOR_VERSION}.${DAGMC_MINOR_VERSION}.${DAGMC_PATCH_VE

# Set git SHA1 hash as a compile definition
find_package(Git)
if(GIT_FOUND)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE DAGMC_GIT_SHA_SUCCESS
Expand All @@ -22,6 +22,25 @@ if(GIT_FOUND)
message(WARNING "Could not determine the commit SHA for DAGMC.")
set(DAGMC_GIT_SHA "")
endif()

option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
set(ENV{jobs} "")
execute_process(COMMAND ${GIT_EXECUTABLE} "submodule" "update" "--init" "--recursive"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL 0)
message(FATAL_ERROR "git submodule update --init --recursive failed with \
${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

# Check to see if submodules exist (by checking one)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/pyne/pyne/readme.rst")
message(FATAL_ERROR "The git submodules were not downloaded! GIT_SUBMODULE was \
turned off or failed. Please update submodules and try again.")
endif()

# Make the scripts in the "cmake" directory available to CMake
Expand Down
13 changes: 13 additions & 0 deletions news/PR-0734.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**Added:**

- CMake option to checkout PyNE submodule automatically

**Changed:** None

**Deprecated:** None

**Removed:** None

**Fixed:** None

**Security:** None