Skip to content

Commit

Permalink
Apply the fix from cmake-format
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Jun 3, 2024
1 parent cdd2498 commit fec9be2
Show file tree
Hide file tree
Showing 19 changed files with 936 additions and 671 deletions.
9 changes: 4 additions & 5 deletions cpp/CMake/BuildGTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ set(GLUTEN_GTEST_BUILD_SHA256_CHECKSUM
ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363)
set(GLUTEN_GTEST_SOURCE_URL
"https://github.com/google/googletest/archive/refs/tags/v${GLUTEN_GTEST_VERSION}.tar.gz"
)
)

resolve_dependency_url(GTEST)

message(STATUS "Building gtest from source")
FetchContent_Declare(
gtest
URL ${GLUTEN_GTEST_SOURCE_URL}
URL_HASH "${GLUTEN_GTEST_BUILD_SHA256_CHECKSUM}"
)
gtest
URL ${GLUTEN_GTEST_SOURCE_URL}
URL_HASH "${GLUTEN_GTEST_BUILD_SHA256_CHECKSUM}")

FetchContent_MakeAvailable(gtest)
6 changes: 3 additions & 3 deletions cpp/CMake/BuildGflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
include_guard(GLOBAL)

set(GLUTEN_GFLAGS_BUILD_SHA256_CHECKSUM
34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf)
34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf)
string(CONCAT GLUTEN_GFLAGS_SOURCE_URL
"https://github.com/gflags/gflags/archive/refs/tags/"
"v${GLUTEN_GFLAGS_VERSION}.tar.gz")
"https://github.com/gflags/gflags/archive/refs/tags/"
"v${GLUTEN_GFLAGS_VERSION}.tar.gz")

resolve_dependency_url(GFLAGS)

Expand Down
12 changes: 6 additions & 6 deletions cpp/CMake/BuildGlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
include_guard(GLOBAL)

set(GLUTEN_GLOG_BUILD_SHA256_CHECKSUM
8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6)
8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6)
set(GLUTEN_GLOG_SOURCE_URL
"https://github.com/google/glog/archive/refs/tags/v${GLUTEN_GLOG_VERSION}.tar.gz"
)
"https://github.com/google/glog/archive/refs/tags/v${GLUTEN_GLOG_VERSION}.tar.gz"
)

resolve_dependency_url(GLOG)

Expand All @@ -27,7 +27,7 @@ FetchContent_Declare(
URL ${GLUTEN_GLOG_SOURCE_URL}
URL_HASH SHA256=${GLUTEN_GLOG_BUILD_SHA256_CHECKSUM}
PATCH_COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/glog/glog-no-export.patch
&& git apply ${CMAKE_CURRENT_LIST_DIR}/glog/glog-config.patch)
&& git apply ${CMAKE_CURRENT_LIST_DIR}/glog/glog-config.patch)

set(BUILD_SHARED_LIBS OFF)
set(WITH_UNWIND OFF)
Expand All @@ -48,6 +48,6 @@ endif()
# These headers are missing from the include dir but adding the src dir causes
# issues with folly so we just copy it to the include dir
file(COPY ${glog_SOURCE_DIR}/src/glog/platform.h
DESTINATION ${glog_BINARY_DIR}/glog)
DESTINATION ${glog_BINARY_DIR}/glog)
file(COPY ${glog_SOURCE_DIR}/src/glog/log_severity.h
DESTINATION ${glog_BINARY_DIR}/glog)
DESTINATION ${glog_BINARY_DIR}/glog)
15 changes: 8 additions & 7 deletions cpp/CMake/BuildGoogleBenchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ include(FetchContent)
set(GLUTEN_GBENCHMARK_BUILD_VERSION "v1.6.0")
set(GLUTEN_GBENCHMARK_SOURCE_URL
"https://github.com/google/benchmark/archive/refs/tags/${GLUTEN_GBENCHMARK_BUILD_VERSION}.tar.gz"
"https://github.com/ursa-labs/thirdparty/releases/download/latest/gbenchmark-${GLUTEN_GBENCHMARK_BUILD_VERSION}.tar.gz")
set(GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6")
"https://github.com/ursa-labs/thirdparty/releases/download/latest/gbenchmark-${GLUTEN_GBENCHMARK_BUILD_VERSION}.tar.gz"
)
set(GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM
"1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6")

resolve_dependency_url(GBENCHMARK)

set(GBENCHMARK_CMAKE_ARGS "-fPIC -w")

message(STATUS "Building google benchmark from source")
FetchContent_Declare(
gbenchmark
URL ${GLUTEN_GBENCHMARK_SOURCE_URL}
URL_HASH "${GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM}"
)
gbenchmark
URL ${GLUTEN_GBENCHMARK_SOURCE_URL}
URL_HASH "${GLUTEN_GBENCHMARK_BUILD_SHA256_CHECKSUM}")

if (NOT gbenchmark_POPULATED)
if(NOT gbenchmark_POPULATED)
# We don't want to build tests.
set(BENCHMARK_ENABLE_TESTING
OFF
Expand Down
121 changes: 65 additions & 56 deletions cpp/CMake/BuildMemkind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,98 +26,107 @@ endif()
macro(build_hwloc)
message(STATUS "Building hwloc from source")
set(HWLOC_BUILD_VERSION "2.8.0")
set(HWLOC_BUILD_SHA256_CHECKSUM "311d44e99bbf6d269c2cbc569d073978d88352bc31d51e31457d4df94783172d")
set(HWLOC_BUILD_SHA256_CHECKSUM
"311d44e99bbf6d269c2cbc569d073978d88352bc31d51e31457d4df94783172d")
set(HWLOC_SOURCE_URL
"https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-${HWLOC_BUILD_VERSION}.tar.gz")
"https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-${HWLOC_BUILD_VERSION}.tar.gz"
)
set(HWLOC_LIB_NAME "hwloc")
set(HWLOC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/hwloc_ep-install")
set(HWLOC_SOURCE_DIR "${HWLOC_PREFIX}/src/hwloc_ep")
set(HWLOC_INCLUDE_DIR "${HWLOC_SOURCE_DIR}/include")
set(HWLOC_LIB_DIR "${HWLOC_SOURCE_DIR}/hwloc/.libs")
set(HWLOC_STATIC_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${HWLOC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(HWLOC_STATIC_LIB_NAME
"${CMAKE_STATIC_LIBRARY_PREFIX}${HWLOC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set(HWLOC_STATIC_LIB_TARGETS
"${HWLOC_SOURCE_DIR}/src/.libs/${HWLOC_STATIC_LIB_NAME}")
"${HWLOC_SOURCE_DIR}/src/.libs/${HWLOC_STATIC_LIB_NAME}")
set(HWLOC_CONFIGURE_ARGS
"--prefix=${HWLOC_PREFIX}"
"--with-pic"
"--enable-static"
"--disable-shared"
"--enable-plugins")
ExternalProject_Add(hwloc_ep
PREFIX ${HWLOC_PREFIX}
URL ${HWLOC_SOURCE_URL}
URL_HASH "SHA256=${HWLOC_BUILD_SHA256_CHECKSUM}"
SOURCE_DIR ${HWLOC_SOURCE_DIR}
CONFIGURE_COMMAND ./configure ${HWLOC_CONFIGURE_ARGS}
BUILD_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${HWLOC_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)
"--prefix=${HWLOC_PREFIX}" "--with-pic" "--enable-static"
"--disable-shared" "--enable-plugins")
ExternalProject_Add(
hwloc_ep
PREFIX ${HWLOC_PREFIX}
URL ${HWLOC_SOURCE_URL}
URL_HASH "SHA256=${HWLOC_BUILD_SHA256_CHECKSUM}"
SOURCE_DIR ${HWLOC_SOURCE_DIR}
CONFIGURE_COMMAND ./configure ${HWLOC_CONFIGURE_ARGS}
BUILD_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${HWLOC_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)

ExternalProject_Add_Step(hwloc_ep pre-configure
COMMAND ./autogen.sh
DEPENDEES download
DEPENDERS configure
WORKING_DIRECTORY ${HWLOC_SOURCE_DIR})
ExternalProject_Add_Step(
hwloc_ep pre-configure
COMMAND ./autogen.sh
DEPENDEES download
DEPENDERS configure
WORKING_DIRECTORY ${HWLOC_SOURCE_DIR})

# The include directory must exist before it is referenced by a target.
file(MAKE_DIRECTORY "${HWLOC_INCLUDE_DIR}")

add_library(hwloc::hwloc STATIC IMPORTED)
set_target_properties(hwloc::hwloc
PROPERTIES IMPORTED_LOCATION
"${HWLOC_LIB_DIR}/${HWLOC_STATIC_LIB_NAME}"
INTERFACE_INCLUDE_DIRECTORIES
"${HWLOC_INCLUDE_DIR}")
set_target_properties(
hwloc::hwloc
PROPERTIES IMPORTED_LOCATION "${HWLOC_LIB_DIR}/${HWLOC_STATIC_LIB_NAME}"
INTERFACE_INCLUDE_DIRECTORIES "${HWLOC_INCLUDE_DIR}")

add_dependencies(hwloc::hwloc hwloc_ep)
endmacro()

macro(build_memkind)
message(STATUS "Building Memkind from source")
set(MEMKIND_BUILD_VERSION "v1.14.0")
set(MEMKIND_BUILD_SHA256_CHECKSUM "ab366b20b5a87ea655483631fc762ba6eb59eb6c3a08652e643f1ee3f06a6a12")
set(MEMKIND_BUILD_SHA256_CHECKSUM
"ab366b20b5a87ea655483631fc762ba6eb59eb6c3a08652e643f1ee3f06a6a12")
set(MEMKIND_SOURCE_URL
"https://github.com/memkind/memkind/archive/refs/tags/${MEMKIND_BUILD_VERSION}.tar.gz")
"https://github.com/memkind/memkind/archive/refs/tags/${MEMKIND_BUILD_VERSION}.tar.gz"
)
set(MEMKIND_LIB_NAME "memkind")
set(MEMKIND_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/memkind_ep-install")
set(MEMKIND_SOURCE_DIR "${MEMKIND_PREFIX}/src/memkind_ep")
set(MEMKIND_INCLUDE_DIR "${MEMKIND_SOURCE_DIR}/include")
set(MEMKIND_LIB_DIR "${MEMKIND_SOURCE_DIR}/.libs")
set(MEMKIND_STATIC_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${MEMKIND_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(MEMKIND_STATIC_LIB_NAME
"${CMAKE_STATIC_LIBRARY_PREFIX}${MEMKIND_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set(MEMKIND_STATIC_LIB_TARGETS
"${MEMKIND_SOURCE_DIR}/src/.libs/${MEMKIND_STATIC_LIB_NAME}")
set(MEMKIND_CONFIGURE_ARGS
"--prefix=${MEMKIND_PREFIX}"
"--with-pic"
"--enable-static")
ExternalProject_Add(memkind_ep
PREFIX ${MEMKIND_PREFIX}
URL ${MEMKIND_SOURCE_URL}
URL_HASH "SHA256=${MEMKIND_BUILD_SHA256_CHECKSUM}"
SOURCE_DIR ${MEMKIND_SOURCE_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env LDFLAGS=-L${HWLOC_LIB_DIR} env CFLAGS=-I${HWLOC_INCLUDE_DIR} env CXXFLAGS=-I${HWLOC_INCLUDE_DIR} ./configure ${MEMKIND_CONFIGURE_ARGS}
BUILD_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${MEMKIND_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)
"${MEMKIND_SOURCE_DIR}/src/.libs/${MEMKIND_STATIC_LIB_NAME}")
set(MEMKIND_CONFIGURE_ARGS "--prefix=${MEMKIND_PREFIX}" "--with-pic"
"--enable-static")
ExternalProject_Add(
memkind_ep
PREFIX ${MEMKIND_PREFIX}
URL ${MEMKIND_SOURCE_URL}
URL_HASH "SHA256=${MEMKIND_BUILD_SHA256_CHECKSUM}"
SOURCE_DIR ${MEMKIND_SOURCE_DIR}
CONFIGURE_COMMAND
${CMAKE_COMMAND} -E env LDFLAGS=-L${HWLOC_LIB_DIR} env
CFLAGS=-I${HWLOC_INCLUDE_DIR} env CXXFLAGS=-I${HWLOC_INCLUDE_DIR}
./configure ${MEMKIND_CONFIGURE_ARGS}
BUILD_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${MEMKIND_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)

ExternalProject_Add_Step(memkind_ep pre-configure
COMMAND ./autogen.sh
DEPENDEES download
DEPENDERS configure
WORKING_DIRECTORY ${MEMKIND_SOURCE_DIR})
ExternalProject_Add_Step(
memkind_ep pre-configure
COMMAND ./autogen.sh
DEPENDEES download
DEPENDERS configure
WORKING_DIRECTORY ${MEMKIND_SOURCE_DIR})

add_dependencies(memkind_ep hwloc::hwloc)

# The include directory must exist before it is referenced by a target.
file(MAKE_DIRECTORY "${MEMKIND_INCLUDE_DIR}")

add_library(memkind::memkind STATIC IMPORTED)
set_target_properties(memkind::memkind
PROPERTIES IMPORTED_LOCATION
"${MEMKIND_LIB_DIR}/${MEMKIND_STATIC_LIB_NAME}"
INTERFACE_INCLUDE_DIRECTORIES
"${MEMKIND_INCLUDE_DIR}")
target_link_libraries(memkind::memkind INTERFACE hwloc::hwloc dl numa pthread daxctl)
set_target_properties(
memkind::memkind
PROPERTIES IMPORTED_LOCATION "${MEMKIND_LIB_DIR}/${MEMKIND_STATIC_LIB_NAME}"
INTERFACE_INCLUDE_DIRECTORIES "${MEMKIND_INCLUDE_DIR}")
target_link_libraries(memkind::memkind INTERFACE hwloc::hwloc dl numa pthread
daxctl)

add_dependencies(memkind::memkind memkind_ep)
endmacro()
Expand Down
80 changes: 45 additions & 35 deletions cpp/CMake/BuildQATZstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,66 +28,76 @@ macro(build_qatzstd)
include(FindZstd)

message(STATUS "Building QAT-ZSTD from source")
set(QATZSTD_SOURCE_URL
"https://github.com/marin-ma/QAT-ZSTD-Plugin.git")
set(QATZSTD_SOURCE_URL "https://github.com/marin-ma/QAT-ZSTD-Plugin.git")
set(QATZSTD_SOURCE_BRANCH "fix-duplicate-symbol")
set(QATZSTD_LIB_NAME "qatseqprod")

set(QATZSTD_PREFIX
"${CMAKE_CURRENT_BINARY_DIR}/qatzstd_ep-install")
set(QATZSTD_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/qatzstd_ep-install")
set(QATZSTD_SOURCE_DIR "${QATZSTD_PREFIX}/src/qatzstd_ep")
set(QATZSTD_INCLUDE_DIR "${QATZSTD_SOURCE_DIR}/src")
set(QATZSTD_STATIC_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${QATZSTD_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(QATZSTD_STATIC_LIB_TARGETS "${QATZSTD_SOURCE_DIR}/src/${QATZSTD_STATIC_LIB_NAME}")
set(QATZSTD_STATIC_LIB_NAME
"${CMAKE_STATIC_LIBRARY_PREFIX}${QATZSTD_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set(QATZSTD_STATIC_LIB_TARGETS
"${QATZSTD_SOURCE_DIR}/src/${QATZSTD_STATIC_LIB_NAME}")
set(QATZSTD_MAKE_ARGS "ENABLE_USDM_DRV=1" "ZSTDLIB=${ZSTD_INCLUDE_DIR}")

ExternalProject_Add(qatzstd_ep
PREFIX ${QATZSTD_PREFIX}
GIT_REPOSITORY ${QATZSTD_SOURCE_URL}
GIT_TAG ${QATZSTD_SOURCE_BRANCH}
SOURCE_DIR ${QATZSTD_SOURCE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${MAKE} ${QATZSTD_MAKE_ARGS}
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${QATZSTD_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)
ExternalProject_Add(
qatzstd_ep
PREFIX ${QATZSTD_PREFIX}
GIT_REPOSITORY ${QATZSTD_SOURCE_URL}
GIT_TAG ${QATZSTD_SOURCE_BRANCH}
SOURCE_DIR ${QATZSTD_SOURCE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ${MAKE} ${QATZSTD_MAKE_ARGS}
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${QATZSTD_STATIC_LIB_TARGETS}
BUILD_IN_SOURCE 1)

add_library(qatzstd::qatzstd STATIC IMPORTED)

# The include directory must exist before it is referenced by a target.
file(MAKE_DIRECTORY "${QATZSTD_INCLUDE_DIR}")

set(QATZSTD_INCLUDE_DIRS
"${QATZSTD_INCLUDE_DIR}"
"${ZSTD_INCLUDE_DIR}")
set(QATZSTD_INCLUDE_DIRS "${QATZSTD_INCLUDE_DIR}" "${ZSTD_INCLUDE_DIR}")

set(QATZSTD_LINK_LIBRARIES
"${ZSTD_LIBRARY}"
"${QAT_LIBRARY}"
"${USDM_DRV_LIBRARY}"
"${ADF_LIBRARY}"
"${ZSTD_LIBRARY}" "${QAT_LIBRARY}" "${USDM_DRV_LIBRARY}" "${ADF_LIBRARY}"
"${OSAL_LIBRARY}")

set_target_properties(qatzstd::qatzstd
PROPERTIES IMPORTED_LOCATION
"${QATZSTD_STATIC_LIB_TARGETS}"
INTERFACE_INCLUDE_DIRECTORIES
"${QATZSTD_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES
"${QATZSTD_LINK_LIBRARIES}")
set_target_properties(
qatzstd::qatzstd
PROPERTIES IMPORTED_LOCATION "${QATZSTD_STATIC_LIB_TARGETS}"
INTERFACE_INCLUDE_DIRECTORIES "${QATZSTD_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${QATZSTD_LINK_LIBRARIES}")

add_dependencies(qatzstd::qatzstd qatzstd_ep)
endmacro()

find_library(QAT_LIBRARY REQUIRED NAMES qat PATHS "$ENV{ICP_ROOT}/build" NO_DEFAULT_PATH)
find_library(USDM_DRV_LIBRARY REQUIRED NAMES usdm_drv PATHS "$ENV{ICP_ROOT}/build" NO_DEFAULT_PATH)
find_library(ADF_LIBRARY REQUIRED NAMES adf PATHS "$ENV{ICP_ROOT}/build" NO_DEFAULT_PATH)
find_library(OSAL_LIBRARY REQUIRED NAMES osal PATHS "$ENV{ICP_ROOT}/build" NO_DEFAULT_PATH)
find_library(
QAT_LIBRARY REQUIRED
NAMES qat
PATHS "$ENV{ICP_ROOT}/build"
NO_DEFAULT_PATH)
find_library(
USDM_DRV_LIBRARY REQUIRED
NAMES usdm_drv
PATHS "$ENV{ICP_ROOT}/build"
NO_DEFAULT_PATH)
find_library(
ADF_LIBRARY REQUIRED
NAMES adf
PATHS "$ENV{ICP_ROOT}/build"
NO_DEFAULT_PATH)
find_library(
OSAL_LIBRARY REQUIRED
NAMES osal
PATHS "$ENV{ICP_ROOT}/build"
NO_DEFAULT_PATH)

message(STATUS "Found qat: ${QAT_LIBRARY}")
message(STATUS "Found usdm_drv: ${USDM_DRV_LIBRARY}")
message(STATUS "Found adf: ${ADF_LIBRARY}")
message(STATUS "Found osal: ${OSAL_LIBRARY}")

build_qatzstd()

Loading

0 comments on commit fec9be2

Please sign in to comment.