From 991d278c489a0664909325c6e9bbf2fdd1b1f032 Mon Sep 17 00:00:00 2001 From: Dominique Belhachemi Date: Thu, 23 Jul 2026 14:08:01 -0400 Subject: [PATCH] [tint][cmake] Allow installing tint command-line tools without libs Split TINT_ENABLE_INSTALL into two independent flags: TINT_INSTALL_CMD_TOOLS - install the tint / tint_info binaries (default OFF) TINT_INSTALL_LIBS - install the internal tint libraries and headers (default OFF) TINT_ENABLE_INSTALL is marked as deprecated. --- CMakeLists.txt | 13 +++++++++++-- src/tint/CMakeLists.txt | 10 ++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90a025e6367..d52fa6f3b20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,7 +230,15 @@ else() set(TINT_DEFAULT_HLSL OFF) endif() -option(TINT_ENABLE_INSTALL "Enable install step for Tint libraries" OFF) +option(TINT_INSTALL_CMD_TOOLS "Install the Tint command-line tools" OFF) +option(TINT_INSTALL_LIBS "Install the internal Tint libraries and headers" OFF) +option(TINT_ENABLE_INSTALL "Deprecated: sets both TINT_INSTALL_CMD_TOOLS and TINT_INSTALL_LIBS to ON" OFF) +if (TINT_ENABLE_INSTALL) + message(DEPRECATION "TINT_ENABLE_INSTALL is deprecated. Use TINT_INSTALL_CMD_TOOLS " + "and/or TINT_INSTALL_LIBS instead.") + set(TINT_INSTALL_CMD_TOOLS ON) + set(TINT_INSTALL_LIBS ON) +endif() option(TINT_BUILD_CMD_TOOLS "Build the Tint command line tools" ON) if (DAWN_BUILD_SAMPLES) @@ -339,7 +347,8 @@ message(STATUS "LLVM Source dir: ${LLVM_SOURCE_DIR}") message(STATUS "") message(STATUS "Tint build command line executable tools: ${TINT_BUILD_CMD_TOOLS}") -message(STATUS "Tint install: ${TINT_ENABLE_INSTALL}") +message(STATUS "Tint install command-line tools: ${TINT_INSTALL_CMD_TOOLS}") +message(STATUS "Tint install libraries: ${TINT_INSTALL_LIBS}") message(STATUS "Tint build IR binary: ${TINT_BUILD_IR_BINARY}") message(STATUS "Tint build fuzzers: ${TINT_BUILD_FUZZERS}") message(STATUS "Tint build fuzzing vulkan drivers: ${TINT_BUILD_FUZZER_VULKAN_SUPPORT}") diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt index 489e2e9a0a7..0e8f96fee76 100644 --- a/src/tint/CMakeLists.txt +++ b/src/tint/CMakeLists.txt @@ -231,20 +231,22 @@ function(tint_spvtools_compile_options TARGET) endfunction() function(tint_lib_compile_options TARGET) - if (TINT_ENABLE_INSTALL) + if (TINT_INSTALL_LIBS) install(TARGETS ${TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + OPTIONAL ) endif() tint_default_compile_options(${TARGET}) endfunction() function(tint_proto_compile_options TARGET) - if (TINT_ENABLE_INSTALL) + if (TINT_INSTALL_LIBS) install(TARGETS ${TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + OPTIONAL ) endif() tint_core_compile_options(${TARGET}) @@ -421,7 +423,7 @@ function(tint_add_target TARGET KIND) elseif(${KIND} STREQUAL cmd) add_executable(${TARGET}) tint_default_compile_options(${TARGET}) - if (TINT_ENABLE_INSTALL) + if (TINT_INSTALL_CMD_TOOLS) install(TARGETS "${TARGET}") endif() elseif(${KIND} STREQUAL test_cmd) @@ -753,7 +755,7 @@ add_library(libtint ALIAS tint_api) ################################################################################ # Install rules ################################################################################ -if (TINT_ENABLE_INSTALL) +if (TINT_INSTALL_LIBS) # We need to recurse all folders and include all headers because tint.h includes most headers from src/tint file(GLOB TINT_HEADERS "${DAWN_INCLUDE_DIR}/tint/*.h")