Files
TheRock/third-party/sysdeps/common/expat/CMakeLists.txt
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

132 lines
4.6 KiB
CMake

# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# When included in TheRock, we download sources and set up the sub-project.
set(_source_dir "${CMAKE_CURRENT_BINARY_DIR}/source")
set(_download_stamp "${_source_dir}/download.stamp")
therock_subproject_fetch(therock-expat-sources
SOURCE_DIR "${_source_dir}"
# Originally mirrored from: https://github.com/libexpat/libexpat/releases/download/R_2_7_5/expat-2.7.5.tar.xz
URL https://rocm-third-party-deps.s3.us-east-2.amazonaws.com/expat-2.7.5.tar.xz
URL_HASH SHA256=1032dfef4ff17f70464827daa28369b20f6584d108bc36f17ab1676e1edd2f91
TOUCH "${_download_stamp}"
# We need DOWNLOAD_EXTRACT_TIMESTAMP set to TRUE to preserve the timestamp
# of the extracted sources, otherwise the build system will notice
# changes and will try to re-run autotools, causing issues.
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
therock_cmake_subproject_declare(therock-expat
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR .
FPRINT_SOURCE_DIR "${_source_dir}"
FPRINT_FILE_GLOBS "${CMAKE_CURRENT_LIST_DIR}/*"
BINARY_DIR build
NO_MERGE_COMPILE_COMMANDS
BACKGROUND_BUILD
OUTPUT_ON_FAILURE
CMAKE_ARGS
"-DSOURCE_DIR=${_source_dir}"
"-DPATCHELF=${PATCHELF}"
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}"
INSTALL_DESTINATION
lib/rocm_sysdeps
INTERFACE_LINK_DIRS
lib/rocm_sysdeps/lib
INTERFACE_INSTALL_RPATH_DIRS
lib/rocm_sysdeps/lib
INTERFACE_PKG_CONFIG_DIRS
lib/rocm_sysdeps/lib/pkgconfig
EXTRA_DEPENDS
"${_download_stamp}"
)
therock_cmake_subproject_provide_package(therock-expat expat lib/rocm_sysdeps/lib/cmake/expat)
therock_cmake_subproject_activate(therock-expat)
therock_test_validate_shared_lib(
PATH build/dist/lib/rocm_sysdeps/lib
LIB_NAMES libexpat.so
)
add_test(
NAME expat_header_test_1
COMMAND ls "${CMAKE_CURRENT_BINARY_DIR}/build/dist/lib/rocm_sysdeps/include/expat.h"
)
add_test(
NAME expat_header_test_2
COMMAND ls "${CMAKE_CURRENT_BINARY_DIR}/build/dist/lib/rocm_sysdeps/include/expat_config.h"
)
add_test(
NAME expat_header_test_3
COMMAND ls "${CMAKE_CURRENT_BINARY_DIR}/build/dist/lib/rocm_sysdeps/include/expat_external.h"
)
return()
endif()
# Otherwise, this is the sub-project build.
cmake_minimum_required(VERSION 3.25)
project(EXPAT_BUILD VERSION "2.7.5")
# Apply patch source only on Linux
set(patch_source_commands)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND patch_source_commands COMMAND
bash "${CMAKE_CURRENT_SOURCE_DIR}/patch_source.sh" "${SOURCE_DIR}")
endif()
add_custom_target(
build ALL
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
#
# OPTIONAL: Patching of the sources should happen here.
#
COMMAND
${patch_source_commands}
COMMAND
"${CMAKE_COMMAND}" -E env
"PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}"
# Escaping: Double $ to satisfy CMake, then double $ to satisfy configure,
# then escaped single quotes to make it to the linker command line.
"LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath=\\'\\$$\\$$ORIGIN\\' -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/version.lds"
"CPPFLAGS=${EXTRA_CPPFLAGS}"
--
"${SOURCE_DIR}/configure"
--prefix "${CMAKE_INSTALL_PREFIX}"
--libdir "${CMAKE_INSTALL_PREFIX}/lib"
# Disable examples and tests.
--without-examples
--without-tests
# Disable docbook-based man page generation. The xmlwf man page is
# not part of TheRock's artifacts, and expat 2.7.x configure errors
# out on SGML-only docbook2man (the default on Debian/Ubuntu via
# docbook-utils) rather than falling back gracefully.
--without-docbook
# Disable maintainer-mode, otherwise our copy of the sources directory
# will potentially alter the timestamp of acinclude.m4, which will
# trigger a reconfigure with a version of aclocal we do not have.
--disable-maintainer-mode
COMMAND
make V=1
COMMAND
make install
COMMAND
"${CMAKE_COMMAND}" -E env
"PATCHELF=${PATCHELF}"
"THEROCK_SOURCE_DIR=${THEROCK_SOURCE_DIR}"
"Python3_EXECUTABLE=${Python3_EXECUTABLE}" --
"${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/patch_install.py" ${CMAKE_INSTALL_PREFIX}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/expat-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/expat-config.cmake
@ONLY
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/expat-config.cmake" DESTINATION lib/cmake/expat)