mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
Makefile: Ignore cuda files if NVCC is not set
svn-origin-rev: 13714
This commit is contained in:
parent
120d8feebc
commit
432e70051c
2 changed files with 17 additions and 4 deletions
|
|
@ -34,10 +34,13 @@ MODDEPS = "lower"
|
|||
include $(CP2KHOME)/arch/$(ARCH).$(ONEVERSION)
|
||||
LIBDIR := $(MAINLIBDIR)/$(ARCH)/$(ONEVERSION)
|
||||
OBJDIR := $(MAINOBJDIR)/$(ARCH)/$(ONEVERSION)
|
||||
ifeq ($(NVCC),)
|
||||
DISCOVER_FLAGS = "--ignore-cuda-files"
|
||||
endif
|
||||
endif
|
||||
|
||||
# Discover programs =========================================================
|
||||
ALL_EXE_FILES = $(sort $(shell $(TOOLSRC)/discover_programs.py $(SRCDIR)))
|
||||
ALL_EXE_FILES = $(sort $(shell $(TOOLSRC)/discover_programs.py $(SRCDIR) $(DISCOVER_FLAGS) ))
|
||||
EXE_NAMES = $(basename $(notdir $(ALL_EXE_FILES)))
|
||||
|
||||
# Declare PHONY targets =====================================================
|
||||
|
|
|
|||
|
|
@ -10,12 +10,17 @@ re_main = re.compile(r"\sint\s+main\s*\(")
|
|||
|
||||
#============================================================================
|
||||
def main():
|
||||
if(len(sys.argv) < 2):
|
||||
print("Usage: discover_programs.py <src-dir>")
|
||||
if(len(sys.argv) not in (2,3)):
|
||||
print("Usage: discover_programs.py <src-dir> [--ignore-cuda-files]")
|
||||
sys.exit(1)
|
||||
|
||||
srcdir = sys.argv[1]
|
||||
|
||||
ignore_cu_files = False
|
||||
if(len(sys.argv) > 2):
|
||||
assert(sys.argv[2] == "--ignore-cuda-files")
|
||||
ignore_cu_files = True
|
||||
|
||||
programs = []
|
||||
for root, dirs, files in os.walk(srcdir):
|
||||
if(root.endswith("/preprettify")):
|
||||
|
|
@ -29,10 +34,15 @@ def main():
|
|||
if(is_fortran_program(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
elif(fn[-2:]==".c" or fn[-3:]==".cu"):
|
||||
elif(fn[-2:] == ".c"):
|
||||
if(has_main_function(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
elif(fn[-3:] == ".cu" and not ignore_cu_files):
|
||||
if(has_main_function(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
|
||||
print(" ".join(programs))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue