1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:17:35 +00:00

Meta+Userland: Add jakt as an optional Lagom Tool

We can now use ENABLE_JAKT to pull jakt as a host tool and use it to
pre-process .jakt files into .cpp files for use in serenity applications
This commit is contained in:
Andrew Kaster 2022-05-19 23:46:36 -06:00 committed by Andreas Kling
parent f19aad8336
commit ca42da23c2
11 changed files with 122 additions and 3 deletions

View file

@ -0,0 +1,31 @@
include("${CMAKE_CURRENT_LIST_DIR}/LagomTargets.cmake")
if (@ENABLE_JAKT@)
# FIXME: corrosion does not support corrosion_install(TARGETS <targets>... EXPORT <export-name>)
# Instead, hack up the magic sauce using the imported location of IPCCompiler
# Create imported target Lagom::jakt
add_executable(Lagom::jakt IMPORTED)
# Figure out where the binary directory of the install tree is
get_property(_IMPORTED_BINDIR
TARGET Lagom::IPCCompiler
PROPERTY LOCATION
)
get_filename_component(_IMPORTED_BINDIR "${_IMPORTED_BINDIR}" DIRECTORY)
get_filename_component(_IMPORTED_INCLUDEDIR "${_IMPORTED_BINDIR}" DIRECTORY)
set(_IMPORTED_INCLUDEDIR "${_IMPORTED_INCLUDEDIR}/include")
# Set the imported location of the tool
set_target_properties(Lagom::jakt PROPERTIES
IMPORTED_LOCATION "${_IMPORTED_BINDIR}/jakt"
IMPORTED_INCLUDE_DIRECTORIES "${_IMPORTED_INCLUDEDIR}/jakt"
)
if (NOT EXISTS "${_IMPORTED_BINDIR}/jakt")
message(FATAL_ERROR "The imported target \"jakt\" references the file \"${_IMPORTED_BINDIR}/jakt\" but this file does not exist.")
endif()
unset(_IMPORTED_BINDIR)
unset(_IMPORTED_INCLUDEDIR)
endif()