Skip to content

Commit

Permalink
Use truthy detection for optional dependencies. Refs neams-th-coe#569
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilnovak committed Feb 7, 2023
1 parent ba7440b commit 869fed0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ endif
HDF5_INCLUDE_DIR ?= $(HDF5_ROOT)/include
HDF5_LIBDIR ?= $(HDF5_ROOT)/lib

# convert ENABLE_NEK, ENABLE_OPENMC, and ENABLE_DAGMC to consistent truthy value
ifeq ($(ENABLE_OPENMC),$(filter $(ENABLE_OPENMC), true yes on 1 TRUE YES ON))
ENABLE_OPENMC := yes
endif
ifeq ($(ENABLE_NEK),$(filter $(ENABLE_NEK), true yes on 1 TRUE YES ON))
ENABLE_NEK := yes
endif
ifeq ($(ENABLE_DAGMC),$(filter $(ENABLE_DAGMC), true yes on 1 TRUE YES ON))
ENABLE_DAGMC := yes
endif

ifeq ($(ENABLE_OPENMC), yes)
# HDF5 is only needed to be linked if using OpenMC
$(info Cardinal is using HDF5 from $(HDF5_ROOT))
Expand Down
8 changes: 4 additions & 4 deletions config/check_deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif

ifeq ($(ENABLE_NEK), yes)
ifeq ($(NEKRS_CONTENT),)
$(error $n"NekRS does not seem to be available, but ENABLE_NEK is set to 'yes'. Make sure that the submodule is checked out.$n$nTo fetch the NekRS submodule, use ./scripts/get-dependencies.sh")
$(error $n"NekRS does not seem to be available, but ENABLE_NEK is enabled. Make sure that the submodule is checked out.$n$nTo fetch the NekRS submodule, use ./scripts/get-dependencies.sh")
endif

nek_status := $(shell git -C $(CONTRIB_DIR) submodule status 2>/dev/null | grep nekRS | cut -c1)
Expand All @@ -42,7 +42,7 @@ endif

ifeq ($(ENABLE_OPENMC), yes)
ifeq ($(OPENMC_CONTENT),)
$(error $n"OpenMC does not seem to be available, but ENABLE_OPENMC is set to 'yes'. Make sure that the submodule is checked out.$n$nTo fetch the OpenMC submodule, use ./scripts/get-dependencies.sh")
$(error $n"OpenMC does not seem to be available, but ENABLE_OPENMC is enabled. Make sure that the submodule is checked out.$n$nTo fetch the OpenMC submodule, use ./scripts/get-dependencies.sh")
endif

openmc_status := $(shell git -C $(CONTRIB_DIR) submodule status 2>/dev/null | grep openmc | cut -c1)
Expand All @@ -53,10 +53,10 @@ endif

ifeq ($(ENABLE_DAGMC), yes)
ifeq ($(DAGMC_CONTENT),)
$(error $n"DagMC does not seem to be available, but ENABLE_DAGMC is set to 'yes'. Make sure that the submodule is checked out.$n$nTo fetch the DagMC submodule, use ./scripts/get-dependencies.sh")
$(error $n"DagMC does not seem to be available, but ENABLE_DAGMC is enabled. Make sure that the submodule is checked out.$n$nTo fetch the DagMC submodule, use ./scripts/get-dependencies.sh")
endif
ifeq ($(MOAB_CONTENT),)
$(error $n"Moab does not seem to be available, but ENABLE_DAGMC is set to 'yes'. Make sure that the submodule is checked out.$n$nTo fetch the Moab submodule, use ./scripts/get-dependencies.sh")
$(error $n"Moab does not seem to be available, but ENABLE_DAGMC is enabled. Make sure that the submodule is checked out.$n$nTo fetch the Moab submodule, use ./scripts/get-dependencies.sh")
endif

DAGMC_status := $(shell git -C $(CONTRIB_DIR) submodule status 2>/dev/null | grep DAGMC | cut -c1)
Expand Down

0 comments on commit 869fed0

Please sign in to comment.