# Auto-generated by rexglue - DO NOT EDIT # SDK version # Set REXSDK_VERSION to pin a specific SDK version. # Otherwise, the version of the SDK that generated this file is used. set(REXSDK_VERSION "" CACHE STRING "Override SDK version (leave empty for default)") # Find SDK set(REXSDK_DIR "" CACHE PATH "Path to rexglue-sdk source tree") if(REXSDK_DIR) add_subdirectory("{{ cmake_var("REXSDK_DIR") }}" rexglue-sdk) message(STATUS "Using ReXGlue SDK from source tree: {{ cmake_var("REXSDK_DIR") }}") else() if(REXSDK_VERSION) find_package(rexglue {{ cmake_var("REXSDK_VERSION") }} EXACT QUIET CONFIG) else() find_package(rexglue {{ sdk_version }} QUIET CONFIG) endif() if(NOT rexglue_FOUND) message(FATAL_ERROR "ReXGlue SDK not found. Either:\n" " - Set REXSDK_DIR to the rexglue-sdk source tree (e.g. thirdparty/rexglue-sdk)\n" " - Install the SDK package and ensure it is on CMAKE_PREFIX_PATH") endif() message(STATUS "Found ReXGlue SDK ${REXGLUE_VERSION_STRING} at ${rexglue_DIR}") endif() # Host target name used by the codegen-emitted dll_targets.cmake to colocate # guest DLLs with the host EXE. Defaults to PROJECT_NAME (which the # manifest-first init flow sets equal to the host target name). if(NOT DEFINED REXGLUE_HOST_TARGET) set(REXGLUE_HOST_TARGET {{ cmake_var("PROJECT_NAME") }}) endif() # Include entrypoint generated code if codegen has been run. if(EXISTS "{{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }}/{{ entrypoint_out_dir }}/sources.cmake") include({{ entrypoint_out_dir }}/sources.cmake) set(REXGLUE_ENTRYPOINT_GENERATED_SOURCES {{ cmake_var("GENERATED_SOURCES") }}) set(REXGLUE_ENTRYPOINT_INCLUDE_DIR "{{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }}/{{ entrypoint_out_dir }}") endif() # Configure a rexglue target with SDK libraries and platform settings. # Call after add_executable() in your CMakeLists.txt. # Usage: rexglue_setup_target() macro(rexglue_setup_target target_name) target_sources({{ cmake_var("target_name") }} PRIVATE {{ cmake_var("REXGLUE_ENTRYPOINT_GENERATED_SOURCES") }}) target_include_directories({{ cmake_var("target_name") }} PRIVATE {{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }} {{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }}/src {{ cmake_var("REXGLUE_ENTRYPOINT_INCLUDE_DIR") }} ) target_link_libraries({{ cmake_var("target_name") }} PRIVATE rex::runtime) rexglue_configure_target({{ cmake_var("target_name") }}) endmacro() # Include DLL module shared library targets if codegen has generated them if(EXISTS "{{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }}/{{ entrypoint_out_dir }}/dll_targets.cmake") include({{ entrypoint_out_dir }}/dll_targets.cmake) endif() # Codegen target - run 'cmake --build . --target {{ names.snake_case }}_codegen' # Uses the manifest to drive codegen for all modules (entrypoint + DLLs). add_custom_target({{ names.snake_case }}_codegen COMMAND $ codegen {{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }}/{{ names.snake_case }}_manifest.toml WORKING_DIRECTORY {{ cmake_var("CMAKE_CURRENT_SOURCE_DIR") }} COMMENT "Generating recompiled code for {{ names.snake_case }}" VERBATIM )