Skip to content

Commit

Permalink
Merge pull request #987 from LLNL/feature/kweiss/improve-vcpkg
Browse files Browse the repository at this point in the history
Adds support for RAJA and Umpire to Windows build
  • Loading branch information
kennyweiss authored Jan 5, 2023
2 parents 2fff044 + eb4c8fc commit 3d77e46
Show file tree
Hide file tree
Showing 11 changed files with 424 additions and 8 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
- Updates to [fmt version 9.1.0](https://github.com/fmtlib/fmt/releases/tag/9.1.0)
- Updates uberenv submodule to HEAD of main on 28Dec2022
- Updates blt submodule to HEAD of develop on 28Dec2022
- Adds `vcpkg` ports for `RAJA`, `Umpire` with optional `OpenMP` feature for automated Windows build

## [Version 0.7.0] - Release date 2022-08-30

Expand Down
67 changes: 62 additions & 5 deletions scripts/vcpkg_ports/axom/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,53 @@ set(ENABLE_MPI OFF CACHE BOOL "")
#------------------------------------------------------------------------------
# Set TPLs
#------------------------------------------------------------------------------
]=])

set(_conduit_dep_on [=[

set(CONDUIT_DIR "@CURRENT_INSTALLED_DIR@/share/conduit" CACHE PATH "")
set(HDF5_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "")
]=])
set(_conduit_dep_off [=[

# conduit is disabled
# sidre requires conduit; inlet and klee require sidre
set(AXOM_ENABLE_SIDRE OFF CACHE BOOL "")
set(AXOM_ENABLE_INLET OFF CACHE BOOL "")
set(AXOM_ENABLE_KLEE OFF CACHE BOOL "")
]=])

set(_mfem_dep [=[

set(MFEM_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "")
]=])

# TODO:
# * Add TPLs: mfem, umpire, raja
# * Add tools: uncrustify, sphinx, doxygen
set(_camp_dep [=[

set(CAMP_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "")
]=])

set(_raja_dep [=[

set(RAJA_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "")
]=])

set(_umpire_dep [=[

set(UMPIRE_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "")
]=])

set(_openmp_dep [=[

# Setup OpenMP; fix MSVC linker error about unknown flag
set(ENABLE_OPENMP ON CACHE BOOL "")
set(BLT_OPENMP_LINK_FLAGS " " CACHE STRING "")
]=])

# TODO:
# * Add features/TPLs: lua, mpi
# * Add tools: uncrustify, sphinx, doxygen

# Create a copyright file
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/${PORT} )
set(_copyright_file ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
Expand All @@ -145,6 +182,26 @@ file(WRITE ${_copyright_file} "${_copyright}")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include/${PORT} )
set(_hc_file ${CURRENT_PACKAGES_DIR}/include/${PORT}/hc.cmake)

file(WRITE ${_hc_file}.in ${_host-config_hdr})
configure_file(${_hc_file}.in ${_hc_file} @ONLY)
# Add enabled features to host-config
message(STATUS "FEATURES: ${FEATURES}")

file(WRITE ${_hc_file}.in "${_host-config_hdr}")

if("conduit" IN_LIST FEATURES)
file(APPEND ${_hc_file}.in "${_conduit_dep_on}")
else()
file(APPEND ${_hc_file}.in "${_conduit_dep_off}")
endif()

foreach(_dep openmp mfem raja umpire)
if(${_dep} IN_LIST FEATURES)
file(APPEND ${_hc_file}.in "${_${_dep}_dep}")
endif()
endforeach()

# camp is required if umpire or raja are present
if(raja IN_LIST FEATURES OR umpire IN_LIST FEATURES)
file(APPEND ${_hc_file}.in "${_camp_dep}")
endif()

configure_file(${_hc_file}.in ${_hc_file} @ONLY)
30 changes: 29 additions & 1 deletion scripts/vcpkg_ports/axom/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
"description": "Host-config generator for Axom TPLs",
"dependencies": ["blt"],
"default-features": [
"conduit",
"mfem",
"conduit"
"openmp",
"raja",
"umpire"
],
"features": {
"mfem": {
Expand All @@ -16,6 +19,31 @@
"conduit": {
"description": "conduit functionality for axom",
"dependencies": ["conduit"]
},
"raja": {
"description": "raja functionality for axom",
"dependencies": ["raja"]
},
"umpire": {
"description": "umpire functionality for axom",
"dependencies": ["umpire"]
},
"openmp": {
"description": "openmp functionality for axom",
"dependencies": [
{
"name": "raja",
"features": [
"openmp"
]
},
{
"name": "umpire",
"features": [
"openmp"
]
}
]
}
},
"supports": "!uwp"
Expand Down
85 changes: 85 additions & 0 deletions scripts/vcpkg_ports/camp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO llnl/camp
REF v2022.03.2
SHA512 d124c0e933f042525e9b48c21b93e7f4f634dfc0f87742e018a1c7de43ed6e30670d8f8e4ce369018a8e1c884b2b27f4755ee9f07a077820b2a3133546f6d622
HEAD_REF develop
)

set(_is_shared TRUE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(_is_shared FALSE)
endif()

if("openmp" IN_LIST FEATURES)
set(_use_)
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
openmp ENABLE_OPENMP
)



vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBLT_SOURCE_DIR=${CURRENT_INSTALLED_DIR}/share/blt
-DENABLE_COVERAGE=OFF
-DENABLE_ALL_WARNINGS=OFF
-DENABLE_DOCS=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTS=OFF
-DBUILD_SHARED_LIBS=${_is_shared}
${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/camp
TARGET_PATH share/camp)
vcpkg_copy_pdbs()


## shuffle the output directories to make vcpkg happy
# Remove extraneous debug header files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

# Remove exe files -- vcpkg doesn't like them
# (Future): It might be possible to move them to the vcpkg 'tools' directory
foreach(_dir "bin" "debug/bin")
file(GLOB _exe ${CURRENT_PACKAGES_DIR}/${_dir}/*.exe)
if(_exe)
file(REMOVE ${_exe})
endif()
endforeach()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
# Note: Not tested
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
else()
set(_config_dir "${CURRENT_PACKAGES_DIR}/share/camp")

# Move dll files from lib to bin directory
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin )
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin )

file(RENAME ${CURRENT_PACKAGES_DIR}/lib/camp.dll
${CURRENT_PACKAGES_DIR}/bin/camp.dll)

file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/camp.dll
${CURRENT_PACKAGES_DIR}/debug/bin/camp.dll)

# Update paths to dlls in CMake config files
foreach(_c debug release)
set(_f ${_config_dir}/campTargets-${_c}.cmake)
file(READ ${_f} _fdata)
string(REPLACE "lib/camp.dll" "bin/camp.dll" _fdata "${_fdata}")
file(WRITE ${_f} "${_fdata}")
endforeach()
endif()

# Put the license file where vcpkg expects it
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/camp RENAME copyright)
15 changes: 15 additions & 0 deletions scripts/vcpkg_ports/camp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "camp",
"version-string": "2022.03.2",
"homepage": "https://github.com/llnl/camp",
"description": "Compiler agnostic metaprogramming library",
"dependencies": [
"blt"
],
"features": {
"openmp": {
"description": "openmp functionality for camp"
}
},
"supports": "!uwp"
}
82 changes: 82 additions & 0 deletions scripts/vcpkg_ports/raja/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO llnl/raja
REF v2022.03.1
SHA512 36e2f59e0f4c3e8fcc07a21fc1eeec701c2be147db9395efedad9aa87bcc078e84a5334698c0fb3e2fbd3670c2eaacdebcd63c4caaa3721a3900ff02dfb44ad7
HEAD_REF develop
)

set(_is_shared TRUE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(_is_shared FALSE)
else()
set(_extra_cxx_flags "/DRAJASHAREDDLL_EXPORTS")
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
openmp ENABLE_OPENMP
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBLT_SOURCE_DIR:PATH=${CURRENT_INSTALLED_DIR}/share/blt
-Dcamp_DIR:PATH=${CURRENT_INSTALLED_DIR}
-DENABLE_ALL_WARNINGS:BOOL=OFF
-DENABLE_COVERAGE:BOOL=OFF
-DENABLE_EXAMPLES:BOOL=OFF
-DENABLE_TESTS:BOOL=OFF
-DRAJA_ENABLE_RUNTIME_PLUGINS:BOOL=OFF
-DRAJA_ENABLE_TESTS:BOOL=OFF
-DRAJA_ENABLE_EXAMPLES:BOOL=OFF
-DRAJA_ENABLE_EXERCISES:BOOL=OFF
-DRAJA_ENABLE_REPRODUCERS:BOOL=OFF
-DRAJA_ENABLE_DOCUMENTATION:BOOL=OFF
-DRAJA_ENABLE_BENCHMARKS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=${_is_shared}
-DBLT_CXX_FLAGS:STRING=${_extra_cxx_flags}
${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/raja
TARGET_PATH share/raja)
vcpkg_copy_pdbs()


## shuffle the output directories to make vcpkg happy
# Remove extraneous debug header files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

message(STATUS "CURRENT_PACKAGES_DIR -- ${CURRENT_PACKAGES_DIR}")

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
# Note: Not tested
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
else()
set(_config_dir "${CURRENT_PACKAGES_DIR}/share/raja")

# Move dll files from lib to bin directory
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin )
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin )

file(RENAME ${CURRENT_PACKAGES_DIR}/lib/RAJA.dll
${CURRENT_PACKAGES_DIR}/bin/RAJA.dll)

file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/RAJA.dll
${CURRENT_PACKAGES_DIR}/debug/bin/RAJA.dll)

# Update paths to dlls in CMake config files
foreach(_c debug release)
set(_f ${_config_dir}/RAJA-${_c}.cmake)
file(READ ${_f} _fdata)
string(REPLACE "lib/RAJA.dll" "bin/RAJA.dll" _fdata "${_fdata}")
file(WRITE ${_f} "${_fdata}")
endforeach()
endif()

# Put the license file where vcpkg expects it
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/raja RENAME copyright)
24 changes: 24 additions & 0 deletions scripts/vcpkg_ports/raja/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "raja",
"version-string": "2022.03.1",
"homepage": "https://github.com/llnl/raja",
"description": "RAJA Performance Portability Layer (C++)",
"dependencies": [
"blt",
"camp"
],
"features": {
"openmp": {
"description": "openmp functionality for raja",
"dependencies": [
{
"name": "camp",
"features": [
"openmp"
]
}
]
}
},
"supports": "!uwp"
}
Loading

0 comments on commit 3d77e46

Please sign in to comment.