File tree Expand file tree Collapse file tree 5 files changed +23
-28
lines changed
Expand file tree Collapse file tree 5 files changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,19 @@ if(NOT DEFINED CMAKE_MACOSX_RPATH)
127127 set (CMAKE_MACOSX_RPATH TRUE )
128128endif ()
129129
130+ # Remove any cmake-automatic linking of the standard C++ library.
131+ # We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
132+ if (NOT ${LIBOMP_USE_STDCPPLIB} )
133+ set (LIBOMP_LINKER_LANGUAGE C)
134+ set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
135+ else ()
136+ set (LIBOMP_LINKER_LANGUAGE CXX)
137+ endif ()
138+
139+ if (UNIX )
140+ set (LIBOMP_DL_LIBS ${CMAKE_DL_LIBS} )
141+ endif ()
142+
130143# User specified flags. These are appended to the configured flags.
131144set (LIBOMP_CXXFLAGS "" CACHE STRING
132145 "Appended user specified C++ compiler flags." )
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ endfunction()
9797
9898# Linker flags
9999function (libomp_get_ldflags ldflags)
100+ cmake_parse_arguments (ARG "FOR_UNITTESTS" "" "" ${ARGN} )
100101 set (ldflags_local)
101102 libomp_append(ldflags_local "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR} /${LIBOMP_LIB_NAME} .def"
102103 IF_DEFINED CMAKE_LINK_DEF_FILE_FLAG )
@@ -105,7 +106,11 @@ function(libomp_get_ldflags ldflags)
105106 libomp_append(ldflags_local "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${LIBOMP_VERSION_MAJOR} .${LIBOMP_VERSION_MINOR} "
106107 IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
107108 libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
108- libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR} /exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
109+ if (ARG_FOR_UNITTESTS)
110+ libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR} /exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
111+ else ()
112+ libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR} /exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
113+ endif ()
109114 libomp_append(ldflags_local -static -libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
110115 libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
111116 libomp_append(ldflags_local -no -intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
Original file line number Diff line number Diff line change @@ -153,19 +153,6 @@ libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS)
153153set_source_files_properties (${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS} " )
154154set_source_files_properties (${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS} " )
155155
156- # Remove any cmake-automatic linking of the standard C++ library.
157- # We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
158- if (NOT ${LIBOMP_USE_STDCPPLIB} )
159- set (LIBOMP_LINKER_LANGUAGE C)
160- set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
161- else ()
162- set (LIBOMP_LINKER_LANGUAGE CXX)
163- endif ()
164-
165- if (UNIX )
166- set (LIBOMP_DL_LIBS ${CMAKE_DL_LIBS} )
167- endif ()
168-
169156# Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
170157# avoid an unwanted dependency on libstdc++.so.
171158add_compile_definitions (_GLIBCXX_NO_ASSERTIONS)
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ config.name = 'libomp'
4141# suffixes: A list of file extensions to treat as test files.
4242config .suffixes = ['.c' , '.cpp' ]
4343
44+ # Exclude Unit tests - they are run separately via check-libomp-unit
45+ config .excludes = ['Unit' ]
46+
4447if config .test_fortran_compiler :
4548 lit_config .note ("OpenMP Fortran tests enabled" )
4649 config .suffixes += ['.f90' , '.F90' ]
Original file line number Diff line number Diff line change @@ -10,21 +10,8 @@ endif()
1010# This library uses the same compiled objects as libomp, but with all symbols
1111# exported to allow testing internal functions.
1212
13- libomp_get_ldflags(LIBOMP_TEST_LDFLAGS)
13+ libomp_get_ldflags(LIBOMP_TEST_LDFLAGS FOR_UNITTESTS )
1414libomp_get_libflags(LIBOMP_TEST_LIBFLAGS)
15- # Replace the libomp exports with the test exports exporting all symbols.
16- if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
17- string (REPLACE "${LIBOMP_SRC_DIR} /exports_so.txt"
18- "${LIBOMP_SRC_DIR} /exports_test_so.txt"
19- LIBOMP_TEST_LDFLAGS "${LIBOMP_TEST_LDFLAGS} " )
20- endif ()
21- # Duplicate setting of LIBOMP_LINKER_LANGUAGE to match libomp.
22- if (NOT ${LIBOMP_USE_STDCPPLIB} )
23- set (LIBOMP_LINKER_LANGUAGE C)
24- set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
25- else ()
26- set (LIBOMP_LINKER_LANGUAGE CXX)
27- endif ()
2815
2916# Create the testing library from the same objects as libomp.
3017add_library (omp_testing SHARED $<TARGET_OBJECTS:obj.omp>)
You can’t perform that action at this time.
0 commit comments