object-introspection/resources/CMakeLists.txt
Jake Hillion a9cffbe22d Compile Time OIL for OIL v2
Summary:
Update `OIGenerator` and out BUCK stuff for compile time OIL with OIL v2. Main things:
- Switch `OIGenerator` from the `getObjectSize` call to the new `introspect` call.
- Switch from looking at template parameters to looking at function parameters, as this was exposing a bug in our elfutils/drgn and this way it's the same as OID.
- Migrate `OIGenerator` to CodeGen v2 and update CodeGen v2 to accept a linkage name.
- Update the compile time example to be the same as the JIT example, using the new interface and the JSON exporter.
- Clean up the `ObjectIntrospection.h` header.

Differential Revision: D48687728

fbshipit-source-id: 2c3c041fd1b6499c5e02eb5e2082a977bfa529d7
2023-08-30 04:28:02 -07:00

44 lines
1.4 KiB
CMake

add_library(resources headers.cpp)
target_include_directories(resources PRIVATE ../)
function(embed_headers output)
file(WRITE ${output} "#include \"oi/Headers.h\"\n\n")
file(APPEND ${output} "namespace oi::detail::headers {\n")
set(HEADERS
../include/oi/IntrospectionResult-inl.h
../include/oi/IntrospectionResult.h
../include/oi/exporters/ParsedData.h
../include/oi/exporters/inst.h
../include/oi/result/Element.h
../include/oi/types/dy.h
../include/oi/types/st.h
../oi/OITraceCode.cpp
)
foreach(header ${HEADERS})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${header})
file(REAL_PATH ${header} header_path)
file(REAL_PATH ${CMAKE_SOURCE_DIR}/include include_path)
file(REAL_PATH ${CMAKE_SOURCE_DIR} base_path)
cmake_path(IS_PREFIX include_path ${header_path} NORMALIZE in_include)
if (${in_include})
file(RELATIVE_PATH header_rel_path ${include_path} ${header_path})
else()
file(RELATIVE_PATH header_rel_path ${base_path} ${header_path})
endif()
string(MAKE_C_IDENTIFIER ${header_rel_path} varname)
get_filename_component(filename ${header} NAME)
file(READ ${header} contents)
file(APPEND ${output} "const std::string_view ${varname} = R\"CONTENTS(${contents})CONTENTS\";\n\n")
endforeach()
file(APPEND ${output} "} // namespace oi::detail::headers\n")
endfunction()
embed_headers(${CMAKE_BINARY_DIR}/resources/headers.cpp)