@@ -19,71 +19,74 @@ add_subdirectory(common)
19
19
# - tmachine_libname: machine name to be appended to the plugin library name.
20
20
macro (build_generic_elf64 tmachine tmachine_name tmachine_libname tmachine_triple elf_machine_id )
21
21
if (CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine} $" )
22
- if (LIBOMPTARGET_DEP_LIBFFI_FOUND )
23
-
24
- libomptarget_say ("Building ${tmachine_name} NextGen offloading plugin." )
25
-
26
- # Define macro to be used as prefix of the runtime messages for this target.
27
- add_definitions ("-DTARGET_NAME=${tmachine_name} " )
22
+ # Define macro to be used as prefix of the runtime messages for this target.
23
+ add_definitions ("-DTARGET_NAME=${tmachine_name} " )
28
24
29
- # Define debug prefix. TODO: This should be automatized in the Debug.h but
30
- # it requires changing the original plugins.
31
- add_definitions (-DDEBUG_PREFIX= "TARGET ${tmachine_name} RTL" )
25
+ # Define debug prefix. TODO: This should be automatized in the Debug.h but
26
+ # it requires changing the original plugins.
27
+ add_definitions (-DDEBUG_PREFIX= "TARGET ${tmachine_name} RTL" )
32
28
33
- # Define macro with the ELF ID for this target.
34
- add_definitions ("-DTARGET_ELF_ID=${elf_machine_id} " )
29
+ # Define the macro with the ELF e_machine for this target.
30
+ add_definitions ("-DTARGET_ELF_ID=${elf_machine_id} " )
35
31
36
- # Define target regiple
37
- add_definitions ("-DLIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE=${tmachine} " )
32
+ # Define target triple
33
+ add_definitions ("-DLIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE=${tmachine} " )
38
34
39
- add_llvm_library ("omptarget.rtl.${tmachine_libname} "
40
- SHARED
35
+ add_llvm_library ("omptarget.rtl.${tmachine_libname} "
36
+ SHARED
41
37
42
- ${CMAKE_CURRENT_SOURCE_DIR} /../generic-elf-64bit/src/rtl.cpp
38
+ ${CMAKE_CURRENT_SOURCE_DIR} /../generic-elf-64bit/src/rtl.cpp
43
39
44
- ADDITIONAL_HEADER_DIRS
40
+ ADDITIONAL_HEADER_DIRS
45
41
${LIBOMPTARGET_INCLUDE_DIR}
46
- ${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR}
47
-
48
- LINK_LIBS
49
- PRIVATE
50
- PluginCommon
51
- ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
52
- ${OPENMP_PTHREAD_LIB}
53
-
54
- NO_INSTALL_RPATH
55
- )
56
-
57
- if ((OMPT_TARGET_DEFAULT ) AND (LIBOMPTARGET_OMPT_SUPPORT ))
58
- target_link_libraries ("omptarget.rtl.${tmachine_libname} " PRIVATE OMPT )
59
- endif ()
60
-
61
- if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG )
62
- target_link_libraries ("omptarget.rtl.${tmachine_libname} " PRIVATE
63
- "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../exports" )
64
- endif ()
65
-
66
- # Install plugin under the lib destination folder.
67
- install (TARGETS "omptarget.rtl.${tmachine_libname} "
68
- LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR} " )
69
- set_target_properties ("omptarget.rtl.${tmachine_libname} " PROPERTIES
70
- INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR} /.."
71
- POSITION_INDEPENDENT_CODE ON
72
- CXX_VISIBILITY_PRESET protected )
73
-
74
- target_include_directories ( "omptarget.rtl.${tmachine_libname} " PRIVATE
75
- ${LIBOMPTARGET_INCLUDE_DIR}
76
- ${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR} )
77
42
78
- list (APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.${tmachine_libname} " )
79
- set (LIBOMPTARGET_TESTED_PLUGINS
80
- "${LIBOMPTARGET_TESTED_PLUGINS} " PARENT_SCOPE )
81
- set (LIBOMPTARGET_SYSTEM_TARGETS
82
- "${LIBOMPTARGET_SYSTEM_TARGETS} ${tmachine_triple} ${tmachine_triple} -LTO" PARENT_SCOPE )
43
+ LINK_LIBS
44
+ PRIVATE
45
+ PluginCommon
46
+ ${OPENMP_PTHREAD_LIB}
47
+
48
+ NO_INSTALL_RPATH
49
+ )
83
50
84
- else (LIBOMPTARGET_DEP_LIBFFI_FOUND )
85
- libomptarget_say ("Not building ${tmachine_name} NextGen offloading plugin: libffi dependency not found." )
86
- endif (LIBOMPTARGET_DEP_LIBFFI_FOUND )
51
+ if (LIBOMPTARGET_DEP_LIBFFI_FOUND )
52
+ libomptarget_say ("Building ${tmachine_libname} plugin linked with libffi" )
53
+ target_link_libraries ("omptarget.rtl.${tmachine_libname} " PRIVATE
54
+ ${FFI_LIBRARIES} )
55
+ target_include_directories ("omptarget.rtl.${tmachine_libname} " PRIVATE
56
+ ${FFI_INCLUDE_DIRS} )
57
+ else ()
58
+ libomptarget_say ("Building ${tmachine_libname} plugie for dlopened libffi" )
59
+ target_sources ("omptarget.rtl.${tmachine_libname} " PRIVATE
60
+ ${CMAKE_CURRENT_SOURCE_DIR} /../generic-elf-64bit/dynamic_ffi/ffi.cpp )
61
+ target_include_directories ("omptarget.rtl.${tmachine_libname} " PRIVATE
62
+ ${CMAKE_CURRENT_SOURCE_DIR} /../generic-elf-64bit/dynamic_ffi )
63
+ endif ()
64
+
65
+ if (OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT )
66
+ target_link_libraries ("omptarget.rtl.${tmachine_libname} " PRIVATE OMPT )
67
+ endif ()
68
+
69
+ if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG )
70
+ target_link_libraries ("omptarget.rtl.${tmachine_libname} " PRIVATE
71
+ "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../exports" )
72
+ endif ()
73
+
74
+ # Install plugin under the lib destination folder.
75
+ install (TARGETS "omptarget.rtl.${tmachine_libname} "
76
+ LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR} " )
77
+ set_target_properties ("omptarget.rtl.${tmachine_libname} " PROPERTIES
78
+ INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR} /.."
79
+ POSITION_INDEPENDENT_CODE ON
80
+ CXX_VISIBILITY_PRESET protected )
81
+
82
+ target_include_directories ("omptarget.rtl.${tmachine_libname} " PRIVATE
83
+ ${LIBOMPTARGET_INCLUDE_DIR} )
84
+
85
+ list (APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.${tmachine_libname} " )
86
+ set (LIBOMPTARGET_TESTED_PLUGINS
87
+ "${LIBOMPTARGET_TESTED_PLUGINS} " PARENT_SCOPE )
88
+ set (LIBOMPTARGET_SYSTEM_TARGETS
89
+ "${LIBOMPTARGET_SYSTEM_TARGETS} ${tmachine_triple} ${tmachine_triple} -LTO" PARENT_SCOPE )
87
90
else ()
88
91
libomptarget_say ("Not building ${tmachine_name} NextGen offloading plugin: machine not found in the system." )
89
92
endif ()
0 commit comments