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 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" + ] } } } 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/0004-install-config.patch b/ports/llvm-openmp/0004-install-config.patch new file mode 100644 index 00000000000000..a4fe6a8b0f7589 --- /dev/null +++ b/ports/llvm-openmp/0004-install-config.patch @@ -0,0 +1,67 @@ +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 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 +@@ -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) +- 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 +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 +401,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 +417,26 @@ + 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-targets.cmake ++ 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/FindOpenMP.cmake.in b/ports/llvm-openmp/FindOpenMP.cmake.in new file mode 100644 index 00000000000000..fb5ebe2c02f9c5 --- /dev/null +++ b/ports/llvm-openmp/FindOpenMP.cmake.in @@ -0,0 +1,207 @@ +# Based on https://github.com/Kitware/CMake/blob/v3.30.0-rc3/Modules/FindOpenMP.cmake + +include(CMakeFindDependencyMacro) +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) + +# 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}") + 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 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(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; + } + ") + try_compile(OpenMP_SPECTEST ${BUILD_DIR} + SOURCES "${SRC_FILE}" + CMAKE_FLAGS + "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_C_FLAGS}" + "-DINCLUDE_DIRECTORIES:STRING=${OpenMP_C_INCLUDE_DIR}" + 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() +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/llvm-openmp-config.cmake.in b/ports/llvm-openmp/llvm-openmp-config.cmake.in new file mode 100644 index 00000000000000..927c9e172296cc --- /dev/null +++ b/ports/llvm-openmp/llvm-openmp-config.cmake.in @@ -0,0 +1,13 @@ +@PACKAGE_INIT@ + +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/unofficial-llvm-openmp") +set(unofficial-llvm-openmp_LIBRARIES omp) + +if(WIN32) + 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() diff --git a/ports/llvm-openmp/portfile.cmake b/ports/llvm-openmp/portfile.cmake new file mode 100644 index 00000000000000..ddefb207165813 --- /dev/null +++ b/ports/llvm-openmp/portfile.cmake @@ -0,0 +1,71 @@ +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 7c2ca736524fb741112be247ac6be39cfe1dc92381c5e2997d97044ab9705c224ae5eabcf43b59cdec9a715a14227c6fb02cb2d1829ebc47b82d3af6e4d197d3 +) +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0001-disable-libomp-aliases.patch + 0002-disable-tests.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 e02243b491f9e688db28d7b53270fcf87debf09d3c95b136a7c7b96e26890de68712c60a1e85f5a448a95ad8c81f2d8ae77047780822443bbe39f1a9e6211007 +) +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") + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/llvm-openmp-config.cmake.in" DESTINATION "${SOURCE_PATH}/runtime/cmake") + +if(VCPKG_TARGET_IS_WINDOWS) + # 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) + + +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") +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/llvm-openmp/vcpkg.json b/ports/llvm-openmp/vcpkg.json new file mode 100644 index 00000000000000..7d8c897bd268b8 --- /dev/null +++ b/ports/llvm-openmp/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "llvm-openmp", + "version": "18.1.8", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "supports": "!android & !uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/ports/openmp/portfile.cmake b/ports/openmp/portfile.cmake new file mode 100644 index 00000000000000..22b4acdaef8c6e --- /dev/null +++ b/ports/openmp/portfile.cmake @@ -0,0 +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) diff --git a/ports/openmp/vcpkg-cmake-wrapper.cmake b/ports/openmp/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000000..f636b7f81815c5 --- /dev/null +++ b/ports/openmp/vcpkg-cmake-wrapper.cmake @@ -0,0 +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)$") + 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..f3e0e75f4b3bd0 --- /dev/null +++ b/ports/openmp/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "openmp", + "version-date": "2024-07-08", + "description": "Metapackage for OpenMP libraries", + "license": null, + "dependencies": [ + { + "name": "llvm-openmp", + "platform": "!android & !uwp" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index c318a165ae71fe..8cdb68e3d848a3 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.8", + "port-version": 0 + }, "lmdb": { "baseline": "0.9.31", "port-version": 0 @@ -6516,6 +6520,10 @@ "baseline": "10.0", "port-version": 0 }, + "openmp": { + "baseline": "2024-07-08", + "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..eeb5c78d24ecc2 100644 --- a/versions/d-/dmlc.json +++ b/versions/d-/dmlc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a9a5733a3548ffb8e860e259ea1181ec56da4a8f", + "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..cfde1f4a87548b --- /dev/null +++ b/versions/l-/llvm-openmp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "b09ae95ca5d8f9bcd3f319c0fc2c0c92572c35fb", + "version": "18.1.8", + "port-version": 0 + } + ] +} diff --git a/versions/o-/openmp.json b/versions/o-/openmp.json new file mode 100644 index 00000000000000..5de190e8389e6f --- /dev/null +++ b/versions/o-/openmp.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "2def7b9773b76de0afd68bb905c84573427fd0c4", + "version-date": "2024-07-08", + "port-version": 0 + } + ] +}