SYNTAXONLY for mesh, avoid code duplication

This commit is contained in:
Martin Diehl 2021-10-15 22:14:37 +02:00
parent dead46ebf6
commit c628c028dc
1 changed files with 17 additions and 22 deletions

View File

@ -1,5 +1,5 @@
# special flags for some files # special flags for some files
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
# long lines for interaction matrix # long lines for interaction matrix
SET_SOURCE_FILES_PROPERTIES("lattice.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-240") SET_SOURCE_FILES_PROPERTIES("lattice.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-240")
endif() endif()
@ -12,25 +12,20 @@ list(FILTER damask-sources EXCLUDE REGEX ".*DAMASK_Marc.*.f90")
list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90") list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90")
if (PROJECT_NAME STREQUAL "damask-grid") if(PROJECT_NAME STREQUAL "damask-grid")
set(executable-name "DAMASK_grid")
file(GLOB solver-sources CONFIGURE_DEPENDS grid/*.f90)
elseif(PROJECT_NAME STREQUAL "damask-mesh")
set(executable-name "DAMASK_mesh")
file(GLOB solver-sources CONFIGURE_DEPENDS mesh/*.f90)
endif()
file(GLOB grid-sources CONFIGURE_DEPENDS grid/*.f90) if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
add_executable(${executable-name} ${damask-sources} ${solver-sources})
if (NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") install(TARGETS ${executable-name} RUNTIME DESTINATION bin)
add_executable(DAMASK_grid ${damask-sources} ${grid-sources}) else()
install (TARGETS DAMASK_grid RUNTIME DESTINATION bin)
else ()
add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources}) add_library(DAMASK_grid OBJECT ${damask-sources} ${grid-sources})
exec_program (mktemp OUTPUT_VARIABLE nothing) exec_program(mktemp OUTPUT_VARIABLE nothing)
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole) exec_program(mktemp ARGS -d OUTPUT_VARIABLE black_hole)
install (PROGRAMS ${nothing} DESTINATION ${black_hole}) install(PROGRAMS ${nothing} DESTINATION ${black_hole})
endif () endif()
elseif (PROJECT_NAME STREQUAL "damask-mesh")
file(GLOB mesh-sources CONFIGURE_DEPENDS mesh/*.f90)
add_executable(DAMASK_mesh ${damask-sources} ${mesh-sources})
install (TARGETS DAMASK_mesh RUNTIME DESTINATION bin)
endif ()