Skip to content

[openmp] Revise IDE folder structure #89750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 25, 2024
1 change: 1 addition & 0 deletions openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.20.0)
set(LLVM_SUBPROJECT_TITLE "OpenMP")

set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)

Expand Down
1 change: 1 addition & 0 deletions openmp/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN)
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating openmp doxygen documentation." VERBATIM)
set_target_properties(doxygen-openmp PROPERTIES FOLDER "OpenMP/Docs")

if (LLVM_BUILD_DOCS)
add_dependencies(doxygen doxygen-openmp)
Expand Down
5 changes: 5 additions & 0 deletions openmp/runtime/cmake/LibompMicroTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ macro(libomp_test_touch_recipe test_touch_dir)
endmacro()
libomp_append(libomp_test_touch_env "KMP_VERSION=1")
add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
set_target_properties(libomp-test-touch PROPERTIES FOLDER "OpenMP/Tests")
Copy link
Contributor

@shiltian shiltian May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose these are for Windows (and potentially Xcode on macOS), especially those "folders" don't look like anything on Linux. I'd recommend libomp/tests, libomp/docs, etc. We don't call our library "OpenMP" library.

Copy link
Member Author

@Meinersbur Meinersbur May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The subproject's directory name is openmp
  • The README calls it "LLVM OpenMP Libraries".
  • The website is openmp.llvm.org, and libomp is not even mentioned. Its title is "LLVM/OpenMP", I think we can drop the "LLVM" prefix within the LLVM repository.
  • libompd, libomptarget (formerly), omp.h, Archer, and ompopt documentation lives in there too, i.e. this is not the subproject for just libomp.
  • The prefix for the CMake variable is "OPENMP_"

The folder names require an IDE what display them, none of them are available for Linux. They are also not directories in the filesystem, case should not matter.

I could call it "OpenMP Libraries" if that makes it clearer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is, when it comes to directory (except the top level folder), we don't call it "OpenMP". I don't have a strong objection, but just find libomp more conventional. I'll leave it up to you.

if(WIN32)
libomp_test_touch_recipe(test-touch-mt)
libomp_test_touch_recipe(test-touch-md)
Expand All @@ -135,6 +136,7 @@ endif()

# test-relo
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
set_target_properties(libomp-test-relo PROPERTIES FOLDER "OpenMP/Tests")
add_custom_command(
OUTPUT test-relo/.success test-relo/readelf.log
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
Expand All @@ -146,6 +148,7 @@ add_custom_command(

# test-execstack
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
set_target_properties(libomp-test-execstack PROPERTIES FOLDER "OpenMP/Tests")
add_custom_command(
OUTPUT test-execstack/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
Expand All @@ -157,6 +160,7 @@ add_custom_command(

# test-instr
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
set_target_properties(libomp-test-instr PROPERTIES FOLDER "OpenMP/Tests")
add_custom_command(
OUTPUT test-instr/.success
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
Expand All @@ -168,6 +172,7 @@ add_custom_command(

# test-deps
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
set_target_properties(libomp-test-deps PROPERTIES FOLDER "OpenMP/Tests")
set(libomp_expected_library_deps)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(libomp_expected_library_deps libc.so.7 libthr.so.3 libm.so.5)
Expand Down
7 changes: 7 additions & 0 deletions openmp/runtime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
# Build libomp library. Add LLVMSupport dependency if building in-tree with libomptarget profiling enabled.
if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
set_property(TARGET omp PROPERTY FOLDER "OpenMP/Libraries")
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS})
else()
Expand Down Expand Up @@ -251,6 +252,7 @@ set(LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER "${LIBOMP_LIBRARY_DIR}" CACHE STRING
# Create *.inc before compiling any sources
# objects depend on : .inc files
add_custom_target(libomp-needed-headers DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc)
set_target_properties(libomp-needed-headers PROPERTIES FOLDER "OpenMP/Sourcegenning")
add_dependencies(omp libomp-needed-headers)

# Windows specific build rules
Expand Down Expand Up @@ -292,6 +294,7 @@ if(WIN32)
set(LIBOMP_IMP_LIB_TARGET omp)
set(LIBOMP_GENERATED_DEF_FILE ${LIBOMP_LIB_NAME}.def)
add_custom_target(libomp-needed-def-file DEPENDS ${LIBOMP_GENERATED_DEF_FILE})
set_target_properties(libomp-needed-def-file PROPERTIES FOLDER "OpenMP/Sourcegenning")
add_dependencies(omp libomp-needed-def-file)

# Create the main def file with ordinals to use for building the runtime dll to maintain backwards compatible exports order
Expand All @@ -310,6 +313,7 @@ if(WIN32)
# Create the auxiliary def file without ordinals to use for building the import library to import by name
set(LIBOMPIMP_GENERATED_DEF_FILE ${LIBOMP_LIB_NAME}.imp.def)
add_custom_target(libompimp-needed-def-file DEPENDS ${LIBOMPIMP_GENERATED_DEF_FILE})
set_target_properties(libompimp-needed-def-file PROPERTIES FOLDER "OpenMP/Resources")
add_custom_command(
OUTPUT ${LIBOMPIMP_GENERATED_DEF_FILE}
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/generate-def.pl ${LIBOMP_GDFLAGS} -D NAME=${LIBOMP_LIB_FILE} -D NOORDINALS
Expand All @@ -319,6 +323,7 @@ if(WIN32)
# while this merely generates an import library off a def file, CMAKE still requires it to have a "source" so feed it a dummy one,
# making it a .txt which CMAKE will filter out from the librarian (a .cpp will make lib.exe punt trying to resolve the .def symbols)
add_library(${LIBOMP_IMP_LIB_TARGET} STATIC kmp_dummy.txt)
set_target_properties(${LIBOMP_IMP_LIB_TARGET} PROPERTIES FOLDER "OpenMP/Libraries")
set_target_properties(${LIBOMP_IMP_LIB_TARGET} PROPERTIES
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
STATIC_LIBRARY_OPTIONS "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMPIMP_GENERATED_DEF_FILE}")
Expand Down Expand Up @@ -354,6 +359,7 @@ elseif(${LIBOMP_FORTRAN_MODULES})
set(ADDITIONAL_Fortran_FLAGS "-fno-range-check")
endif()
add_custom_target(libomp-mod ALL DEPENDS omp_lib.mod omp_lib_kinds.mod)
set_target_properties(libomp-mod PROPERTIES FOLDER "OpenMP/Misc")
libomp_get_fflags(LIBOMP_CONFIGURED_FFLAGS)
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.F90)
Expand All @@ -379,6 +385,7 @@ endif()
# Micro test rules for after library has been built (cmake/LibompMicroTests.cmake)
include(LibompMicroTests)
add_custom_target(libomp-micro-tests)
set_target_properties(libomp-micro-tests PROPERTIES FOLDER "OpenMP/Tests")
if(NOT ${MIC} AND NOT CMAKE_CROSSCOMPILING)
add_dependencies(libomp-micro-tests libomp-test-touch)
endif()
Expand Down
Loading