auto extract PETSC_DIR from env

This commit is contained in:
Chen Zhang 2016-04-18 18:32:08 -04:00
parent a7c4cdaa2f
commit 247a6e36c3
3 changed files with 24 additions and 27 deletions

View File

@ -6,10 +6,12 @@ cmake_minimum_required (VERSION 2.8.0 FATAL_ERROR)
# //The rest of the script relies on it to figure out relative position # //The rest of the script relies on it to figure out relative position
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
# Find PETSc because the entire build will rely on it # Find PETSc from environment
if (NOT DEFINED PETSC_DIR) set(PETSC_DIR $ENV{PETSC_DIR})
message (FATAL_ERROR "PETSC_DIR is not found!")
endif (NOT DEFINED PETSC_DIR) # if (NOT DEFINED PETSC_DIR)
# message (FATAL_ERROR "PETSC_DIR is not found!")
# endif (NOT DEFINED PETSC_DIR)
exec_program(mktemp ARGS -d OUTPUT_VARIABLE PETSC_TEMP) exec_program(mktemp ARGS -d OUTPUT_VARIABLE PETSC_TEMP)
@ -428,16 +430,16 @@ set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${CMAKE_Fortr
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS}" ) set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS}" )
# Finalizing, adding PREFIX and SUFFIX to compiler chain # Finalizing, adding PREFIX and SUFFIX to compiler chain
set (CMAKE_Fortran_FLAGS_RELEASE "${DAMASK_PREFIX} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${DAMASK_SUFFIX}") set (CMAKE_Fortran_FLAGS_RELEASE "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
set (CMAKE_Fortran_FLAGS_DEBUG "${DAMASK_PREFIX} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${DAMASK_SUFFIX}") set (CMAKE_Fortran_FLAGS_DEBUG "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
set (CMAKE_LINKER "${PETSC_LINKER}") set (CMAKE_LINKER "${PETSC_LINKER}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
set (CMAKE_Fortran_LINK_EXECUTABLE set (CMAKE_Fortran_LINK_EXECUTABLE
"${DAMASK_PREFIX} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${DAMASK_SUFFIX}") "${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
set (CMAKE_Fortran_LINK_EXECUTABLE set (CMAKE_Fortran_LINK_EXECUTABLE
"${DAMASK_PREFIX} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${DAMASK_SUFFIX}") "${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
message("***COMPILE FLAGS:\n${CMAKE_Fortran_FLAGS_RELEASE}\n") message("***COMPILE FLAGS:\n${CMAKE_Fortran_FLAGS_RELEASE}\n")

View File

@ -3,11 +3,15 @@ SHELL = /bin/sh
# Makefile for the installation of DAMASK # Makefile for the installation of DAMASK
######################################################################################## ########################################################################################
.PHONY: all .PHONY: all
all: spectral marc processing all: spectral FEM
.PHONY: spectral
spectral: spectral: build
$(MAKE) DAMASK_spectral.exe -C src @if [ ! -d build/spectral ]; then mkdir build/spectral; fi
(cd build/spectral; cmake ../../ ;)
build:
mkdir build
.PHONY: FEM .PHONY: FEM
FEM: FEM:
@ -32,11 +36,7 @@ tidy:
@$(MAKE) tidy -C src >/dev/null @$(MAKE) tidy -C src >/dev/null
.PHONY: clean .PHONY: clean
clean: clean:
@$(MAKE) cleanDAMASK -C src >/dev/null rm -rvf build
.PHONY: install
install:
@./installation/symlink_Code.py ${MAKEFLAGS}
@./installation/symlink_Processing.py ${MAKEFLAGS}

View File

@ -11,7 +11,6 @@ else
DAMASK_ROOT=${STAT##* } DAMASK_ROOT=${STAT##* }
fi fi
DAMASKVERSION=$(cat VERSION)
BUILDROOT=$DAMASK_ROOT/build BUILDROOT=$DAMASK_ROOT/build
BUILDDIR=spectral BUILDDIR=spectral
@ -34,7 +33,6 @@ cd $BUILDDIR
## ##
# CMake call # CMake call
# PETSC_DIR | PETSC directory # PETSC_DIR | PETSC directory
# DAMASK_V | DAMASK current revision
# CMAKE_BUILD_TYPE | Default set to release (no debugging output) # CMAKE_BUILD_TYPE | Default set to release (no debugging output)
# CMAKE_VERBOSE_MAKEFILE | [ON/OFF] toggle makefile verbose output # CMAKE_VERBOSE_MAKEFILE | [ON/OFF] toggle makefile verbose output
# OPENMP | [ON/OFF] # OPENMP | [ON/OFF]
@ -45,7 +43,6 @@ cd $BUILDDIR
# BUILDCMD_POST | Compiler suffix, # BUILDCMD_POST | Compiler suffix,
# | e.g. DAMASK_SUFFIX="-Wl,--verbose" # | e.g. DAMASK_SUFFIX="-Wl,--verbose"
cmake -D PETSC_DIR=${PETSC_DIR} \ cmake -D PETSC_DIR=${PETSC_DIR} \
-D DAMASK_V=${DAMASKVERSION} \
-D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_VERBOSE_MAKEFILE=OFF \ -D CMAKE_VERBOSE_MAKEFILE=OFF \
-D OPENMP=ON \ -D OPENMP=ON \
@ -56,8 +53,6 @@ cmake -D PETSC_DIR=${PETSC_DIR} \
-D BUILDCMD_POST="-Wl,--verbose" \ -D BUILDCMD_POST="-Wl,--verbose" \
../.. ../..
echo echo "Start compiling DAMASK_spectral"
echo "Please move to the build directory using" make
echo " cd build/spectral" make install
echo "Using the following command to build DAMASK spectral solver"
echo " make clean all install"