1 set(LLVM_LINK_COMPONENTS
9 "__fortran_ieee_exceptions"
11 "__fortran_ppc_intrinsics"
22 # Create module files directly from the top-level module source directory.
23 # If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
24 # cross compiled, and thus can't be executed on the build system and thus
25 # can't be used for generating module files.
26 if (NOT CMAKE_CROSSCOMPILING)
27 foreach(filename ${MODULES})
28 set(base ${FLANG_INTRINSIC_MODULES_DIR}/${filename})
29 if(${filename} STREQUAL "__fortran_builtins")
31 elseif(${filename} STREQUAL "__fortran_ppc_intrinsics")
34 set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
35 if(NOT ${filename} STREQUAL "__fortran_type_info")
36 set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_type_info.mod)
38 if(${filename} STREQUAL "ieee_arithmetic" OR
39 ${filename} STREQUAL "ieee_exceptions")
40 set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_ieee_exceptions.mod)
43 add_custom_command(OUTPUT ${base}.mod
44 COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
45 COMMAND flang-new -fc1 -cpp -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
46 ${FLANG_SOURCE_DIR}/module/${filename}.f90
47 DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
49 add_custom_command(OUTPUT ${base}.f18.mod
51 COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
52 list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
53 install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
57 add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})
59 # This flang shell script will only work in a POSIX shell.
62 ${CMAKE_CURRENT_SOURCE_DIR}/flang-to-external-fc.in
63 ${CMAKE_BINARY_DIR}/bin/flang-to-external-fc
66 add_custom_target(flang-to-external-fc ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/flang-to-external-fc)
67 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang-to-external-fc DESTINATION "${CMAKE_INSTALL_BINDIR}")
70 # TODO Move this to a more suitable location
71 file(COPY ${FLANG_SOURCE_DIR}/module/omp_lib.h DESTINATION "${CMAKE_BINARY_DIR}/include/flang/OpenMP/" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)