Warning, /acts/CI/codegen_prebuilt_check/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # Checks that a directory of pre-generated code is complete and that
0002 # acts_code_generation actually picks it up.
0003 #
0004 # This deliberately is not ACTS: it declares no languages and builds no code, so
0005 # it needs neither a compiler nor any of the C++ dependencies a real ACTS
0006 # configure requires. What it does exercise is the real ActsCodegen.cmake, the
0007 # real manifest and the real lookup, with ACTS_CODEGEN_REQUIRE_PREBUILT turning
0008 # any fall back to running a generator into a configure error.
0009 #
0010 # CI/pregenerate_codegen.py --output <prebuilt>
0011 # cmake -S CI/codegen_prebuilt_check -B <build> \
0012 # -DACTS_SOURCE_DIR=<acts> -DACTS_CODEGEN_PREBUILT_DIR=<prebuilt>
0013 # cmake --build <build>
0014 #
0015 # Leaving ACTS_CODEGEN_PREBUILT_DIR unset instead checks that the directory is
0016 # found on its own next to the top-level CMakeLists.txt, which is how a build
0017 # from the release source archive finds it.
0018
0019 cmake_minimum_required(VERSION 3.19)
0020 project(ActsCodegenPrebuiltCheck NONE)
0021
0022 # This project lives at <acts>/CI/codegen_prebuilt_check, so the source tree is
0023 # known without being told. ACTS_SOURCE_DIR is only there to point the check at
0024 # a different tree, such as an unpacked source archive; pass it as an absolute
0025 # path, since a relative one resolves against this directory.
0026 if(NOT DEFINED ACTS_SOURCE_DIR)
0027 set(ACTS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
0028 endif()
0029 get_filename_component(ACTS_SOURCE_DIR "${ACTS_SOURCE_DIR}" ABSOLUTE)
0030
0031 if(NOT EXISTS "${ACTS_SOURCE_DIR}/cmake/ActsCodegen.cmake")
0032 message(
0033 FATAL_ERROR
0034 "ACTS_SOURCE_DIR=${ACTS_SOURCE_DIR} does not look like an ACTS source tree"
0035 )
0036 endif()
0037
0038 set(ACTS_CODEGEN_REQUIRE_PREBUILT ON CACHE BOOL "" FORCE)
0039 include(${ACTS_SOURCE_DIR}/cmake/ActsCodegen.cmake)
0040
0041 acts_codegen_manifest(_manifest)
0042 string(JSON _count LENGTH "${_manifest}" units)
0043 if(_count EQUAL 0)
0044 message(FATAL_ERROR "The codegen manifest is empty")
0045 endif()
0046 math(EXPR _last "${_count} - 1")
0047
0048 foreach(_i RANGE ${_last})
0049 string(JSON _key MEMBER "${_manifest}" units ${_i})
0050
0051 # Stand-in for the real consumer: acts_code_generation only asks its target
0052 # for the TYPE and then attaches an include directory and a dependency, so
0053 # an INTERFACE library exercises the same wiring ActsCore does.
0054 string(MAKE_C_IDENTIFIER "${_key}" _target)
0055 add_library(${_target} INTERFACE)
0056
0057 acts_code_generation(ADD_TO_TARGET ${_target} KEY ${_key})
0058 endforeach()
0059
0060 message(STATUS "Checked ${_count} codegen units")