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
147 lines
4.5 KiB
CMake
147 lines
4.5 KiB
CMake
# Copyright (c) Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# SQLite3 - cloned from upstream and built from the amalgamation
|
|
#
|
|
# Mirrors the pattern used by sibling rocprofiler-systems
|
|
# (projects/rocprofiler-systems/cmake/SQLite3.cmake): fetch the upstream
|
|
# git repository at a pinned tag, then build locally. Avoids vendoring
|
|
# any binary blobs in the source tree.
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
set(SQLITE3_GIT_URL
|
|
"https://github.com/sqlite/sqlite.git"
|
|
CACHE STRING
|
|
"Upstream SQLite3 git repository URL"
|
|
)
|
|
set(SQLITE3_GIT_TAG
|
|
"version-3.45.3"
|
|
CACHE STRING
|
|
"Upstream SQLite3 git tag to check out"
|
|
)
|
|
|
|
message(
|
|
STATUS
|
|
"[profiler-hub] Cloning SQLite3 from ${SQLITE3_GIT_URL} @ ${SQLITE3_GIT_TAG}"
|
|
)
|
|
|
|
find_package(Git REQUIRED)
|
|
find_program(MAKE_COMMAND NAMES make gmake REQUIRED)
|
|
|
|
set(SQLITE3_SOURCE_DIR "${PROJECT_BINARY_DIR}/external/sqlite3")
|
|
set(SQLITE3_AMALG_C "${SQLITE3_SOURCE_DIR}/sqlite3.c")
|
|
set(SQLITE3_AMALG_H "${SQLITE3_SOURCE_DIR}/sqlite3.h")
|
|
|
|
# checkout: shallow + partial first, retry full on failure
|
|
if(NOT EXISTS "${SQLITE3_SOURCE_DIR}/configure")
|
|
if(EXISTS "${SQLITE3_SOURCE_DIR}")
|
|
file(REMOVE_RECURSE "${SQLITE3_SOURCE_DIR}")
|
|
endif()
|
|
execute_process(
|
|
COMMAND
|
|
${GIT_EXECUTABLE} clone --depth 1 --filter=blob:none --branch
|
|
${SQLITE3_GIT_TAG} ${SQLITE3_GIT_URL} ${SQLITE3_SOURCE_DIR}
|
|
RESULT_VARIABLE _sqlite3_clone_rc
|
|
)
|
|
if(NOT _sqlite3_clone_rc EQUAL 0)
|
|
message(
|
|
STATUS
|
|
"[profiler-hub] Optimized clone failed; retrying full clone"
|
|
)
|
|
if(EXISTS "${SQLITE3_SOURCE_DIR}")
|
|
file(REMOVE_RECURSE "${SQLITE3_SOURCE_DIR}")
|
|
endif()
|
|
execute_process(
|
|
COMMAND
|
|
${GIT_EXECUTABLE} clone --branch ${SQLITE3_GIT_TAG}
|
|
${SQLITE3_GIT_URL} ${SQLITE3_SOURCE_DIR}
|
|
RESULT_VARIABLE _sqlite3_clone_rc
|
|
)
|
|
endif()
|
|
if(NOT _sqlite3_clone_rc EQUAL 0)
|
|
message(
|
|
FATAL_ERROR
|
|
"[profiler-hub] git clone of SQLite3 failed (rc=${_sqlite3_clone_rc})"
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
# generate amalgamation (sqlite3.c + sqlite3.h) via upstream autotools
|
|
if(NOT EXISTS "${SQLITE3_AMALG_C}" OR NOT EXISTS "${SQLITE3_AMALG_H}")
|
|
message(STATUS "[profiler-hub] Generating SQLite3 amalgamation")
|
|
execute_process(
|
|
COMMAND ./configure --disable-tcl
|
|
WORKING_DIRECTORY ${SQLITE3_SOURCE_DIR}
|
|
RESULT_VARIABLE _sqlite3_configure_rc
|
|
)
|
|
if(NOT _sqlite3_configure_rc EQUAL 0)
|
|
message(
|
|
FATAL_ERROR
|
|
"[profiler-hub] SQLite3 ./configure failed (rc=${_sqlite3_configure_rc})"
|
|
)
|
|
endif()
|
|
execute_process(
|
|
COMMAND ${MAKE_COMMAND} sqlite3.c
|
|
WORKING_DIRECTORY ${SQLITE3_SOURCE_DIR}
|
|
RESULT_VARIABLE _sqlite3_make_rc
|
|
)
|
|
if(NOT _sqlite3_make_rc EQUAL 0)
|
|
message(
|
|
FATAL_ERROR
|
|
"[profiler-hub] SQLite3 amalgamation generation failed (rc=${_sqlite3_make_rc})"
|
|
)
|
|
endif()
|
|
if(NOT EXISTS "${SQLITE3_AMALG_C}" OR NOT EXISTS "${SQLITE3_AMALG_H}")
|
|
message(
|
|
FATAL_ERROR
|
|
"[profiler-hub] SQLite3 amalgamation files not found after build"
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
add_library(profiler-hub-sqlite3-static STATIC ${SQLITE3_AMALG_C})
|
|
|
|
target_include_directories(
|
|
profiler-hub-sqlite3-static
|
|
PUBLIC $<BUILD_INTERFACE:${SQLITE3_SOURCE_DIR}>
|
|
)
|
|
|
|
target_compile_definitions(
|
|
profiler-hub-sqlite3-static
|
|
PRIVATE
|
|
SQLITE_DEFAULT_MEMSTATUS=0
|
|
SQLITE_THREADSAFE=1
|
|
SQLITE_DEFAULT_WAL_SYNCHRONOUS=1
|
|
SQLITE_LIKE_DOESNT_MATCH_BLOBS=1
|
|
SQLITE_OMIT_DEPRECATED=1
|
|
SQLITE_OMIT_PROGRESS_CALLBACK=1
|
|
SQLITE_OMIT_SHARED_CACHE=1
|
|
)
|
|
|
|
# Seal the bundled SQLite symbols so they are not exported from
|
|
# libprofiler-hub.{so,a} and cannot collide with (or be interposed by)
|
|
# other sqlite3 versions bundled by sibling components on TheRock.
|
|
target_compile_options(
|
|
profiler-hub-sqlite3-static
|
|
PRIVATE -O2 -fPIC -fvisibility=hidden
|
|
)
|
|
|
|
set_target_properties(
|
|
profiler-hub-sqlite3-static
|
|
PROPERTIES POSITION_INDEPENDENT_CODE ON C_STANDARD 11
|
|
)
|
|
|
|
add_library(profiler-hub-sqlite3 INTERFACE)
|
|
target_link_libraries(
|
|
profiler-hub-sqlite3
|
|
INTERFACE profiler-hub-sqlite3-static ${CMAKE_DL_LIBS}
|
|
)
|
|
|
|
message(
|
|
STATUS
|
|
"[profiler-hub] SQLite3 amalgamation source: ${SQLITE3_SOURCE_DIR}"
|
|
)
|