Skip to content

Commit 8bdc577

Browse files
authored
[openmp] Revise IDE folder structure (#89750)
Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode (`set_property(TARGET <target> PROPERTY FOLDER "<title>")`) when using the respective CMake's IDE generator. * Ensure that every target is in a folder * Use a folder hierarchy with each LLVM subproject as a top-level folder * Use consistent folder names between subprojects * When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of `set_property`/`set_target_property`, but are still necessary when `add_custom_target`, `add_executable`, `add_library`, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt.
1 parent 064391d commit 8bdc577

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

openmp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.20.0)
2+
set(LLVM_SUBPROJECT_TITLE "OpenMP")
23

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

openmp/docs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN)
7878
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
7979
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8080
COMMENT "Generating openmp doxygen documentation." VERBATIM)
81+
set_target_properties(doxygen-openmp PROPERTIES FOLDER "OpenMP/Docs")
8182

8283
if (LLVM_BUILD_DOCS)
8384
add_dependencies(doxygen doxygen-openmp)

openmp/runtime/cmake/LibompMicroTests.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ macro(libomp_test_touch_recipe test_touch_dir)
126126
endmacro()
127127
libomp_append(libomp_test_touch_env "KMP_VERSION=1")
128128
add_custom_target(libomp-test-touch DEPENDS ${libomp_test_touch_targets})
129+
set_target_properties(libomp-test-touch PROPERTIES FOLDER "OpenMP/Tests")
129130
if(WIN32)
130131
libomp_test_touch_recipe(test-touch-mt)
131132
libomp_test_touch_recipe(test-touch-md)
@@ -135,6 +136,7 @@ endif()
135136
136137
# test-relo
137138
add_custom_target(libomp-test-relo DEPENDS test-relo/.success)
139+
set_target_properties(libomp-test-relo PROPERTIES FOLDER "OpenMP/Tests")
138140
add_custom_command(
139141
OUTPUT test-relo/.success test-relo/readelf.log
140142
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-relo
@@ -146,6 +148,7 @@ add_custom_command(
146148
147149
# test-execstack
148150
add_custom_target(libomp-test-execstack DEPENDS test-execstack/.success)
151+
set_target_properties(libomp-test-execstack PROPERTIES FOLDER "OpenMP/Tests")
149152
add_custom_command(
150153
OUTPUT test-execstack/.success
151154
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-execstack
@@ -157,6 +160,7 @@ add_custom_command(
157160
158161
# test-instr
159162
add_custom_target(libomp-test-instr DEPENDS test-instr/.success)
163+
set_target_properties(libomp-test-instr PROPERTIES FOLDER "OpenMP/Tests")
160164
add_custom_command(
161165
OUTPUT test-instr/.success
162166
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test-instr
@@ -168,6 +172,7 @@ add_custom_command(
168172
169173
# test-deps
170174
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
175+
set_target_properties(libomp-test-deps PROPERTIES FOLDER "OpenMP/Tests")
171176
set(libomp_expected_library_deps)
172177
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
173178
set(libomp_expected_library_deps libc.so.7 libthr.so.3 libm.so.5)

openmp/runtime/src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
170170
# Build libomp library. Add LLVMSupport dependency if building in-tree with libomptarget profiling enabled.
171171
if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING))
172172
add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES})
173+
set_property(TARGET omp PROPERTY FOLDER "OpenMP/Libraries")
173174
# Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
174175
target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS})
175176
else()
@@ -251,6 +252,7 @@ set(LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER "${LIBOMP_LIBRARY_DIR}" CACHE STRING
251252
# Create *.inc before compiling any sources
252253
# objects depend on : .inc files
253254
add_custom_target(libomp-needed-headers DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc)
255+
set_target_properties(libomp-needed-headers PROPERTIES FOLDER "OpenMP/Sourcegenning")
254256
add_dependencies(omp libomp-needed-headers)
255257

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

297300
# Create the main def file with ordinals to use for building the runtime dll to maintain backwards compatible exports order
@@ -310,6 +313,7 @@ if(WIN32)
310313
# Create the auxiliary def file without ordinals to use for building the import library to import by name
311314
set(LIBOMPIMP_GENERATED_DEF_FILE ${LIBOMP_LIB_NAME}.imp.def)
312315
add_custom_target(libompimp-needed-def-file DEPENDS ${LIBOMPIMP_GENERATED_DEF_FILE})
316+
set_target_properties(libompimp-needed-def-file PROPERTIES FOLDER "OpenMP/Resources")
313317
add_custom_command(
314318
OUTPUT ${LIBOMPIMP_GENERATED_DEF_FILE}
315319
COMMAND ${PERL_EXECUTABLE} ${LIBOMP_TOOLS_DIR}/generate-def.pl ${LIBOMP_GDFLAGS} -D NAME=${LIBOMP_LIB_FILE} -D NOORDINALS
@@ -319,6 +323,7 @@ if(WIN32)
319323
# 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,
320324
# 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)
321325
add_library(${LIBOMP_IMP_LIB_TARGET} STATIC kmp_dummy.txt)
326+
set_target_properties(${LIBOMP_IMP_LIB_TARGET} PROPERTIES FOLDER "OpenMP/Libraries")
322327
set_target_properties(${LIBOMP_IMP_LIB_TARGET} PROPERTIES
323328
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
324329
STATIC_LIBRARY_OPTIONS "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMPIMP_GENERATED_DEF_FILE}")
@@ -354,6 +359,7 @@ elseif(${LIBOMP_FORTRAN_MODULES})
354359
set(ADDITIONAL_Fortran_FLAGS "-fno-range-check")
355360
endif()
356361
add_custom_target(libomp-mod ALL DEPENDS omp_lib.mod omp_lib_kinds.mod)
362+
set_target_properties(libomp-mod PROPERTIES FOLDER "OpenMP/Misc")
357363
libomp_get_fflags(LIBOMP_CONFIGURED_FFLAGS)
358364
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
359365
set(LIBOMP_FORTRAN_SOURCE_FILE omp_lib.F90)
@@ -379,6 +385,7 @@ endif()
379385
# Micro test rules for after library has been built (cmake/LibompMicroTests.cmake)
380386
include(LibompMicroTests)
381387
add_custom_target(libomp-micro-tests)
388+
set_target_properties(libomp-micro-tests PROPERTIES FOLDER "OpenMP/Tests")
382389
if(NOT ${MIC} AND NOT CMAKE_CROSSCOMPILING)
383390
add_dependencies(libomp-micro-tests libomp-test-touch)
384391
endif()

0 commit comments

Comments
 (0)