Files

44 lines
1.7 KiB
CMake

# P4-14 configure-only module mode matrix.
# Usage:
# cmake -DVDE_SOURCE_DIR=<repo> -DVDE_WORK_DIR=<build root> -DVDE_GENERATOR=Ninja \
# -P tests/module_packages/mode_matrix.cmake
#
# This is intentionally configure-only: real build/consumer coverage runs in CI on
# runners with the required toolchain. No pass is claimed when configure is skipped.
cmake_minimum_required(VERSION 3.20)
if(NOT DEFINED VDE_SOURCE_DIR OR NOT IS_DIRECTORY "${VDE_SOURCE_DIR}")
message(FATAL_ERROR "mode_matrix: VDE_SOURCE_DIR is required")
endif()
if(NOT DEFINED VDE_WORK_DIR)
set(VDE_WORK_DIR "${CMAKE_CURRENT_BINARY_DIR}/mode_matrix")
endif()
if(NOT DEFINED VDE_GENERATOR OR VDE_GENERATOR STREQUAL "")
set(VDE_GENERATOR "Ninja")
endif()
file(MAKE_DIRECTORY "${VDE_WORK_DIR}")
foreach(mode shared plugin)
set(build_dir "${VDE_WORK_DIR}/${mode}")
file(REMOVE_RECURSE "${build_dir}")
message(STATUS "mode_matrix: configure VDE_MODULES_MODE=${mode}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -S "${VDE_SOURCE_DIR}" -B "${build_dir}"
-G "${VDE_GENERATOR}"
"-DVDE_MODULES_MODE=${mode}"
"-DVDE_BUILD_TOOLS=ON"
"-DVDE_BUILD_TESTS=OFF"
"-DVDE_INSTALL=OFF"
RESULT_VARIABLE rc
OUTPUT_VARIABLE out
ERROR_VARIABLE err)
if(NOT rc EQUAL 0)
message(FATAL_ERROR "mode_matrix: ${mode} configure failed (${rc})\n${out}\n${err}")
endif()
if(NOT EXISTS "${build_dir}/CMakeCache.txt")
message(FATAL_ERROR "mode_matrix: ${mode} did not create CMakeCache.txt")
endif()
message(STATUS "mode_matrix: ${mode} configure PASS")
endforeach()
message(STATUS "mode_matrix: PASS (configure-only; full build/consumer requires CI runner)")