trying to fix the subdirectory issue

This commit is contained in:
zhangc43 2016-02-29 13:57:15 -05:00
parent 9d89570ffb
commit e3f82f7629
6 changed files with 84 additions and 106 deletions

View File

@ -79,7 +79,8 @@ endif (DAMASK_DRIVER STREQUAL "SPECTRAL")
# set system include directories # set system include directories
include_directories(${PETSC_DIR}/include include_directories(${CMAKE_SOURCE_DIR}
${PETSC_DIR}/include
lib lib
${HDF5_DIR}/include ${HDF5_DIR}/include
) )
@ -113,7 +114,7 @@ else (OPTIMIZATION STREQUAL "OFF")
set (OPTIMIZATION_gfortran "-O2") set (OPTIMIZATION_gfortran "-O2")
endif (OPTIMIZATION STREQUAL "OFF") endif (OPTIMIZATION STREQUAL "OFF")
set (STANDARD_CHECK_ifort "-stand f08 -standard-semantics") set (STANDARD_CHECK_ifort "-stand none -standard-semantics")
set (STANDARD_CHECK_gfortran "-std=f2008ts -pedantic-errors" ) set (STANDARD_CHECK_gfortran "-std=f2008ts -pedantic-errors" )
################################################################################################### ###################################################################################################
@ -144,7 +145,10 @@ set (STANDARD_CHECK_gfortran "-std=f2008ts -pedantic-errors" )
# all: # all:
# -name as_is: case sensitive Fortran! # -name as_is: case sensitive Fortran!
################################################################################################### ###################################################################################################
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -DDAMASKVERSION=${DAMASK_V}" ) # -diag-disable 7410 should disable warning about directory statement in inquire function,
# but does not work. hence the other 2 statements
###################################################################################################
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -DDAMASKVERSION=\\\"${DAMASK_V}\\\"" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -fpp" ) set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -fpp" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -ftz" ) set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -ftz" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -assume byterecl,fpe_summary") set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -assume byterecl,fpe_summary")
@ -156,7 +160,9 @@ set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn interfaces"
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn ignore_loc" ) set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn ignore_loc" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn alignments" ) set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn alignments" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn unused" ) set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn unused" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -diag-remark 7410" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -stand none" )
set (COMPILE_OPTIONS_ifort "${COMPILE_OPTIONS_ifort} -warn nostderrors" )
################################################################################################### ###################################################################################################
# COMPILE SWITCHES FOR RUNTIME DEBUGGING # COMPILE SWITCHES FOR RUNTIME DEBUGGING
# -g: Generate symbolic debugging information in the object file # -g: Generate symbolic debugging information in the object file
@ -272,6 +278,14 @@ set (LINK_OPTIONS_ifort "-shared-intel")
# -Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions. # -Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions.
# -Wstrict-overflow: # -Wstrict-overflow:
################################################################################################### ###################################################################################################
# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation
# --> allows the definition of DAMASK_NaN
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external
# --> allows the use of 'isnan'
#-fno-fast-math:
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
###################################################################################################
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -DDAMASKVERSION=${DAMASKVERSION}") set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -DDAMASKVERSION=${DAMASKVERSION}")
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -xf95-cpp-input" ) set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -xf95-cpp-input" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -ffree-line-length-240" ) set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -ffree-line-length-240" )
@ -286,7 +300,10 @@ set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wsuggest-attribute=n
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wconversion-extra" ) set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wconversion-extra" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wimplicit-procedure" ) set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wimplicit-procedure" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wno-unused-parameter" ) set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -Wno-unused-parameter" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fno-range-check" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fall-intrinsics" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fno-fast-math" )
set (COMPILE_OPTIONS_gfortran "${COMPILE_OPTIONS_gfortran} -fall-intrinsics" )
################################################################################################### ###################################################################################################
# COMPILE SWITCHES FOR RUNTIME DEBUGGING # COMPILE SWITCHES FOR RUNTIME DEBUGGING
# -ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent) # -ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent)
@ -348,6 +365,7 @@ if (Fortran_COMPILER_NAME MATCHES "ifort.*")
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${LINK_OPTIONS_ifort}" ) set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${LINK_OPTIONS_ifort}" )
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}") set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${DEBUG_OPTIONS_ifort}")
#
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*") elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90") set (CMAKE_Fortran_COMPILER "${PETSC_DIR}/bin/mpif90")
# for RELEASE # for RELEASE
@ -398,6 +416,7 @@ set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DPETSc"
# NOTE: some file might need different flags for compiling, DAMASK_$FLAGS # NOTE: some file might need different flags for compiling, DAMASK_$FLAGS
# are essentially the swap for this purpose # are essentially the swap for this purpose
set (DAMASK_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" ) set (DAMASK_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" )
set (DAMASK_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" )
set (DAMASK_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set (DAMASK_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set (DAMASK_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" ) set (DAMASK_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )

View File

@ -1,51 +1,17 @@
# The dependency detection in CMake is not functioning for Fortran # The dependency detection in CMake is not functioning for Fortran
# !!! EXPLICIT DEPENDENCY DECLARATION !!! # !!! EXPLICIT DEPENDENCY DECLARATION !!!
###################################################################################################
# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation
# --> allows the definition of DAMASK_NaN
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external
# --> allows the use of 'isnan'
#-fno-fast-math:
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
###################################################################################################
if (Fortran_COMPILER_NAME MATCHES "ifort.*")
set (SPEICAL_FLAGS "")
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
set (SPEICAL_FLAGS "-fno-range-check -fall-intrinsics -fno-fast-math")
else (Fortran_COMPILER_NAME MATCHES "ifort.*")
message (FATAL_ERROR "Unknown Fortrna compiler.")
endif (Fortran_COMPILER_NAME MATCHES "ifort.*")
set (CMAKE_Fortran_FLAGS_RELEASE "${DAMASK_Fortran_FLAGS_RELEASE} ${SPEICAL_FLAGS}") add_library(DAMASK_PREC "prec.f90")
add_library(DAMASK_prec "prec.f90")
set (CMAKE_Fortran_FLAGS_RELEASE "${DAMASK_Fortran_FLAGS_RELEASE}")
###################################################################################################
# -diag-disable 7410 should disable warning about directory statement in inquire function,
# but does not work. hence the other 2 statements
###################################################################################################
if (SPECTRAL) if (SPECTRAL)
if (Fortran_COMPILER_NAME MATCHES "ifort.*") add_library(DAMASK_INTERFACE "spectral_interface.f90")
set (SPEICAL_FLAGS "-diag-remark 7410 -stand none -warn nostderrors") target_link_libraries(DAMASK_INTERFACE DAMASK_PREC)
elseif (Fortran_COMPILER_NAME MATCHES "gfortran.*") elseif(SPECTRAL)
set (SPEICAL_FLAGS "-fall-intrinsics") message(FATAL_ERROR "NOT IMPLEMENTED YET")
else (Fortran_COMPILER_NAME MATCHES "ifort.*")
message (FATAL_ERROR "Unknown Fortrna compiler.")
endif (Fortran_COMPILER_NAME MATCHES "ifort.*")
set (CMAKE_Fortran_FLAGS_RELEASE "${DAMASK_Fortran_FLAGS_RELEASE} ${SPEICAL_FLAGS}")
add_library(DAMASK_interface "spectral_interface.f90")
target_link_libraries(DAMASK_interface DAMASK_prec)
set (CMAKE_Fortran_FLAGS_RELEASE "${DAMASK_Fortran_FLAGS_RELEASE}")
endif(SPECTRAL) endif(SPECTRAL)
add_library(DAMASK_IO "IO.f90") add_library(DAMASK_IO "IO.f90")
target_link_libraries(DAMASK_IO DAMASK_interface) target_link_libraries(DAMASK_IO DAMASK_INTERFACE)
add_library(DAMASK_LIBS "libs.f90") add_library(DAMASK_LIBS "libs.f90")
target_link_libraries(DAMASK_LIBS DAMASK_IO) target_link_libraries(DAMASK_LIBS DAMASK_IO)
@ -56,49 +22,38 @@ target_link_libraries(DAMASK_NUMERICS DAMASK_LIBS)
add_library(DAMASK_DEBUG "debug.f90") add_library(DAMASK_DEBUG "debug.f90")
target_link_libraries(DAMASK_DEBUG DAMASK_NUMERICS) target_link_libraries(DAMASK_DEBUG DAMASK_NUMERICS)
add_library(DAMASK_BASICS ALIAS DAMASK_DEBUG) add_library(DAMASK_FEsolving "FEsolving.f90")
target_link_libraries(DAMASK_FEsolving DAMASK_DEBUG)
# group sources for base modules add_library(DAMASK_MATH "math.f90")
# the FEM modules would require special attention target_link_libraries(DAMASK_MATH DAMASK_FEsolving)
# will take care of it later.
set (SRC "CPFEM"
"CPFEM2"
"core_quit"
"commercialFEM_fileList"
"compilation_info"
"constitutive"
"crystallite"
"damask_hdf5"
"lattice"
"material"
"math"
"mesh"
"quit__genmod"
)
# compiler base modules # SPECTRAL solver and FEM solver use different mesh
foreach (p ${SRC}) # source files
add_library (${p} "${p}.f90") if (SPECTRAL)
target_link_libraries(${p} DAMASK_BASICS) add_library(DAMASK_MESH "mesh.f90")
endforeach (p) endif(SPECTRAL)
if (FEM)
add_library(DAMASK_MESH "${FEM_DIR}/meshFEM.f90")
endif(FEM)
target_link_libraries(DAMASK_MESH DAMASK_MATH)
# set libraries/modules for linking add_library(DAMASK_MATERIAL "material.f90")
foreach (p ${SRC}) target_link_libraries(DAMASK_MATERIAL DAMASK_MESH)
set (DAMASK_LIB ${DAMASK_LIB} ${p})
endforeach (p)
# compile each sub moudel add_library(DAMASK_LATTICE "lattice.f90")
add_subdirectory(damage) target_link_libraries(DAMASK_LATTICE DAMASK_MATERIAL)
add_subdirectory(homogenization) add_library(DAMASK_DRIVERS ALIAS DAMASK_LATTICE)
add_subdirectory(hydrogenflux)
add_subdirectory(kinematics) # For each modular section
add_subdirectory(plastic) add_subdirectory(plastic)
add_subdirectory(porosity) # add_subdirectory(kinematics)
add_subdirectory(source) # add_subdirectory(source)
add_subdirectory(spectral)
add_subdirectory(thermal) # add_library(DAMASK_CONSTITUTIVE "constitutive.f90")
add_subdirectory(vacancyflux) # target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_DRIVERS)
# add_library(DAMASK_DRIVERS ALIAS DAMASK_CONSTITUTIVE)
# compile spectral solver # compile spectral solver
add_executable(DAMASKSpectral.exe DAMASK_spectral.f90) add_executable(DAMASKSpectral.exe DAMASK_spectral.f90)
target_link_libraries (DAMASKSpectral.exe ${DAMASK_LIB}) target_link_libraries (DAMASKSpectral.exe DAMASK_PLASTIC)

View File

@ -98,7 +98,7 @@ OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 -ffast-math -funroll-loops -ftree-vectori
LINK_OPTIONS_ifort :=-shared-intel LINK_OPTIONS_ifort :=-shared-intel
COMPILE_OPTIONS_ifort :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ COMPILE_OPTIONS_ifort :=-DDAMASKVERSION='${DAMASKVERSION}'\
-fpp\ -fpp\
-ftz\ -ftz\
-assume byterecl,fpe_summary\ -assume byterecl,fpe_summary\

View File

@ -6,12 +6,10 @@ set (KINEMATICS "kinematics_cleavage_opening"
"kinematics_hydrogen_strain" "kinematics_hydrogen_strain"
) )
# compile kinamtic modules # compile module and cumulatively link the
# compiled libraries
foreach (p ${KINEMATICS}) foreach (p ${KINEMATICS})
add_library (${p} "${p}.f90") add_library (${p} "${p}.f90")
endforeach (p) target_link_libraries(${p} DAMASK_DRIVERS)
add_library (DAMASK_DRIVERS ALIAS ${p})
# set libraries/modules for linking
foreach (p ${KINEMATICS})
set (DAMASK_LIB ${DAMASK_LIB} ${p})
endforeach (p) endforeach (p)

View File

@ -10,12 +10,20 @@ set (PLASTIC "plastic_dislotwin"
"plastic_phenoplus" "plastic_phenoplus"
) )
# compile module # compile module and cumulatively link the
foreach (p ${PLASTIC}) # compiled libraries
add_library (${p} "${p}.f90") add_library (DAMASK_PLASTIC "plastic_dislotwin.f90"
endforeach (p) "plastic_disloUCLA.f90"
"plastic_isotropic.f90"
# set libraries/modules for linking "plastic_j2.f90"
foreach (p ${PLASTIC}) "plastic_phenopowerlaw.f90"
set (DAMASK_LIB ${DAMASK_LIB} ${p}) "plastic_titanmod.f90"
endforeach (p) "plastic_nonlocal.f90"
"plastic_none.f90"
"plastic_phenoplus.f90")
target_link_libraries(DAMASK_PLASTIC DAMASK_DRIVERS)
# foreach (p ${PLASTIC})
# add_library (${p} "${p}.f90")
# target_link_libraries(${p} DAMASK_DRIVERS)
# add_library (DAMASK_DRIVERS ALIAS ${p})
# endforeach (p)

View File

@ -10,12 +10,10 @@ set (SOURCE "source_thermal_dissipation"
"source_vacancy_thermalfluc" "source_vacancy_thermalfluc"
) )
# compile modules for source # compile module and cumulatively link the
foreach (p ${SOURCE}) # compiled libraries
foreach (p ${KINEMATICS})
add_library (${p} "${p}.f90") add_library (${p} "${p}.f90")
endforeach (p) target_link_libraries(${p} DAMASK_DRIVERS)
add_library (DAMASK_DRIVERS ALIAS ${p})
# set libraries/modules for linking
foreach (p ${SOURCE})
set (DAMASK_LIB ${DAMASK_LIB} ${p})
endforeach (p) endforeach (p)