From 15601a2f273f061dbbc075cc231afc7112c02918 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 14 Jun 2024 18:31:06 +0300 Subject: [PATCH 01/46] [llvm-openmp] new port --- .../0001-disable-libomp-aliases.patch | 24 +++ ports/llvm-openmp/0002-disable-tests.patch | 10 + .../0003-fix-windows-import-lib-name.patch | 14 ++ ports/llvm-openmp/0004-install-config.patch | 43 ++++ ports/llvm-openmp/FindOpenMP.cmake.in | 202 ++++++++++++++++++ ports/llvm-openmp/portfile.cmake | 68 ++++++ ports/llvm-openmp/vcpkg.json | 17 ++ 7 files changed, 378 insertions(+) create mode 100644 ports/llvm-openmp/0001-disable-libomp-aliases.patch create mode 100644 ports/llvm-openmp/0002-disable-tests.patch create mode 100644 ports/llvm-openmp/0003-fix-windows-import-lib-name.patch create mode 100644 ports/llvm-openmp/0004-install-config.patch create mode 100644 ports/llvm-openmp/FindOpenMP.cmake.in create mode 100644 ports/llvm-openmp/portfile.cmake create mode 100644 ports/llvm-openmp/vcpkg.json diff --git a/ports/llvm-openmp/0001-disable-libomp-aliases.patch b/ports/llvm-openmp/0001-disable-libomp-aliases.patch new file mode 100644 index 00000000000000..9c311dc826b34f --- /dev/null +++ b/ports/llvm-openmp/0001-disable-libomp-aliases.patch @@ -0,0 +1,24 @@ + runtime/src/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt +index bb5822264514..340cef14df89 100644 +--- a/runtime/src/CMakeLists.txt ++++ b/runtime/src/CMakeLists.txt +@@ -215,7 +215,7 @@ endif() + set(LIBOMP_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) + + # Add symbolic links to libomp +-if(NOT WIN32) ++if(0) + add_custom_command(TARGET omp POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE} + libgomp${LIBOMP_LIBRARY_SUFFIX} +@@ -367,6 +367,6 @@ if(WIN32) + install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") + # Create aliases (regular copies) of the library for backwards compatibility +- set(LIBOMP_ALIASES "libiomp5md") ++ set(LIBOMP_ALIASES) + foreach(alias IN LISTS LIBOMP_ALIASES) + install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\" diff --git a/ports/llvm-openmp/0002-disable-tests.patch b/ports/llvm-openmp/0002-disable-tests.patch new file mode 100644 index 00000000000000..8c362b4fe953c4 --- /dev/null +++ b/ports/llvm-openmp/0002-disable-tests.patch @@ -0,0 +1,10 @@ +--- a/runtime/CMakeLists.txt ++++ b/runtime/CMakeLists.txt +@@ -450,7 +450,6 @@ + endif() + + add_subdirectory(src) +-add_subdirectory(test) + + # make these variables available for tools: + set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE) diff --git a/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch b/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch new file mode 100644 index 00000000000000..1ab690c518d07c --- /dev/null +++ b/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch @@ -0,0 +1,14 @@ +The built import lib is named "libomp.dll.lib" otherwise, which causes install() to fail. +https://github.com/llvm/llvm-project/issues/88876 + +--- a/runtime/src/CMakeLists.txt ++++ b/runtime/src/CMakeLists.txt +@@ -284,7 +284,7 @@ + endif() + else() + set(LIBOMP_IMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}) +- set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX}) ++ set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + set_target_properties(omp PROPERTIES + VERSION ${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR} # uses /version flag diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch new file mode 100644 index 00000000000000..8c18848dbbe450 --- /dev/null +++ b/ports/llvm-openmp/0004-install-config.patch @@ -0,0 +1,43 @@ +--- a/runtime/src/CMakeLists.txt ++++ b/runtime/src/CMakeLists.txt +@@ -369,6 +369,6 @@ + # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR} + # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR} + if(WIN32) +- install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +- install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") ++ install(TARGETS omp ${export_to_llvmexports} EXPORT llvm-openmp-targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ install(TARGETS ${LIBOMP_IMP_LIB_TARGET} EXPORT llvm-openmp-targets ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") + # Create aliases (regular copies) of the library for backwards compatibility +@@ -382,7 +382,7 @@ + endforeach() + else() + +- install(TARGETS omp ${export_to_llvmexports} ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") ++ install(TARGETS omp EXPORT llvm-openmp-targets ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") + + if(${LIBOMP_INSTALL_ALIASES}) + # Create aliases (symlinks) of the library for backwards compatibility +@@ -415,3 +415,22 @@ + DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} + ) + endif() ++ ++target_include_directories(omp PUBLIC $) ++ ++set(PORT_SHARE_DIR share/unofficial-llvm-openmp) ++install(EXPORT llvm-openmp-targets ++ FILE unofficial-llvm-openmp-config.cmake ++ NAMESPACE unofficial::llvm-openmp:: ++ DESTINATION ${PORT_SHARE_DIR} ++) ++include(CMakePackageConfigHelpers) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config-version.cmake" ++ VERSION ${LLVM_OPENMP_VERSION} ++ COMPATIBILITY SameMajorVersion ++) ++install(FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config-version.cmake" ++ DESTINATION ${PORT_SHARE_DIR} ++) diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in new file mode 100644 index 00000000000000..06dc4cb36d7ba3 --- /dev/null +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -0,0 +1,202 @@ +# Based on https://github.com/Kitware/CMake/blob/v3.30.0-rc3/Modules/FindOpenMP.cmake + +include(CMakeFindDependencyMacro) +find_dependency(unofficial-llvm-openmp CONFIG REQUIRED) +get_target_property(_OpenMP_INCLUDE_DIR unofficial::llvm-openmp::omp INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(_OpenMP_LIB_NAMES unofficial::llvm-openmp::omp INTERFACE_LINK_LIBRARIES) + +foreach(_lang C CXX) + set(OpenMP_${_lang}_INCLUDE_DIR "${_OpenMP_INCLUDE_DIR}") + set(OpenMP_${_lang}_INCLUDE_DIRS "${_OpenMP_INCLUDE_DIR}") + set(OpenMP_${_lang}_LIB_NAMES "${_OpenMP_LIB_NAMES}") + set(OpenMP_${_lang}_LIBRARIES "OpenMP::OpenMP_${_lang}") + if (NOT TARGET OpenMP::OpenMP_${_lang}) + add_library(OpenMP::OpenMP_${_lang} ALIAS unofficial::llvm-openmp::omp) + endif() +endforeach() + +function(_openmp_set_flags) + set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_LCC "-fopenmp") + set(OMP_FLAG_Clang "-fopenmp=libomp") + set(OMP_FLAG_AppleClang "-Xclang -fopenmp") + set(OMP_FLAG_HP "+Oopenmp") + if(WIN32) + set(OMP_FLAG_Intel "-Qopenmp") + elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND + "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528") + set(OMP_FLAG_Intel "-openmp") + else() + set(OMP_FLAG_Intel "-qopenmp") + endif() + if(CMAKE_${LANG}_COMPILER_ID STREQUAL "IntelLLVM" AND + "x${CMAKE_${LANG}_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") + set(OMP_FLAG_IntelLLVM "-Qiopenmp") + else() + set(OMP_FLAG_IntelLLVM "-fiopenmp") + endif() + set(OMP_FLAG_MSVC "-openmp:llvm") + set(OMP_FLAG_PathScale "-openmp") + set(OMP_FLAG_NAG "-openmp") + set(OMP_FLAG_Absoft "-openmp") + set(OMP_FLAG_NVHPC "-mp") + set(OMP_FLAG_PGI "-mp") + set(OMP_FLAG_Flang "-fopenmp") + set(OMP_FLAG_SunPro "-xopenmp") + set(OMP_FLAG_XL "-qsmp=omp") + set(OMP_FLAG_Cray "-h omp") + set(OMP_FLAG_Fujitsu "-Kopenmp") + set(OMP_FLAG_FujitsuClang "-fopenmp") + foreach(_lang C CXX) + if(DEFINED OMP_FLAG_${CMAKE_${_lang}_COMPILER_ID}) + set(OpenMP_C_FLAGS "${OMP_FLAG_${CMAKE_${_lang}_COMPILER_ID}}" PARENT_SCOPE) + set(OpenMP_CXX_FLAGS "${OMP_FLAG_${CMAKE_${_lang}_COMPILER_ID}}" PARENT_SCOPE) + break() + endif() + endforeach() +endfunction() + +_openmp_set_flags() +if(NOT DEFINED OpenMP_C_FLAGS) + message(FATAL_ERROR "OpenMP build flags not found for compiler \"${CMAKE_C_COMPILER_ID}\"") +endif() +set_target_properties(unofficial::llvm-openmp::omp PROPERTIES + INTERFACE_COMPILE_OPTIONS "${OpenMP_C_FLAGS}" + INTERFACE_LINK_OPTIONS "${OpenMP_C_FLAGS}" +) + +# Determine OpenMP specification date and version supported by the compiler. +function(_openmp_get_compiler_spec_date) + set(BUILD_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP") + set(SRC_FILE "${BUILD_DIR}/ompver.c") + if(NOT CMAKE_C_COMPILER_LOADED) + set(SRC_FILE "${BUILD_DIR}/ompver.cpp") + endif() + set(BIN_FILE "${BUILD_DIR}/ompver.bin") + file(WRITE "${SRC_FILE}" " + #include + #include + const char ompver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M', + 'P', '-', 'd', 'a', 't', 'e', '[', + ('0' + ((_OPENMP/100000)%10)), + ('0' + ((_OPENMP/10000)%10)), + ('0' + ((_OPENMP/1000)%10)), + ('0' + ((_OPENMP/100)%10)), + ('0' + ((_OPENMP/10)%10)), + ('0' + ((_OPENMP/1)%10)), + ']', '\\0' }; + int main(void) + { + puts(ompver_str); + return 0; + } + ") + set(CMAKE_REQUIRED_INCLUDES "${OpenMP_C_INCLUDE_DIR}") + try_compile(OpenMP_SPECTEST ${BUILD_DIR} + SOURCES "${SRC_FILE}" + COMPILE_DEFINITIONS "${OpenMP_C_FLAGS}" + COPY_FILE "${BIN_FILE}" + ) + if(NOT OpenMP_SPECTEST) + if(OpenMP_FIND_REQUIRED) + message(FATAL_ERROR "Failed to build OpenMP test executable for specification date detection") + elseif(NOT OpenMP_FIND_QUIETLY) + message(SEND_ERROR "Failed to build OpenMP test executable for specification date detection") + endif() + return() + endif() + file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenMP-date") + if(specstr MATCHES ".*INFO:OpenMP-date\\[0*([^]]*)\\].*") + set(OpenMP_SPEC_DATE ${CMAKE_MATCH_1} PARENT_SCOPE) + else() + if(OpenMP_FIND_REQUIRED) + message(FATAL_ERROR "Failed to detect OpenMP specification date") + elseif(NOT OpenMP_FIND_QUIETLY) + message(SEND_ERROR "Failed to detect OpenMP specification date") + endif() + return() + endif() + set(OpenMP_SPEC_DATE ${OpenMP_SPEC_DATE} CACHE STRING "OpenMP specification date" FORCE) +endfunction() + +function(_openmp_set_version_by_spec_date) + set(OpenMP_SPEC_DATE_MAP + "202111=5.2" + "202011=5.1" + # Preview versions + "201611=5.0" # OpenMP 5.0 preview 1 + # Combined versions, 2.5 onwards + "201811=5.0" + "201611=5.0" + "201511=4.5" + "201307=4.0" + "201107=3.1" + "200805=3.0" + "200505=2.5" + # C/C++ version 2.0 + "200203=2.0" + # Fortran version 2.0 + "200011=2.0" + # Fortran version 1.1 + "199911=1.1" + # C/C++ version 1.0 (there's no 1.1 for C/C++) + "199810=1.0" + # Fortran version 1.0 + "199710=1.0" + ) + if(OpenMP_SPEC_DATE_MAP MATCHES "${OpenMP_SPEC_DATE}=([0-9]+)\\.([0-9]+)") + set(major "${CMAKE_MATCH_1}") + set(minor "${CMAKE_MATCH_2}") + else() + if(OpenMP_FIND_REQUIRED) + message(FATAL_ERROR "Failed to detect OpenMP specification version") + elseif(NOT OpenMP_FIND_QUIETLY) + message(SEND_ERROR "Failed to detect OpenMP specification version") + endif() + return() + endif() + set(OpenMP_VERSION_MAJOR "${major}" PARENT_SCOPE) + set(OpenMP_VERSION_MINOR "${minor}" PARENT_SCOPE) + set(OpenMP_VERSION "${major}.${minor}" PARENT_SCOPE) +endfunction() + +# Compare the OpenMP API version supported by the compiler to +# the version supported by the LLVM OMP runtime and use the lower of the two. +# Note that this differs slightly from the CMake's FindOpenMP.cmake implementation, +# which checks only the version supported by the compiler. +_openmp_get_compiler_spec_date() +if(OpenMP_SPEC_DATE GREATER @OpenMP_SPEC_DATE@) + set(OpenMP_SPEC_DATE @OpenMP_SPEC_DATE@) + set(OpenMP_VERSION_MAJOR @OpenMP_VERSION_MAJOR@) + set(OpenMP_VERSION_MINOR @OpenMP_VERSION_MINOR@) + set(OpenMP_VERSION @OpenMP_VERSION@) +else() + _openmp_set_version_by_spec_date() +endif() + +foreach(_lang C CXX) + set(OpenMP_${_lang}_FOUND TRUE) + set(OpenMP_${_lang}_SPEC_DATE "${OpenMP_SPEC_DATE}") + set(OpenMP_${_lang}_VERSION_MAJOR "${OpenMP_VERSION_MAJOR}") + set(OpenMP_${_lang}_VERSION_MINOR "${OpenMP_VERSION_MINOR}") + set(OpenMP_${_lang}_VERSION "${OpenMP_VERSION}") +endforeach() + +# Check specification version against the requested min version, validate components +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenMP + VERSION_VAR OpenMP_VERSION + REQUIRED_VARS + OpenMP_C_FLAGS + OpenMP_C_LIB_NAMES + OpenMP_C_SPEC_DATE + OpenMP_C_VERSION + OpenMP_CXX_FLAGS + OpenMP_CXX_LIB_NAMES + OpenMP_CXX_SPEC_DATE + OpenMP_CXX_VERSION + HANDLE_COMPONENTS +) +set(OPENMP_FOUND ${OpenMP_FOUND}) +set(OpenMP_C_FOUND ${OpenMP_FOUND}) +set(OpenMP_CXX_FOUND ${OpenMP_FOUND}) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake new file mode 100644 index 00000000000000..381a513bd37415 --- /dev/null +++ b/ports/llvm-openmp/portfile.cmake @@ -0,0 +1,68 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/openmp-${VERSION}.src.tar.xz" + FILENAME "llvm-openmp-${VERSION}.src.tar.xz" + SHA512 f96f5fd4c508f1390e53b943237aa7e1db1301ef660f0864305556d581275576d585ef222a82d2359d43ad8ed166096d9ec6c05ab0ee57a01679cff6b4ecba4b +) +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0001-disable-libomp-aliases.patch + 0002-disable-tests.patch + 0003-fix-windows-import-lib-name.patch + 0004-install-config.patch +) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/cmake-${VERSION}.src.tar.xz" + FILENAME "llvm-cmake-${VERSION}.src.tar.xz" + SHA512 1334647f4be280b41858aa272bebc65e935cab772001032f77040396ba7472fbd5eb6a1a0c042ab7156540075705b7f05c8de2f02e2ce9d7ec1ec27be6bef86f +) +vcpkg_extract_source_archive(CMAKE_SOURCE_PATH + ARCHIVE "${ARCHIVE}" +) +file(GLOB_RECURSE CMAKE_MODULES "${CMAKE_SOURCE_PATH}/*.cmake") +file(COPY ${CMAKE_MODULES} DESTINATION "${SOURCE_PATH}/cmake") + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) + +# Perl is required for the OpenMP run-time +vcpkg_find_acquire_program(PERL) + +if(MSVC) + # The library name otherwise includes a "lib" prefix on Windows, which is inconsistent with other platforms. + set(EXTRA_VARS -DLIBOMP_LIB_NAME=omp) +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DOPENMP_STANDALONE_BUILD=ON + -DLIBOMP_ENABLE_SHARED=${ENABLE_SHARED} + -DLIBOMP_INSTALL_ALIASES=OFF + -DOPENMP_ENABLE_LIBOMPTARGET=OFF # Currently libomptarget cannot be compiled on Windows or MacOS X. + -DOPENMP_ENABLE_OMPT_TOOLS=OFF # Currently tools are not tested well on Windows or MacOS X. + -DLIBOMP_OMPT_SUPPORT=OFF + -DLLVM_OPENMP_VERSION=${VERSION} + -DPERL_EXECUTABLE=${PERL} + ${EXTRA_VARS} +) + +vcpkg_cmake_install() + +# llvm-openmp has hardcoded its OMP runtime version since v9 +# https://github.com/llvm/llvm-project/commit/e4b4f994d2f6a090694276b40d433dc1a58beb24 +set(OpenMP_VERSION 5.0) +set(OpenMP_VERSION_MAJOR 5) +set(OpenMP_VERSION_MINOR 0) +set(OpenMP_SPEC_DATE 201611) +configure_file("${CMAKE_CURRENT_LIST_DIR}/FindOpenMP.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/FindOpenMP.cmake" @ONLY) + +# Remove debug headers and tools +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" + "${CURRENT_PACKAGES_DIR}/debug/tools" + ) +endif() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.TXT") diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json new file mode 100644 index 00000000000000..56c0c79ffe5149 --- /dev/null +++ b/ports/llvm-openmp/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "llvm-openmp", + "version": "18.1.6", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} From 9d4762e5bc6506acde554da316644061c165b195 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 16:15:03 +0300 Subject: [PATCH 02/46] [openmp] new meta-package --- ports/openmp/portfile.cmake | 3 +++ ports/openmp/vcpkg-cmake-wrapper.cmake | 6 ++++++ ports/openmp/vcpkg.json | 13 +++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 ports/openmp/portfile.cmake create mode 100644 ports/openmp/vcpkg-cmake-wrapper.cmake create mode 100644 ports/openmp/vcpkg.json diff --git a/ports/openmp/portfile.cmake b/ports/openmp/portfile.cmake new file mode 100644 index 00000000000000..b565e1840f1009 --- /dev/null +++ b/ports/openmp/portfile.cmake @@ -0,0 +1,3 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/openmp/vcpkg-cmake-wrapper.cmake" COPYONLY) diff --git a/ports/openmp/vcpkg-cmake-wrapper.cmake b/ports/openmp/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000000..b38731a8fc989e --- /dev/null +++ b/ports/openmp/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,6 @@ +set(_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") + list(PREPEND CMAKE_MODULE_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/llvm-openmp") +endif() +_find_package(${ARGS}) +set(CMAKE_MODULE_PATH "${_CMAKE_MODULE_PATH}") diff --git a/ports/openmp/vcpkg.json b/ports/openmp/vcpkg.json new file mode 100644 index 00000000000000..7975cafafba33f --- /dev/null +++ b/ports/openmp/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "openmp", + "version-date": "2024-06-19", + "description": "Metapackage for OpenMP libraries", + "license": null, + "dependencies": [ + "llvm-openmp", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} From d604a3814669055b34c520369dfcefb5de16783f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 17:21:54 +0300 Subject: [PATCH 03/46] [dmlc] add openmp dependency as a test --- ports/dmlc/vcpkg.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/dmlc/vcpkg.json b/ports/dmlc/vcpkg.json index 22652c3ce44496..152cd5b11b7047 100644 --- a/ports/dmlc/vcpkg.json +++ b/ports/dmlc/vcpkg.json @@ -1,6 +1,7 @@ { "name": "dmlc", "version-date": "2022-06-22", + "port-version": 1, "description": "DMLC-Core is the backbone library to support all DMLC projects, offers the bricks to build efficient and scalable distributed machine learning libraries.", "homepage": "https://github.com/dmlc/dmlc-core", "license": "Apache-2.0", @@ -15,9 +16,15 @@ "host": true } ], + "default-features": [ + "openmp" + ], "features": { "openmp": { - "description": "Build with openmp" + "description": "Build with openmp", + "dependencies": [ + "openmp" + ] } } } From 02de561d598cb2cabc43de683f93ee2aa85d9fad Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 17:22:42 +0300 Subject: [PATCH 04/46] vdb --- versions/baseline.json | 10 +++++++++- versions/d-/dmlc.json | 5 +++++ versions/l-/llvm-openmp.json | 9 +++++++++ versions/o-/openmp.json | 9 +++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 versions/l-/llvm-openmp.json create mode 100644 versions/o-/openmp.json diff --git a/versions/baseline.json b/versions/baseline.json index c318a165ae71fe..68cc0bad92eb5a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2314,7 +2314,7 @@ }, "dmlc": { "baseline": "2022-06-22", - "port-version": 0 + "port-version": 1 }, "docopt": { "baseline": "2022-03-15", @@ -5412,6 +5412,10 @@ "baseline": "18.1.6", "port-version": 0 }, + "llvm-openmp": { + "baseline": "18.1.6", + "port-version": 0 + }, "lmdb": { "baseline": "0.9.31", "port-version": 0 @@ -6516,6 +6520,10 @@ "baseline": "10.0", "port-version": 0 }, + "openmp": { + "baseline": "2024-06-19", + "port-version": 0 + }, "openmpi": { "baseline": "4.1.6", "port-version": 1 diff --git a/versions/d-/dmlc.json b/versions/d-/dmlc.json index 5c83422ee6ffe6..29c4b4e0a3a76c 100644 --- a/versions/d-/dmlc.json +++ b/versions/d-/dmlc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2563d66c5586c3e796de05ddc7eae378ef93c50a", + "version-date": "2022-06-22", + "port-version": 1 + }, { "git-tree": "23dbee1949340c7bc6377d1acb7007faf7ba2247", "version-date": "2022-06-22", diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json new file mode 100644 index 00000000000000..7bcae233d6f509 --- /dev/null +++ b/versions/l-/llvm-openmp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "50d2753ae2470c239c3fb97df1322d6abaa28b9d", + "version": "18.1.6", + "port-version": 0 + } + ] +} diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json new file mode 100644 index 00000000000000..2599369c82d2bd --- /dev/null +++ b/versions/o-/openmp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "6a765367bb83a4dd4fada4e5bbdef6d321b565cc", + "version-date": "2024-06-19", + "port-version": 0 + } + ] +} From c706c61e98f34af10946e0a7faea237e3efcc55f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 17:30:54 +0300 Subject: [PATCH 05/46] [llvm-openmp] fix portfile.cmake issue --- ports/llvm-openmp/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 381a513bd37415..25d7589956f951 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -28,7 +28,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) -if(MSVC) +if(VCPKG_HOST_IS_WINDOWS) # The library name otherwise includes a "lib" prefix on Windows, which is inconsistent with other platforms. set(EXTRA_VARS -DLIBOMP_LIB_NAME=omp) endif() From 2b82509f6ed3f280bbb0c821494cd3b1e4e894b1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 17:38:35 +0300 Subject: [PATCH 06/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 7bcae233d6f509..c095bb5ac50e11 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "50d2753ae2470c239c3fb97df1322d6abaa28b9d", + "git-tree": "f48df843ce6d3d5b84b7922ead88e4dd2007f612", "version": "18.1.6", "port-version": 0 } From 56d87ef245ab49fad7d54bfc6d9cc185165d9cec Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 18:03:01 +0300 Subject: [PATCH 07/46] [dmlc] add missing dependency to installed config --- ports/dmlc/add-config-deps.patch | 12 ++++++++++++ ports/dmlc/portfile.cmake | 1 + 2 files changed, 13 insertions(+) create mode 100644 ports/dmlc/add-config-deps.patch diff --git a/ports/dmlc/add-config-deps.patch b/ports/dmlc/add-config-deps.patch new file mode 100644 index 00000000000000..4d7941f83efafb --- /dev/null +++ b/ports/dmlc/add-config-deps.patch @@ -0,0 +1,12 @@ +--- a/cmake/dmlc-config.cmake.in ++++ b/cmake/dmlc-config.cmake.in +@@ -1,4 +1,9 @@ + @PACKAGE_INIT@ ++ ++include(CMakeFindDependencyMacro) ++if(@USE_OPENMP@) ++ find_dependency(OpenMP REQUIRED) ++endif() + + if(NOT TARGET dmlc::dmlc) + include(${CMAKE_CURRENT_LIST_DIR}/DMLCTargets.cmake) diff --git a/ports/dmlc/portfile.cmake b/ports/dmlc/portfile.cmake index 16d819590ab19a..26593f843ea8c4 100644 --- a/ports/dmlc/portfile.cmake +++ b/ports/dmlc/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( HEAD_REF main PATCHES cxx-fix.patch # from https://github.com/dmlc/dmlc-core/pull/676 + add-config-deps.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 7147c2a393deac95bf180f59a4d236ad70a8316a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 18:03:04 +0300 Subject: [PATCH 08/46] vdb --- versions/d-/dmlc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/d-/dmlc.json b/versions/d-/dmlc.json index 29c4b4e0a3a76c..eeb5c78d24ecc2 100644 --- a/versions/d-/dmlc.json +++ b/versions/d-/dmlc.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "2563d66c5586c3e796de05ddc7eae378ef93c50a", + "git-tree": "a9a5733a3548ffb8e860e259ea1181ec56da4a8f", "version-date": "2022-06-22", "port-version": 1 }, From 093f31f8a1902ead0775bb5d3497e8e4bd91c19b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 18:29:58 +0300 Subject: [PATCH 09/46] [llvm-openmp] disable unsupported i18n on Android --- .../llvm-openmp/0005-disable-i18n-on-android.patch | 13 +++++++++++++ ports/llvm-openmp/portfile.cmake | 1 + 2 files changed, 14 insertions(+) create mode 100644 ports/llvm-openmp/0005-disable-i18n-on-android.patch diff --git a/ports/llvm-openmp/0005-disable-i18n-on-android.patch b/ports/llvm-openmp/0005-disable-i18n-on-android.patch new file mode 100644 index 00000000000000..fe2c45fa5dfda3 --- /dev/null +++ b/ports/llvm-openmp/0005-disable-i18n-on-android.patch @@ -0,0 +1,13 @@ +Vcpkg Android platforms are missing catopen, catgets and catclose functions. + +--- a/runtime/src/kmp_i18n.cpp ++++ b/runtime/src/kmp_i18n.cpp +@@ -70,7 +70,7 @@ + } // func __kmp_i18n_catopen + + /* Linux* OS and OS X* part */ +-#if KMP_OS_UNIX ++#if KMP_OS_UNIX && !__ANDROID__ + #define KMP_I18N_OK + + #include diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 25d7589956f951..28b4093613ebc6 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_extract_source_archive(SOURCE_PATH 0002-disable-tests.patch 0003-fix-windows-import-lib-name.patch 0004-install-config.patch + 0005-disable-i18n-on-android.patch ) vcpkg_download_distfile(ARCHIVE From 3923506ed1f363498064886f45652185ff4f48f8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 18:30:08 +0300 Subject: [PATCH 10/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index c095bb5ac50e11..fda1838baa2972 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "f48df843ce6d3d5b84b7922ead88e4dd2007f612", + "git-tree": "d1b023024e37f1b9ea5bf660f32b1f901ca63302", "version": "18.1.6", "port-version": 0 } From a5e393d87250905b9388e48ee7bd22cfc4aca676 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 19:26:32 +0300 Subject: [PATCH 11/46] [llvm-openmp] fixes for AppleClang --- ports/llvm-openmp/FindOpenMP.cmake.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in index 06dc4cb36d7ba3..f635155cdb8dcb 100644 --- a/ports/llvm-openmp/FindOpenMP.cmake.in +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -5,6 +5,11 @@ find_dependency(unofficial-llvm-openmp CONFIG REQUIRED) get_target_property(_OpenMP_INCLUDE_DIR unofficial::llvm-openmp::omp INTERFACE_INCLUDE_DIRECTORIES) get_target_property(_OpenMP_LIB_NAMES unofficial::llvm-openmp::omp INTERFACE_LINK_LIBRARIES) +# handle omp location being set directly via IMPORTED_LOCATION instead +if(NOT _OpenMP_LIB_NAMES) + set(_OpenMP_LIB_NAMES omp) +endif() + foreach(_lang C CXX) set(OpenMP_${_lang}_INCLUDE_DIR "${_OpenMP_INCLUDE_DIR}") set(OpenMP_${_lang}_INCLUDE_DIRS "${_OpenMP_INCLUDE_DIR}") @@ -91,10 +96,11 @@ function(_openmp_get_compiler_spec_date) return 0; } ") - set(CMAKE_REQUIRED_INCLUDES "${OpenMP_C_INCLUDE_DIR}") try_compile(OpenMP_SPECTEST ${BUILD_DIR} SOURCES "${SRC_FILE}" - COMPILE_DEFINITIONS "${OpenMP_C_FLAGS}" + CMAKE_FLAGS + "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_C_FLAGS}" + "-DINCLUDE_DIRECTORIES:STRING=${OpenMP_C_INCLUDE_DIR}" COPY_FILE "${BIN_FILE}" ) if(NOT OpenMP_SPECTEST) From 53dfe61e5e8572f493a97585f9b77ae685e4b813 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 19:27:18 +0300 Subject: [PATCH 12/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index fda1838baa2972..be58f2397c7b72 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "d1b023024e37f1b9ea5bf660f32b1f901ca63302", + "git-tree": "18fc71abd7ffd85b49fef9d0d348aba515e0e5a5", "version": "18.1.6", "port-version": 0 } From a5e43c06c0280b9807dd3b9820908d543c7f23f3 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:28:28 +0300 Subject: [PATCH 13/46] [llvm-openmp] add gettext-libintl for Android --- ports/llvm-openmp/0004-install-config.patch | 9 ++++-- .../0005-disable-i18n-on-android.patch | 13 --------- .../0005-fix-android-i18n-support.patch | 29 +++++++++++++++++++ ports/llvm-openmp/llvm-openmp-config.cmake.in | 8 +++++ ports/llvm-openmp/portfile.cmake | 4 ++- ports/llvm-openmp/vcpkg.json | 4 +++ 6 files changed, 51 insertions(+), 16 deletions(-) delete mode 100644 ports/llvm-openmp/0005-disable-i18n-on-android.patch create mode 100644 ports/llvm-openmp/0005-fix-android-i18n-support.patch create mode 100644 ports/llvm-openmp/llvm-openmp-config.cmake.in diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch index 8c18848dbbe450..6aac9b5d304aac 100644 --- a/ports/llvm-openmp/0004-install-config.patch +++ b/ports/llvm-openmp/0004-install-config.patch @@ -18,7 +18,7 @@ if(${LIBOMP_INSTALL_ALIASES}) # Create aliases (symlinks) of the library for backwards compatibility -@@ -415,3 +415,22 @@ +@@ -415,3 +415,27 @@ DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ) endif() @@ -27,17 +27,22 @@ + +set(PORT_SHARE_DIR share/unofficial-llvm-openmp) +install(EXPORT llvm-openmp-targets -+ FILE unofficial-llvm-openmp-config.cmake ++ FILE unofficial-llvm-openmp-targets.cmake + NAMESPACE unofficial::llvm-openmp:: + DESTINATION ${PORT_SHARE_DIR} +) +include(CMakePackageConfigHelpers) ++configure_package_config_file(${CMAKE_SOURCE_DIR}/runtime/cmake/llvm-openmp-config.cmake.in ++ ${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config.cmake ++ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/share/unofficial-llvm-openmp ++) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config-version.cmake" + VERSION ${LLVM_OPENMP_VERSION} + COMPATIBILITY SameMajorVersion +) +install(FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-llvm-openmp-config-version.cmake" + DESTINATION ${PORT_SHARE_DIR} +) diff --git a/ports/llvm-openmp/0005-disable-i18n-on-android.patch b/ports/llvm-openmp/0005-disable-i18n-on-android.patch deleted file mode 100644 index fe2c45fa5dfda3..00000000000000 --- a/ports/llvm-openmp/0005-disable-i18n-on-android.patch +++ /dev/null @@ -1,13 +0,0 @@ -Vcpkg Android platforms are missing catopen, catgets and catclose functions. - ---- a/runtime/src/kmp_i18n.cpp -+++ b/runtime/src/kmp_i18n.cpp -@@ -70,7 +70,7 @@ - } // func __kmp_i18n_catopen - - /* Linux* OS and OS X* part */ --#if KMP_OS_UNIX -+#if KMP_OS_UNIX && !__ANDROID__ - #define KMP_I18N_OK - - #include diff --git a/ports/llvm-openmp/0005-fix-android-i18n-support.patch b/ports/llvm-openmp/0005-fix-android-i18n-support.patch new file mode 100644 index 00000000000000..168494711a141c --- /dev/null +++ b/ports/llvm-openmp/0005-fix-android-i18n-support.patch @@ -0,0 +1,29 @@ +Android NDK lacks catopen, catgets, and catclose. Use libintl instead. + +--- a/runtime/src/kmp_i18n.cpp ++++ b/runtime/src/kmp_i18n.cpp +@@ -73,7 +73,10 @@ + #if KMP_OS_UNIX + #define KMP_I18N_OK + + #include ++#if __ANDROID__ ++#include ++#endif + + #define KMP_I18N_NULLCAT ((nl_catd)(-1)) + static nl_catd cat = KMP_I18N_NULLCAT; // !!! Shall it be volatile? + +--- a/runtime/src/CMakeLists.txt ++++ b/runtime/src/CMakeLists.txt +@@ -161,6 +161,10 @@ + add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES}) + # Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS + target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) ++ if(ANDROID) ++ find_package(Intl REQUIRED) ++ target_link_libraries(omp PRIVATE Intl::Intl) ++ endif() + else() + add_llvm_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES} PARTIAL_SOURCES_INTENDED + LINK_LIBS ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS} diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in new file mode 100644 index 00000000000000..67802cd9585c82 --- /dev/null +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ + +if(ANDROID) + include(CMakeFindDependencyMacro) + find_dependency(Intl REQUIRED) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 28b4093613ebc6..616f3633dd0693 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -10,7 +10,7 @@ vcpkg_extract_source_archive(SOURCE_PATH 0002-disable-tests.patch 0003-fix-windows-import-lib-name.patch 0004-install-config.patch - 0005-disable-i18n-on-android.patch + 0005-fix-android-i18n-support.patch ) vcpkg_download_distfile(ARCHIVE @@ -24,6 +24,8 @@ vcpkg_extract_source_archive(CMAKE_SOURCE_PATH file(GLOB_RECURSE CMAKE_MODULES "${CMAKE_SOURCE_PATH}/*.cmake") file(COPY ${CMAKE_MODULES} DESTINATION "${SOURCE_PATH}/cmake") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/llvm-openmp-config.cmake.in" DESTINATION "${SOURCE_PATH}/runtime/cmake") + string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) # Perl is required for the OpenMP run-time diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json index 56c0c79ffe5149..47e943c712e26a 100644 --- a/ports/llvm-openmp/vcpkg.json +++ b/ports/llvm-openmp/vcpkg.json @@ -5,6 +5,10 @@ "homepage": "https://llvm.org", "license": "Apache-2.0", "dependencies": [ + { + "name": "gettext-libintl", + "platform": "android" + }, { "name": "vcpkg-cmake", "host": true From 200dde7401f35f50672427e99257f82e5243905a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:30:45 +0300 Subject: [PATCH 14/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index be58f2397c7b72..aa0db90b23e783 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "18fc71abd7ffd85b49fef9d0d348aba515e0e5a5", + "git-tree": "5a73b573cd7d57bc329440aa544d4c4d7a9ac26d", "version": "18.1.6", "port-version": 0 } From a69c5baafc09eb028ca8a60ae9f52aec06a0e962 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:42:22 +0300 Subject: [PATCH 15/46] [llvm-openmp] fix a CMake error --- ports/llvm-openmp/0005-fix-android-i18n-support.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/llvm-openmp/0005-fix-android-i18n-support.patch b/ports/llvm-openmp/0005-fix-android-i18n-support.patch index 168494711a141c..f1e233140fc3c4 100644 --- a/ports/llvm-openmp/0005-fix-android-i18n-support.patch +++ b/ports/llvm-openmp/0005-fix-android-i18n-support.patch @@ -19,7 +19,8 @@ Android NDK lacks catopen, catgets, and catclose. Use libintl instead. @@ -161,6 +161,10 @@ add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES}) # Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS - target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) +- target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) ++ target_link_libraries(omp PUBLIC ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) + if(ANDROID) + find_package(Intl REQUIRED) + target_link_libraries(omp PRIVATE Intl::Intl) From aa78b5f9dbfa3697b8640c58428d43a25f9081e8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:42:28 +0300 Subject: [PATCH 16/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index aa0db90b23e783..edd9e0c3ac82bf 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "5a73b573cd7d57bc329440aa544d4c4d7a9ac26d", + "git-tree": "0ad734a46d2012f969a96ace1cc1a72d8cc14fc1", "version": "18.1.6", "port-version": 0 } From c963fd9a74e9ea796ea5894db22039081ce7ef27 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:54:51 +0300 Subject: [PATCH 17/46] [llvm-openmp] Android is not supported due to nl_types.h --- .../0005-fix-android-i18n-support.patch | 30 ------------------- ports/llvm-openmp/llvm-openmp-config.cmake.in | 5 ---- ports/llvm-openmp/portfile.cmake | 1 - ports/llvm-openmp/vcpkg.json | 5 +--- ports/openmp/vcpkg.json | 5 +++- 5 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 ports/llvm-openmp/0005-fix-android-i18n-support.patch diff --git a/ports/llvm-openmp/0005-fix-android-i18n-support.patch b/ports/llvm-openmp/0005-fix-android-i18n-support.patch deleted file mode 100644 index f1e233140fc3c4..00000000000000 --- a/ports/llvm-openmp/0005-fix-android-i18n-support.patch +++ /dev/null @@ -1,30 +0,0 @@ -Android NDK lacks catopen, catgets, and catclose. Use libintl instead. - ---- a/runtime/src/kmp_i18n.cpp -+++ b/runtime/src/kmp_i18n.cpp -@@ -73,7 +73,10 @@ - #if KMP_OS_UNIX - #define KMP_I18N_OK - - #include -+#if __ANDROID__ -+#include -+#endif - - #define KMP_I18N_NULLCAT ((nl_catd)(-1)) - static nl_catd cat = KMP_I18N_NULLCAT; // !!! Shall it be volatile? - ---- a/runtime/src/CMakeLists.txt -+++ b/runtime/src/CMakeLists.txt -@@ -161,6 +161,10 @@ - add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES}) - # Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS -- target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) -+ target_link_libraries(omp PUBLIC ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) -+ if(ANDROID) -+ find_package(Intl REQUIRED) -+ target_link_libraries(omp PRIVATE Intl::Intl) -+ endif() - else() - add_llvm_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES} PARTIAL_SOURCES_INTENDED - LINK_LIBS ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS} diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 67802cd9585c82..20a833a9f44aec 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -1,8 +1,3 @@ @PACKAGE_INIT@ -if(ANDROID) - include(CMakeFindDependencyMacro) - find_dependency(Intl REQUIRED) -endif() - include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 616f3633dd0693..c52e227852afce 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -10,7 +10,6 @@ vcpkg_extract_source_archive(SOURCE_PATH 0002-disable-tests.patch 0003-fix-windows-import-lib-name.patch 0004-install-config.patch - 0005-fix-android-i18n-support.patch ) vcpkg_download_distfile(ARCHIVE diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json index 47e943c712e26a..4eb48054e1f64a 100644 --- a/ports/llvm-openmp/vcpkg.json +++ b/ports/llvm-openmp/vcpkg.json @@ -4,11 +4,8 @@ "description": "The LLVM Compiler Infrastructure.", "homepage": "https://llvm.org", "license": "Apache-2.0", + "supports": "!android", "dependencies": [ - { - "name": "gettext-libintl", - "platform": "android" - }, { "name": "vcpkg-cmake", "host": true diff --git a/ports/openmp/vcpkg.json b/ports/openmp/vcpkg.json index 7975cafafba33f..0c2db60439f822 100644 --- a/ports/openmp/vcpkg.json +++ b/ports/openmp/vcpkg.json @@ -4,7 +4,10 @@ "description": "Metapackage for OpenMP libraries", "license": null, "dependencies": [ - "llvm-openmp", + { + "name": "llvm-openmp", + "platform": "!android" + }, { "name": "vcpkg-cmake", "host": true From 5c8c4ed2ab460941ed48bf8d4a67d8ed8e823196 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 20:54:56 +0300 Subject: [PATCH 18/46] vdb --- versions/l-/llvm-openmp.json | 2 +- versions/o-/openmp.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index edd9e0c3ac82bf..d56ab36e74068b 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "0ad734a46d2012f969a96ace1cc1a72d8cc14fc1", + "git-tree": "d25801f41baa15d267c47100e6402d3cbaf0a083", "version": "18.1.6", "port-version": 0 } diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json index 2599369c82d2bd..e9918961d81b77 100644 --- a/versions/o-/openmp.json +++ b/versions/o-/openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "6a765367bb83a4dd4fada4e5bbdef6d321b565cc", + "git-tree": "956e1b466ae3cf462cc1e29c8a5d61d91cce0b14", "version-date": "2024-06-19", "port-version": 0 } From 69c8752ac501fe00efd7a231ea8e637aa78a0b64 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 21:16:47 +0300 Subject: [PATCH 19/46] [llvm-openmp] temporarily always use llvm-openmp for testing --- ports/openmp/vcpkg-cmake-wrapper.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/openmp/vcpkg-cmake-wrapper.cmake b/ports/openmp/vcpkg-cmake-wrapper.cmake index b38731a8fc989e..246503feea1477 100644 --- a/ports/openmp/vcpkg-cmake-wrapper.cmake +++ b/ports/openmp/vcpkg-cmake-wrapper.cmake @@ -1,6 +1,6 @@ set(_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") -if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") +# if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") list(PREPEND CMAKE_MODULE_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/llvm-openmp") -endif() +# endif() _find_package(${ARGS}) set(CMAKE_MODULE_PATH "${_CMAKE_MODULE_PATH}") From eb1057c61daee28fb6658f99f062a04de8afddb5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jun 2024 21:16:53 +0300 Subject: [PATCH 20/46] vdb --- versions/o-/openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json index e9918961d81b77..ce91436c206b6f 100644 --- a/versions/o-/openmp.json +++ b/versions/o-/openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "956e1b466ae3cf462cc1e29c8a5d61d91cce0b14", + "git-tree": "a6624de1c34edb67d00dcadc1362351c39a6304c", "version-date": "2024-06-19", "port-version": 0 } From 2bd4b354087f580c4571caae6f0f74898ed92b35 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 09:54:31 +0300 Subject: [PATCH 21/46] [llvm-openmp] only shared builds are supported by the project on Windows --- ports/llvm-openmp/portfile.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index c52e227852afce..00c01af324361d 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -1,3 +1,8 @@ +if (VCPKG_TARGET_IS_WINDOWS) + # https://github.com/llvm/llvm-project/blob/llvmorg-18.1.6/openmp/runtime/CMakeLists.txt#L331 + vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) +endif() + vcpkg_download_distfile(ARCHIVE URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/openmp-${VERSION}.src.tar.xz" FILENAME "llvm-openmp-${VERSION}.src.tar.xz" @@ -30,7 +35,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) -if(VCPKG_HOST_IS_WINDOWS) +if(VCPKG_TARGET_IS_WINDOWS) # The library name otherwise includes a "lib" prefix on Windows, which is inconsistent with other platforms. set(EXTRA_VARS -DLIBOMP_LIB_NAME=omp) endif() From 0ff691a1861e46f65152bcb803c8e723ad8d4761 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 09:56:58 +0300 Subject: [PATCH 22/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index d56ab36e74068b..2eb509ef4ecd12 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "d25801f41baa15d267c47100e6402d3cbaf0a083", + "git-tree": "8d294695e4b12d330eae0d09e58259ba58c94343", "version": "18.1.6", "port-version": 0 } From 7b7d2d39a43ea789ee21175825148bb230384d30 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 13:00:13 +0300 Subject: [PATCH 23/46] [llvm-openmp] add ONLY_DYNAMIC_CRT --- ports/llvm-openmp/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 00c01af324361d..c0f377dc486700 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -1,6 +1,6 @@ if (VCPKG_TARGET_IS_WINDOWS) # https://github.com/llvm/llvm-project/blob/llvmorg-18.1.6/openmp/runtime/CMakeLists.txt#L331 - vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) endif() vcpkg_download_distfile(ARCHIVE From 50bd3bf8f672d31ffcaad36e346db37c6e3f8e4c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 13:00:31 +0300 Subject: [PATCH 24/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 2eb509ef4ecd12..f02c501235a6da 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "8d294695e4b12d330eae0d09e58259ba58c94343", + "git-tree": "c6b63ecd45277c75c25e7ec86d4556643a09ee24", "version": "18.1.6", "port-version": 0 } From 1d69490088538786eaadf5b8e8012b772e4a92fc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 17:29:04 +0300 Subject: [PATCH 25/46] [llvm-openmp] remove unnecessary CACHE var --- ports/llvm-openmp/FindOpenMP.cmake.in | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in index f635155cdb8dcb..494fbad13117dd 100644 --- a/ports/llvm-openmp/FindOpenMP.cmake.in +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -122,7 +122,6 @@ function(_openmp_get_compiler_spec_date) endif() return() endif() - set(OpenMP_SPEC_DATE ${OpenMP_SPEC_DATE} CACHE STRING "OpenMP specification date" FORCE) endfunction() function(_openmp_set_version_by_spec_date) From d2f69f60b7eb126d39bb98bb895baec42527ec3a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 17:39:00 +0300 Subject: [PATCH 26/46] [llvm-openmp] force shared on Windows --- ports/llvm-openmp/portfile.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index c0f377dc486700..75849abf621bfd 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -1,4 +1,4 @@ -if (VCPKG_TARGET_IS_WINDOWS) +if(VCPKG_TARGET_IS_WINDOWS) # https://github.com/llvm/llvm-project/blob/llvmorg-18.1.6/openmp/runtime/CMakeLists.txt#L331 vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) endif() @@ -31,6 +31,9 @@ file(COPY ${CMAKE_MODULES} DESTINATION "${SOURCE_PATH}/cmake") file(COPY "${CMAKE_CURRENT_LIST_DIR}/llvm-openmp-config.cmake.in" DESTINATION "${SOURCE_PATH}/runtime/cmake") string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) +if(VCPKG_TARGET_IS_WINDOWS) + set(ENABLE_SHARED ON) +endif() # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) @@ -66,7 +69,8 @@ configure_file("${CMAKE_CURRENT_LIST_DIR}/FindOpenMP.cmake.in" "${CURRENT_PACKAG # Remove debug headers and tools if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/tools" ) From e966c87243d1391b13a000b0ccfa9508e5dd05a9 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 20 Jun 2024 17:40:42 +0300 Subject: [PATCH 27/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index f02c501235a6da..0b15f96ef9c7b9 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "c6b63ecd45277c75c25e7ec86d4556643a09ee24", + "git-tree": "6698b8d5cc6b2e21dfe6f9be7949972f8e18cbdc", "version": "18.1.6", "port-version": 0 } From eac6142d049426a2f0f338bcba6b00edea3e4c5e Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 21 Jun 2024 10:09:03 +0300 Subject: [PATCH 28/46] [llvm-openmp] try a different patch for Windows import lib issue --- .../0003-fix-windows-import-lib-name.patch | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch b/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch index 1ab690c518d07c..c62f859a443606 100644 --- a/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch +++ b/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch @@ -1,14 +1,14 @@ -The built import lib is named "libomp.dll.lib" otherwise, which causes install() to fail. +Fix a mismatch between the built and installed import lib name on Windows. https://github.com/llvm/llvm-project/issues/88876 ---- a/runtime/src/CMakeLists.txt -+++ b/runtime/src/CMakeLists.txt -@@ -284,7 +284,7 @@ - endif() - else() - set(LIBOMP_IMP_LIB_FILE ${LIBOMP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}) -- set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_FILE}${CMAKE_STATIC_LIBRARY_SUFFIX}) -+ set(LIBOMP_GENERATED_IMP_LIB_FILENAME ${LIBOMP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) +--- openmp/runtime/src/CMakeLists.txt ++++ openmp/runtime/src/CMakeLists.txt +@@ -303,7 +303,7 @@ + # 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 +- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} ++ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_GENERATED_IMP_LIB_FILENAME}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} + STATIC_LIBRARY_OPTIONS "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMPIMP_GENERATED_DEF_FILE}") + add_dependencies(${LIBOMP_IMP_LIB_TARGET} libompimp-needed-def-file) endif() - set_target_properties(omp PROPERTIES - VERSION ${LIBOMP_VERSION_MAJOR}.${LIBOMP_VERSION_MINOR} # uses /version flag From a7fa2b2a625a2d4c18d73211e0250be2cf72bb20 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 21 Jun 2024 10:09:17 +0300 Subject: [PATCH 29/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 0b15f96ef9c7b9..594a1c90cf04f8 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "6698b8d5cc6b2e21dfe6f9be7949972f8e18cbdc", + "git-tree": "627223ead3357d604583fd84b21f37c92bb18060", "version": "18.1.6", "port-version": 0 } From 1f9fbe6c6da23fc44586a3c91f282a5633c95fe2 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 00:19:20 +0300 Subject: [PATCH 30/46] [llvm-openmp] Fix Windows build --- .../0003-fix-windows-import-lib-name.patch | 14 -------------- ports/llvm-openmp/0004-install-config.patch | 7 ++++--- ports/llvm-openmp/FindOpenMP.cmake.in | 6 +++++- ports/llvm-openmp/llvm-openmp-config.cmake.in | 6 ++++++ ports/llvm-openmp/portfile.cmake | 5 ----- 5 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 ports/llvm-openmp/0003-fix-windows-import-lib-name.patch diff --git a/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch b/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch deleted file mode 100644 index c62f859a443606..00000000000000 --- a/ports/llvm-openmp/0003-fix-windows-import-lib-name.patch +++ /dev/null @@ -1,14 +0,0 @@ -Fix a mismatch between the built and installed import lib name on Windows. -https://github.com/llvm/llvm-project/issues/88876 - ---- openmp/runtime/src/CMakeLists.txt -+++ openmp/runtime/src/CMakeLists.txt -@@ -303,7 +303,7 @@ - # 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 -- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} -+ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_GENERATED_IMP_LIB_FILENAME}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} - STATIC_LIBRARY_OPTIONS "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMPIMP_GENERATED_DEF_FILE}") - add_dependencies(${LIBOMP_IMP_LIB_TARGET} libompimp-needed-def-file) - endif() diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch index 6aac9b5d304aac..f52563b76b8e0e 100644 --- a/ports/llvm-openmp/0004-install-config.patch +++ b/ports/llvm-openmp/0004-install-config.patch @@ -1,15 +1,16 @@ --- a/runtime/src/CMakeLists.txt +++ b/runtime/src/CMakeLists.txt -@@ -369,6 +369,6 @@ +@@ -369,6 +369,7 @@ # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR} # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR} if(WIN32) - install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") ++ set_target_properties(omp PROPERTIES IMPORTED_IMPLIB ${LIBOMP_IMP_LIB_TARGET}) + install(TARGETS omp ${export_to_llvmexports} EXPORT llvm-openmp-targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS ${LIBOMP_IMP_LIB_TARGET} EXPORT llvm-openmp-targets ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") # Create aliases (regular copies) of the library for backwards compatibility -@@ -382,7 +382,7 @@ +@@ -382,7 +383,7 @@ endforeach() else() @@ -18,7 +19,7 @@ if(${LIBOMP_INSTALL_ALIASES}) # Create aliases (symlinks) of the library for backwards compatibility -@@ -415,3 +415,27 @@ +@@ -415,3 +416,27 @@ DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ) endif() diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in index 494fbad13117dd..8e61bee106a61d 100644 --- a/ports/llvm-openmp/FindOpenMP.cmake.in +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -7,7 +7,11 @@ get_target_property(_OpenMP_LIB_NAMES unofficial::llvm-openmp::omp INTERFACE_LIN # handle omp location being set directly via IMPORTED_LOCATION instead if(NOT _OpenMP_LIB_NAMES) - set(_OpenMP_LIB_NAMES omp) + if(WIN32) + set(_OpenMP_LIB_NAMES libomp) + else() + set(_OpenMP_LIB_NAMES omp) + endif() endif() foreach(_lang C CXX) diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 20a833a9f44aec..40a86c411f577c 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -1,3 +1,9 @@ @PACKAGE_INIT@ include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) + +if(WIN32) + set_target_properties(unofficial::llvm-openmp::omp PROPERTIES + IMPORTED_IMPLIB ${CMAKE_CURRENT_LIST_FILE}/../../../lib/libomp.lib + ) +endif() diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 75849abf621bfd..36438b10031a2c 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -13,7 +13,6 @@ vcpkg_extract_source_archive(SOURCE_PATH PATCHES 0001-disable-libomp-aliases.patch 0002-disable-tests.patch - 0003-fix-windows-import-lib-name.patch 0004-install-config.patch ) @@ -38,10 +37,6 @@ endif() # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) -if(VCPKG_TARGET_IS_WINDOWS) - # The library name otherwise includes a "lib" prefix on Windows, which is inconsistent with other platforms. - set(EXTRA_VARS -DLIBOMP_LIB_NAME=omp) -endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" From 5d267283177b669ee5eb8baf59811bc6278ed7cd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 00:20:44 +0300 Subject: [PATCH 31/46] vdb --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 594a1c90cf04f8..2ed9b6611378d1 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "627223ead3357d604583fd84b21f37c92bb18060", + "git-tree": "feb2b9e108c7bdb47ad74958401b63dc2b3a7e41", "version": "18.1.6", "port-version": 0 } From ee6c93d16a7d709eab4224cbf3ec18e5bbc6474f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 08:06:41 +0300 Subject: [PATCH 32/46] [llvm-openmp] disable windows-static and uwp in supports uwp fails due to missing lstrcmpA. --- ports/llvm-openmp/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json index 4eb48054e1f64a..7db218842d6b68 100644 --- a/ports/llvm-openmp/vcpkg.json +++ b/ports/llvm-openmp/vcpkg.json @@ -4,7 +4,7 @@ "description": "The LLVM Compiler Infrastructure.", "homepage": "https://llvm.org", "license": "Apache-2.0", - "supports": "!android", + "supports": "!android & !(windows & static) & !uwp", "dependencies": [ { "name": "vcpkg-cmake", From 58ffc59aeb93cfe5584095aa693774682edc31ce Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 08:07:29 +0300 Subject: [PATCH 33/46] vdp --- versions/l-/llvm-openmp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 2ed9b6611378d1..e5f15f403d6fec 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "feb2b9e108c7bdb47ad74958401b63dc2b3a7e41", + "git-tree": "092829374416a21d8e65deba7d1c61cf7e4128ec", "version": "18.1.6", "port-version": 0 } From c929c144d0c2ecab5bd4de30a49d91011d8103a7 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 18:06:01 +0300 Subject: [PATCH 34/46] [llvm-openmp] Export 'omp' target without a namespace to match the 'llvm' package output --- ports/llvm-openmp/0004-install-config.patch | 8 +++----- ports/llvm-openmp/FindOpenMP.cmake.in | 14 +++++--------- ports/llvm-openmp/llvm-openmp-config.cmake.in | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch index f52563b76b8e0e..aa5cdde2ae5991 100644 --- a/ports/llvm-openmp/0004-install-config.patch +++ b/ports/llvm-openmp/0004-install-config.patch @@ -1,16 +1,15 @@ --- a/runtime/src/CMakeLists.txt +++ b/runtime/src/CMakeLists.txt -@@ -369,6 +369,7 @@ +@@ -369,6 +369,6 @@ # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR} # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR} if(WIN32) - install(TARGETS omp ${export_to_llvmexports} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") -+ set_target_properties(omp PROPERTIES IMPORTED_IMPLIB ${LIBOMP_IMP_LIB_TARGET}) + install(TARGETS omp ${export_to_llvmexports} EXPORT llvm-openmp-targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS ${LIBOMP_IMP_LIB_TARGET} EXPORT llvm-openmp-targets ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") # Create aliases (regular copies) of the library for backwards compatibility -@@ -382,7 +383,7 @@ +@@ -382,7 +382,7 @@ endforeach() else() @@ -19,7 +18,7 @@ if(${LIBOMP_INSTALL_ALIASES}) # Create aliases (symlinks) of the library for backwards compatibility -@@ -415,3 +416,27 @@ +@@ -415,3 +415,26 @@ DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ) endif() @@ -29,7 +28,6 @@ +set(PORT_SHARE_DIR share/unofficial-llvm-openmp) +install(EXPORT llvm-openmp-targets + FILE unofficial-llvm-openmp-targets.cmake -+ NAMESPACE unofficial::llvm-openmp:: + DESTINATION ${PORT_SHARE_DIR} +) +include(CMakePackageConfigHelpers) diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in index 8e61bee106a61d..5eb8a66eedfab1 100644 --- a/ports/llvm-openmp/FindOpenMP.cmake.in +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -2,16 +2,12 @@ include(CMakeFindDependencyMacro) find_dependency(unofficial-llvm-openmp CONFIG REQUIRED) -get_target_property(_OpenMP_INCLUDE_DIR unofficial::llvm-openmp::omp INTERFACE_INCLUDE_DIRECTORIES) -get_target_property(_OpenMP_LIB_NAMES unofficial::llvm-openmp::omp INTERFACE_LINK_LIBRARIES) +get_target_property(_OpenMP_INCLUDE_DIR omp INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(_OpenMP_LIB_NAMES omp INTERFACE_LINK_LIBRARIES) # handle omp location being set directly via IMPORTED_LOCATION instead if(NOT _OpenMP_LIB_NAMES) - if(WIN32) - set(_OpenMP_LIB_NAMES libomp) - else() - set(_OpenMP_LIB_NAMES omp) - endif() + set(_OpenMP_LIB_NAMES omp) endif() foreach(_lang C CXX) @@ -20,7 +16,7 @@ foreach(_lang C CXX) set(OpenMP_${_lang}_LIB_NAMES "${_OpenMP_LIB_NAMES}") set(OpenMP_${_lang}_LIBRARIES "OpenMP::OpenMP_${_lang}") if (NOT TARGET OpenMP::OpenMP_${_lang}) - add_library(OpenMP::OpenMP_${_lang} ALIAS unofficial::llvm-openmp::omp) + add_library(OpenMP::OpenMP_${_lang} ALIAS omp) endif() endforeach() @@ -69,7 +65,7 @@ _openmp_set_flags() if(NOT DEFINED OpenMP_C_FLAGS) message(FATAL_ERROR "OpenMP build flags not found for compiler \"${CMAKE_C_COMPILER_ID}\"") endif() -set_target_properties(unofficial::llvm-openmp::omp PROPERTIES +set_target_properties(omp PROPERTIES INTERFACE_COMPILE_OPTIONS "${OpenMP_C_FLAGS}" INTERFACE_LINK_OPTIONS "${OpenMP_C_FLAGS}" ) diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 40a86c411f577c..8bdfd19db8d3be 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -3,7 +3,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) if(WIN32) - set_target_properties(unofficial::llvm-openmp::omp PROPERTIES + set_target_properties(omp PROPERTIES IMPORTED_IMPLIB ${CMAKE_CURRENT_LIST_FILE}/../../../lib/libomp.lib ) endif() From 1222ca92ac1c57ba9ef3fc0778013a46209bf367 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 18:56:56 +0300 Subject: [PATCH 35/46] [llvm-openmp] Export CMake vars --- ports/llvm-openmp/llvm-openmp-config.cmake.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 8bdfd19db8d3be..613d8ae36afdb0 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -2,8 +2,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) +# When built as part of LLVM, the headers are instead located at +# tools/llvm/lib/clang/18/include/omp.h +set_and_check(unofficial-llvm-openmp_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include") +set_and_check(unofficial-llvm-openmp_LIBRARIES omp) + if(WIN32) - set_target_properties(omp PROPERTIES - IMPORTED_IMPLIB ${CMAKE_CURRENT_LIST_FILE}/../../../lib/libomp.lib - ) + set_target_properties(omp PROPERTIES IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../../lib/libomp.lib") endif() From 6d20fe8e013e19f54ee8e94011b8f34a1206426d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 19:16:02 +0300 Subject: [PATCH 36/46] [llvm-openmp] Bump to v18.1.8 --- ports/llvm-openmp/portfile.cmake | 4 ++-- ports/llvm-openmp/vcpkg.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 36438b10031a2c..74224faaad59f3 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -6,7 +6,7 @@ endif() vcpkg_download_distfile(ARCHIVE URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/openmp-${VERSION}.src.tar.xz" FILENAME "llvm-openmp-${VERSION}.src.tar.xz" - SHA512 f96f5fd4c508f1390e53b943237aa7e1db1301ef660f0864305556d581275576d585ef222a82d2359d43ad8ed166096d9ec6c05ab0ee57a01679cff6b4ecba4b + SHA512 7c2ca736524fb741112be247ac6be39cfe1dc92381c5e2997d97044ab9705c224ae5eabcf43b59cdec9a715a14227c6fb02cb2d1829ebc47b82d3af6e4d197d3 ) vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}" @@ -19,7 +19,7 @@ vcpkg_extract_source_archive(SOURCE_PATH vcpkg_download_distfile(ARCHIVE URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/cmake-${VERSION}.src.tar.xz" FILENAME "llvm-cmake-${VERSION}.src.tar.xz" - SHA512 1334647f4be280b41858aa272bebc65e935cab772001032f77040396ba7472fbd5eb6a1a0c042ab7156540075705b7f05c8de2f02e2ce9d7ec1ec27be6bef86f + SHA512 e02243b491f9e688db28d7b53270fcf87debf09d3c95b136a7c7b96e26890de68712c60a1e85f5a448a95ad8c81f2d8ae77047780822443bbe39f1a9e6211007 ) vcpkg_extract_source_archive(CMAKE_SOURCE_PATH ARCHIVE "${ARCHIVE}" diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json index 7db218842d6b68..881a3596dbe171 100644 --- a/ports/llvm-openmp/vcpkg.json +++ b/ports/llvm-openmp/vcpkg.json @@ -1,6 +1,6 @@ { "name": "llvm-openmp", - "version": "18.1.6", + "version": "18.1.8", "description": "The LLVM Compiler Infrastructure.", "homepage": "https://llvm.org", "license": "Apache-2.0", From 2d9775a7bb2001dc28dde8defb4d2345253c0ab5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 4 Jul 2024 20:09:57 +0300 Subject: [PATCH 37/46] [llvm-openmp] Place omp.h under a subdirectory to avoid conflicts --- ports/llvm-openmp/0004-install-config.patch | 18 +++++++++++++++--- ports/llvm-openmp/llvm-openmp-config.cmake.in | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch index aa5cdde2ae5991..0de7537e67f205 100644 --- a/ports/llvm-openmp/0004-install-config.patch +++ b/ports/llvm-openmp/0004-install-config.patch @@ -1,3 +1,6 @@ +Add installation of config files since the project does not install any when building a standalone library. +Add an "unofficial-llvm-openmp" prefix to the headers to avoid conflicts with the same headers from GCC and other compilers. + --- a/runtime/src/CMakeLists.txt +++ b/runtime/src/CMakeLists.txt @@ -369,6 +369,6 @@ @@ -12,18 +15,27 @@ @@ -382,7 +382,7 @@ endforeach() else() - + - install(TARGETS omp ${export_to_llvmexports} ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") + install(TARGETS omp EXPORT llvm-openmp-targets ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") - + if(${LIBOMP_INSTALL_ALIASES}) # Create aliases (symlinks) of the library for backwards compatibility +@@ -399,7 +399,7 @@ + FILES + ${CMAKE_CURRENT_BINARY_DIR}/omp.h + ${CMAKE_CURRENT_BINARY_DIR}/ompx.h +- DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ++ DESTINATION include/unofficial-llvm-openmp + ) + if(${LIBOMP_OMPT_SUPPORT}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}) @@ -415,3 +415,26 @@ DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ) endif() + -+target_include_directories(omp PUBLIC $) ++target_include_directories(omp PUBLIC $) + +set(PORT_SHARE_DIR share/unofficial-llvm-openmp) +install(EXPORT llvm-openmp-targets diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 613d8ae36afdb0..77fc879784d61a 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -4,8 +4,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/unofficial-llvm-openmp-targets.cmake) # When built as part of LLVM, the headers are instead located at # tools/llvm/lib/clang/18/include/omp.h -set_and_check(unofficial-llvm-openmp_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include") -set_and_check(unofficial-llvm-openmp_LIBRARIES omp) +set_and_check(unofficial-llvm-openmp_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include/unofficial-llvm-openmp") +set(unofficial-llvm-openmp_LIBRARIES omp) if(WIN32) set_target_properties(omp PROPERTIES IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../../lib/libomp.lib") From a8bcff8d3fda13326bc87d6a6870b5cc3fd03e57 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 5 Jul 2024 19:37:31 +0300 Subject: [PATCH 38/46] [llvm-openmp] remove `REQUIRED` from FindOpenMP.cmake.in --- ports/llvm-openmp/FindOpenMP.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/llvm-openmp/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in index 5eb8a66eedfab1..fb5ebe2c02f9c5 100644 --- a/ports/llvm-openmp/FindOpenMP.cmake.in +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -1,7 +1,7 @@ # Based on https://github.com/Kitware/CMake/blob/v3.30.0-rc3/Modules/FindOpenMP.cmake include(CMakeFindDependencyMacro) -find_dependency(unofficial-llvm-openmp CONFIG REQUIRED) +find_dependency(unofficial-llvm-openmp CONFIG) get_target_property(_OpenMP_INCLUDE_DIR omp INTERFACE_INCLUDE_DIRECTORIES) get_target_property(_OpenMP_LIB_NAMES omp INTERFACE_LINK_LIBRARIES) From 95280e17d958e2576c8d5f0affc093260d846170 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Jul 2024 15:37:53 +0300 Subject: [PATCH 39/46] [llvm-openmp] install libs in an 'unofficial-llvm-openmp' subdir to avoid conflicts --- ports/llvm-openmp/0004-install-config.patch | 22 +++++++++++++------ ports/llvm-openmp/llvm-openmp-config.cmake.in | 3 ++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ports/llvm-openmp/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch index 0de7537e67f205..a4fe6a8b0f7589 100644 --- a/ports/llvm-openmp/0004-install-config.patch +++ b/ports/llvm-openmp/0004-install-config.patch @@ -1,9 +1,17 @@ Add installation of config files since the project does not install any when building a standalone library. -Add an "unofficial-llvm-openmp" prefix to the headers to avoid conflicts with the same headers from GCC and other compilers. + +Add an "unofficial-llvm-openmp" prefix to the headers to avoid conflicts with the same unprefixed headers provided GCC and other compilers. +Add an "unofficial-llvm-openmp" to the library files to avoid conflicts with the LLVM port. --- a/runtime/src/CMakeLists.txt +++ b/runtime/src/CMakeLists.txt -@@ -369,6 +369,6 @@ +@@ -365,10 +365,12 @@ + set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS omp) + endif() + ++set(OPENMP_INSTALL_LIBDIR "lib/unofficial-llvm-openmp") ++set(OPENMP_INSTALL_BINDIR "bin/unofficial-llvm-openmp") + # Install rules # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR} # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR} if(WIN32) @@ -12,16 +20,16 @@ Add an "unofficial-llvm-openmp" prefix to the headers to avoid conflicts with th + install(TARGETS omp ${export_to_llvmexports} EXPORT llvm-openmp-targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS ${LIBOMP_IMP_LIB_TARGET} EXPORT llvm-openmp-targets ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") # Create aliases (regular copies) of the library for backwards compatibility -@@ -382,7 +382,7 @@ +@@ -382,7 +384,7 @@ endforeach() else() - + - install(TARGETS omp ${export_to_llvmexports} ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") + install(TARGETS omp EXPORT llvm-openmp-targets ${LIBOMP_INSTALL_KIND} DESTINATION "${OPENMP_INSTALL_LIBDIR}") - + if(${LIBOMP_INSTALL_ALIASES}) # Create aliases (symlinks) of the library for backwards compatibility -@@ -399,7 +399,7 @@ +@@ -399,7 +401,7 @@ FILES ${CMAKE_CURRENT_BINARY_DIR}/omp.h ${CMAKE_CURRENT_BINARY_DIR}/ompx.h @@ -30,7 +38,7 @@ Add an "unofficial-llvm-openmp" prefix to the headers to avoid conflicts with th ) if(${LIBOMP_OMPT_SUPPORT}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH}) -@@ -415,3 +415,26 @@ +@@ -415,3 +417,26 @@ DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} ) endif() diff --git a/ports/llvm-openmp/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in index 77fc879784d61a..927c9e172296cc 100644 --- a/ports/llvm-openmp/llvm-openmp-config.cmake.in +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -8,5 +8,6 @@ set_and_check(unofficial-llvm-openmp_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../. set(unofficial-llvm-openmp_LIBRARIES omp) if(WIN32) - set_target_properties(omp PROPERTIES IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../../lib/libomp.lib") + set_and_check(unofficial-llvm-openmp_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../../lib/unofficial-llvm-openmp/libomp.lib") + set_target_properties(omp PROPERTIES IMPORTED_IMPLIB "${unofficial-llvm-openmp_IMPLIB}") endif() From e297073fe169f1a11b8db2b232d24f1ed767d8ff Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 7 Jul 2024 14:58:09 +0300 Subject: [PATCH 40/46] vdb --- versions/baseline.json | 2 +- versions/l-/llvm-openmp.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index 68cc0bad92eb5a..e0360aa426ad7c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5413,7 +5413,7 @@ "port-version": 0 }, "llvm-openmp": { - "baseline": "18.1.6", + "baseline": "18.1.8", "port-version": 0 }, "lmdb": { diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index e5f15f403d6fec..0d044dd13e14e7 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,8 +1,8 @@ { "versions": [ { - "git-tree": "092829374416a21d8e65deba7d1c61cf7e4128ec", - "version": "18.1.6", + "git-tree": "0d04f40ebbd08c3f611e32c4f8584d454622c9c5", + "version": "18.1.8", "port-version": 0 } ] From 78ffd239a4ab80c2c939cda463da33f66de77c5c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 13:54:03 +0300 Subject: [PATCH 41/46] [openmp] Use llvm-openmp only for Clang and AppleClang --- ports/openmp/vcpkg-cmake-wrapper.cmake | 6 ++++-- ports/openmp/vcpkg.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/openmp/vcpkg-cmake-wrapper.cmake b/ports/openmp/vcpkg-cmake-wrapper.cmake index 246503feea1477..f636b7f81815c5 100644 --- a/ports/openmp/vcpkg-cmake-wrapper.cmake +++ b/ports/openmp/vcpkg-cmake-wrapper.cmake @@ -1,6 +1,8 @@ +# Uses llvm-openmp from Vcpkg for Clang and AppleClang and the native OpenMP implementation for all other compilers. + set(_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") -# if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$") list(PREPEND CMAKE_MODULE_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/llvm-openmp") -# endif() +endif() _find_package(${ARGS}) set(CMAKE_MODULE_PATH "${_CMAKE_MODULE_PATH}") diff --git a/ports/openmp/vcpkg.json b/ports/openmp/vcpkg.json index 0c2db60439f822..73c6ff2fd907e4 100644 --- a/ports/openmp/vcpkg.json +++ b/ports/openmp/vcpkg.json @@ -1,12 +1,12 @@ { "name": "openmp", - "version-date": "2024-06-19", + "version-date": "2024-07-08", "description": "Metapackage for OpenMP libraries", "license": null, "dependencies": [ { "name": "llvm-openmp", - "platform": "!android" + "platform": "!android & !(windows & static) & !uwp" }, { "name": "vcpkg-cmake", From 535de03aada257c05f3b857f9ea0d1b4a3362374 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 13:55:07 +0300 Subject: [PATCH 42/46] vdb --- versions/baseline.json | 2 +- versions/o-/openmp.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/versions/baseline.json b/versions/baseline.json index e0360aa426ad7c..8cdb68e3d848a3 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6521,7 +6521,7 @@ "port-version": 0 }, "openmp": { - "baseline": "2024-06-19", + "baseline": "2024-07-08", "port-version": 0 }, "openmpi": { diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json index ce91436c206b6f..36fe95c8b0b972 100644 --- a/versions/o-/openmp.json +++ b/versions/o-/openmp.json @@ -1,8 +1,8 @@ { "versions": [ { - "git-tree": "a6624de1c34edb67d00dcadc1362351c39a6304c", - "version-date": "2024-06-19", + "git-tree": "f8de9c0e1960e7b581829eabca1403bce83eca5f", + "version-date": "2024-07-08", "port-version": 0 } ] From 5e22a88df97d4f03fcf53d6909da5e8343f2ed29 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 14:34:18 +0300 Subject: [PATCH 43/46] Add usage info --- ports/llvm-openmp/portfile.cmake | 1 + ports/llvm-openmp/usage | 6 ++++++ ports/openmp/portfile.cmake | 1 + ports/openmp/usage | 4 ++++ 4 files changed, 12 insertions(+) create mode 100644 ports/llvm-openmp/usage create mode 100644 ports/openmp/usage diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 74224faaad59f3..4890195376a065 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -72,3 +72,4 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") endif() vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.TXT") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/llvm-openmp/usage b/ports/llvm-openmp/usage new file mode 100644 index 00000000000000..ba609eea142ff9 --- /dev/null +++ b/ports/llvm-openmp/usage @@ -0,0 +1,6 @@ +The llvm-openmp port exports an unofficial CMake config file: + + find_package(unofficial-llvm-openmp REQUIRED CONFIG) + target_link_libraries(my_target PRIVATE omp) + +Consider using the `openmp` port instead, which uses llvm-openmp automatically for Clang and AppleClang. diff --git a/ports/openmp/portfile.cmake b/ports/openmp/portfile.cmake index b565e1840f1009..22b4acdaef8c6e 100644 --- a/ports/openmp/portfile.cmake +++ b/ports/openmp/portfile.cmake @@ -1,3 +1,4 @@ SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/openmp/vcpkg-cmake-wrapper.cmake" COPYONLY) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/openmp/usage b/ports/openmp/usage new file mode 100644 index 00000000000000..79ffe409933061 --- /dev/null +++ b/ports/openmp/usage @@ -0,0 +1,4 @@ +Use the standard FindOpenMP module to find OpenMP and link against it: + + find_package(OpenMP REQUIRED) + target_link_libraries(my_target PRIVATE OpenMP::OpenMP_CXX) From 5e358cd9d9892d5013803ab53aacdc7652e7e610 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 14:43:26 +0300 Subject: [PATCH 44/46] vdb --- versions/l-/llvm-openmp.json | 2 +- versions/o-/openmp.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index 0d044dd13e14e7..f07efe3c9f768f 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "0d04f40ebbd08c3f611e32c4f8584d454622c9c5", + "git-tree": "bbc9c04737fa291ddf1ff3de2f71e20fca07c49a", "version": "18.1.8", "port-version": 0 } diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json index 36fe95c8b0b972..415635af6b3025 100644 --- a/versions/o-/openmp.json +++ b/versions/o-/openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "f8de9c0e1960e7b581829eabca1403bce83eca5f", + "git-tree": "86b3495a38b89601aadf81be76f802a3d2013738", "version-date": "2024-07-08", "port-version": 0 } From 710ed575da7cbb49d5556a1ca8999505a6c1dbbc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 23:04:06 +0300 Subject: [PATCH 45/46] [llvm-openmp] Fix Windows static triplet support --- ports/llvm-openmp/portfile.cmake | 10 +++------- ports/llvm-openmp/vcpkg.json | 2 +- ports/openmp/vcpkg.json | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake index 4890195376a065..ddefb207165813 100644 --- a/ports/llvm-openmp/portfile.cmake +++ b/ports/llvm-openmp/portfile.cmake @@ -1,8 +1,3 @@ -if(VCPKG_TARGET_IS_WINDOWS) - # https://github.com/llvm/llvm-project/blob/llvmorg-18.1.6/openmp/runtime/CMakeLists.txt#L331 - vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) -endif() - vcpkg_download_distfile(ARCHIVE URLS "https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/openmp-${VERSION}.src.tar.xz" FILENAME "llvm-openmp-${VERSION}.src.tar.xz" @@ -29,10 +24,11 @@ file(COPY ${CMAKE_MODULES} DESTINATION "${SOURCE_PATH}/cmake") file(COPY "${CMAKE_CURRENT_LIST_DIR}/llvm-openmp-config.cmake.in" DESTINATION "${SOURCE_PATH}/runtime/cmake") -string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "shared" ENABLE_SHARED) if(VCPKG_TARGET_IS_WINDOWS) - set(ENABLE_SHARED ON) + # https://github.com/llvm/llvm-project/blob/llvmorg-18.1.6/openmp/runtime/CMakeLists.txt#L331 + set(VCPKG_LIBRARY_LINKAGE dynamic) endif() +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED) # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) diff --git a/ports/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json index 881a3596dbe171..7d8c897bd268b8 100644 --- a/ports/llvm-openmp/vcpkg.json +++ b/ports/llvm-openmp/vcpkg.json @@ -4,7 +4,7 @@ "description": "The LLVM Compiler Infrastructure.", "homepage": "https://llvm.org", "license": "Apache-2.0", - "supports": "!android & !(windows & static) & !uwp", + "supports": "!android & !uwp", "dependencies": [ { "name": "vcpkg-cmake", diff --git a/ports/openmp/vcpkg.json b/ports/openmp/vcpkg.json index 73c6ff2fd907e4..f3e0e75f4b3bd0 100644 --- a/ports/openmp/vcpkg.json +++ b/ports/openmp/vcpkg.json @@ -6,7 +6,7 @@ "dependencies": [ { "name": "llvm-openmp", - "platform": "!android & !(windows & static) & !uwp" + "platform": "!android & !uwp" }, { "name": "vcpkg-cmake", From 1c2ab7b99f0a38913f5d6e04e776ca99dff3bdd4 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 8 Jul 2024 23:04:37 +0300 Subject: [PATCH 46/46] vdb --- versions/l-/llvm-openmp.json | 2 +- versions/o-/openmp.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/l-/llvm-openmp.json b/versions/l-/llvm-openmp.json index f07efe3c9f768f..cfde1f4a87548b 100644 --- a/versions/l-/llvm-openmp.json +++ b/versions/l-/llvm-openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "bbc9c04737fa291ddf1ff3de2f71e20fca07c49a", + "git-tree": "b09ae95ca5d8f9bcd3f319c0fc2c0c92572c35fb", "version": "18.1.8", "port-version": 0 } diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json index 415635af6b3025..5de190e8389e6f 100644 --- a/versions/o-/openmp.json +++ b/versions/o-/openmp.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "86b3495a38b89601aadf81be76f802a3d2013738", + "git-tree": "2def7b9773b76de0afd68bb905c84573427fd0c4", "version-date": "2024-07-08", "port-version": 0 }