2017-02-04 03:53:55 +05:30
|
|
|
# special flags for some files
|
2021-10-16 01:44:37 +05:30
|
|
|
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
2017-02-04 03:53:55 +05:30
|
|
|
# long lines for interaction matrix
|
2022-10-02 16:18:54 +05:30
|
|
|
set_source_files_properties("lattice.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-240")
|
2022-10-13 16:38:13 +05:30
|
|
|
set_source_files_properties("parallelization.f90" PROPERTIES COMPILE_FLAGS "-ffree-line-length-none")
|
2016-03-08 04:30:12 +05:30
|
|
|
endif()
|
2017-02-04 03:53:55 +05:30
|
|
|
|
2021-08-17 14:59:36 +05:30
|
|
|
file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c)
|
2019-01-28 23:16:47 +05:30
|
|
|
|
2021-10-16 01:44:37 +05:30
|
|
|
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)
|
2023-02-25 02:57:56 +05:30
|
|
|
elseif(PROJECT_NAME STREQUAL "damask-test")
|
|
|
|
set(executable-name "DAMASK_test")
|
|
|
|
file(GLOB solver-sources CONFIGURE_DEPENDS test/*.f90)
|
2021-10-16 01:44:37 +05:30
|
|
|
endif()
|
2019-04-29 14:45:23 +05:30
|
|
|
|
2022-10-02 16:18:54 +05:30
|
|
|
foreach(solver-source ${solver-sources})
|
|
|
|
file(READ ${solver-source} content)
|
|
|
|
string(FIND "${content}" "CHKERR" found)
|
2022-12-17 20:43:35 +05:30
|
|
|
if((NOT ${found} EQUAL -1) AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU"))
|
2022-10-13 16:38:13 +05:30
|
|
|
set_source_files_properties(${solver-source} PROPERTIES COMPILE_FLAGS "-ffree-line-length-none")
|
2022-10-02 16:18:54 +05:30
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
2021-10-16 01:44:37 +05:30
|
|
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
|
|
|
|
add_executable(${executable-name} ${damask-sources} ${solver-sources})
|
|
|
|
install(TARGETS ${executable-name} RUNTIME DESTINATION bin)
|
|
|
|
else()
|
2021-10-16 01:49:58 +05:30
|
|
|
add_library(${executable-name} OBJECT ${damask-sources} ${solver-sources})
|
2021-10-16 01:44:37 +05:30
|
|
|
exec_program(mktemp OUTPUT_VARIABLE nothing)
|
|
|
|
exec_program(mktemp ARGS -d OUTPUT_VARIABLE black_hole)
|
|
|
|
install(PROGRAMS ${nothing} DESTINATION ${black_hole})
|
|
|
|
endif()
|
2021-10-16 01:45:08 +05:30
|
|
|
|
|
|
|
string(REPLACE ";" "\n" sources "${damask-sources};${solver-sources}")
|
|
|
|
message(${CMAKE_BINARY_DIR})
|
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/sources.txt ${sources})
|