From d7a9389b0b202b225c369bcf96651bd23af8b89f Mon Sep 17 00:00:00 2001 From: Henry LE BERRE Date: Sat, 14 Jan 2023 04:44:05 -0500 Subject: [PATCH] Small fixes --- .gitignore | 60 ++++++---------------------------------- CMakeLists.txt | 20 +++++++++----- toolchain/mfc/build.py | 6 ++-- toolchain/mfc/lock.py | 2 +- toolchain/mfc/run/run.py | 6 ++-- 5 files changed, 28 insertions(+), 66 deletions(-) diff --git a/.gitignore b/.gitignore index 08a6a6584c..d215881f71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,57 +1,25 @@ -tags -src/*/tags +/build/ +.vscode/ +src/*/case.fpp +src/*/autogen/ *.swo *.swp *:Zone.Identifier -.vscode/ .nfs* -defaults.yaml __pycache__ -CMakeFiles/ -CMakeCache.txt -Makefile -cmake_install.cmake - *.egg-info -/build/ -toolchain/build/ - -src/*/*.mod -src/*/*.o -src/*/autogen/ -src/common/case.fpp -src/pre_process/pre_process -src/simulation/simulation -src/post_process/post_process -src/master_scripts/*.pyc -src/*/.build -src/*/case.* -src/master_scripts/__* -make_doc.sh -cases/ .DS_Store -tests/**/*.log -tests/*.txt -tests/*/** -!**/golden.txt - -tests_hypoelastic/*/D/* -tests_hypoelastic/*/p* -tests_hypoelastic/*/D_* -tests_hypoelastic/*/*.inp -tests_hypoelastic/*/*.inf -tests_hypoelastic/*/*.dat -tests_hypoelastic/*/silo* -tests_hypoelastic/*/restart* -tests_hypoelastic/*/*.out -tests_hypoelastic/*/binary +/tests/**/*.log +/tests/*.txt +/tests/*/** +!/tests/golden.txt examples/*batch/*/ examples/*/D/* @@ -69,15 +37,3 @@ examples/*/fort.1 examples/*/pre_process.sh examples/*/simulation.sh examples/*/post_process.sh - -doc/*/MFC_user_guide.bbl -doc/*/MFC_user_guide.blg -doc/*/MFC_user_guide.aux -doc/*/MFC_user_guide.toc -doc/*/MFC_user_guide.fls -doc/*/MFC_user_guide.synctex.gz -doc/*/MFC_user_guide.log -doc/*/MFC_user_guide.fdb_latexmk - -doc/Doxygen/*/html -doc/Doxygen/*icon* diff --git a/CMakeLists.txt b/CMakeLists.txt index 757c082a91..848f26b50d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,19 +32,25 @@ include(CheckFortranCompilerFlag) # === Check Compiler Support & Tools # === === Compiler Support +set(__err_msg "\ +CMake detected the ${CMAKE_Fortran_COMPILER_ID} Fortran compiler \ +v${CMAKE_Fortran_COMPILER_VERSION}. If you intended to use a different \ +compiler (or a different version thereof), please:\n\ + - Install the compiler or load its module. (e.g. module load gcc/10.1)\n\ + - Set/Export the C, CXX, and FC environment variables. (e.g. 'export CC=gcc', \ + 'export CXX=g++', and 'export FC=gfortran'.\n\ + - If using mfc.sh, delete the build/ directory and try again. (e.g. 'rm -rf build/pre_process')\n") + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5) - message(FATAL_ERROR "GNU v5.0 or newer is required to build MFC. " - "[current: ${CMAKE_Fortran_COMPILER_VERSION}]") + message(FATAL_ERROR "${__err_msg}ERROR: GNU v5.0 or newer is required to build MFC.") endif() elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")) if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7) - message(FATAL_ERROR "NVHPC v21.7 or newer is required to build MFC. " - "[current: ${CMAKE_Fortran_COMPILER_VERSION}]") + message(FATAL_ERROR "${__err_msg}ERROR: NVHPC v21.7 or newer is required to build MFC.") endif() -elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang") - message(FATAL_ERROR "MFC does not support the Apple Clang compilers. " - "Please consult the README for more details.") +elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") + message(FATAL_ERROR "${__err_msg}ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation.") endif() # === === Find Fypp diff --git a/toolchain/mfc/build.py b/toolchain/mfc/build.py index f171f060f3..34ceb5472e 100644 --- a/toolchain/mfc/build.py +++ b/toolchain/mfc/build.py @@ -187,10 +187,10 @@ def build_target(name: str, history: typing.List[str] = None): common.create_directory(build_dirpath) if common.system(configure, no_exception=True) != 0: - raise common.MFCException("Failed to configure the [bold magenta]{name}[/bold magenta] target.") + raise common.MFCException(f"Failed to configure the [bold magenta]{name}[/bold magenta] target.") - common.system(build, exception_text="Failed to build the [bold magenta]{name}[/bold magenta] target.") - common.system(install, exception_text="Failed to install the [bold magenta]{name}[/bold magenta] target.") + common.system(build, exception_text=f"Failed to build the [bold magenta]{name}[/bold magenta] target.") + common.system(install, exception_text=f"Failed to install the [bold magenta]{name}[/bold magenta] target.") cons.print(no_indent=True) cons.unindent() diff --git a/toolchain/mfc/lock.py b/toolchain/mfc/lock.py index b43ee5500a..21209b99fc 100644 --- a/toolchain/mfc/lock.py +++ b/toolchain/mfc/lock.py @@ -69,7 +69,7 @@ def switch(to: MFCConfig): state.gCFG = to write() - for target_name in build.get_target_names(): + for target_name in build.get_mfc_target_names(): dirpath = build.get_build_dirpath(build.get_target(target_name)) cons.print(f"[bold red]Removing {os.path.relpath(dirpath)}[/bold red]") common.delete_directory(dirpath) diff --git a/toolchain/mfc/run/run.py b/toolchain/mfc/run/run.py index 7139d35226..f072e033f8 100644 --- a/toolchain/mfc/run/run.py +++ b/toolchain/mfc/run/run.py @@ -20,9 +20,7 @@ def validate_job_options() -> None: raise common.MFCException(f'RUN: {ARG("email")} is not a valid e-mail address.') -def run_targets(targets: typing.List[str]): - build.build_targets(targets) - +def run_targets(targets: typing.List[str]): cons.print("[bold]Run[/bold]") cons.indent() @@ -51,6 +49,8 @@ def run_targets(targets: typing.List[str]): for name in ARG("targets"): input_file.generate(name) + build.build_targets(targets) + engine.run(ARG("targets"))