Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Toolchain/CMake/Scripts/FindNodosSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,23 @@ endmacro()

macro(nos_find_plugin_sdk requested_sdk_version out_sdk_target out_sdk_dir)
if (${requested_sdk_version} VERSION_GREATER_EQUAL "39.11.0")
nos_get_package("nodos.sdk.plugin" ${requested_sdk_version} sdk_target_name)
nos_download_package("nodos.sdk.plugin" ${requested_sdk_version} sdk_manifest_path sdk_path sdk_info_json)
if(NOT DEFINED FLATC_EXECUTABLE)
set(_flatc_exe "flatc${CMAKE_EXECUTABLE_SUFFIX}")
if (EXISTS "${sdk_path}/Binaries/${_flatc_exe}")
set(FLATC_EXECUTABLE "${sdk_path}/Binaries/${_flatc_exe}" CACHE PATH "Path to the flatc executable" FORCE)
elseif (EXISTS "${sdk_path}/bin/${_flatc_exe}")
set(FLATC_EXECUTABLE "${sdk_path}/bin/${_flatc_exe}" CACHE PATH "Path to the flatc executable" FORCE)
endif()
endif()
_nos_make_package_target_name("nodos.sdk.plugin" ${requested_sdk_version} sdk_target_name)
nos_configure_package("nodos.sdk.plugin" ${requested_sdk_version} ${sdk_target_name} ${sdk_path} ${sdk_manifest_path} "${sdk_info_json}")
if (NOT TARGET ${sdk_target_name})
nos_fatal_error("Failed to find Nodos Plugin SDK ${requested_sdk_version}.")
endif()
nos_get_package_info("nodos.sdk.plugin" ${requested_sdk_version} "manifest_path" sdk_manifest_path)
get_filename_component(sdk_path "${sdk_manifest_path}" DIRECTORY)
set(${out_sdk_target} ${sdk_target_name})
set(${out_sdk_dir} ${sdk_path})

set(FLATC_EXECUTABLE "${sdk_path}/Binaries/flatc" CACHE PATH "Path to the flatc executable" FORCE)
else()
# For all nodos sdks, call `nodos sdk-info ${requested_sdk_version} plugin` and read the json if ret code is 0
if(NOT NOSMAN_EXECUTABLE)
Expand Down Expand Up @@ -135,4 +142,4 @@ macro(nos_find_plugin_sdk requested_sdk_version out_sdk_target out_sdk_dir)
set(FLATC_EXECUTABLE "${plugin_sdk_path}/bin/flatc" CACHE PATH "Path to the flatc executable" FORCE)
endif()
endif()
endmacro()
endmacro()
7 changes: 5 additions & 2 deletions Toolchain/CMake/Scripts/GeneratePluginTargetsAuto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ function(_nos_generate_plugin_target plugin_manifest_file_path plugin_name manif

_nos_get_custom_type_paths_from_json(${plugin_manifest_file_path} TYPE_FOLDERS)
if(TYPE_FOLDERS)
nos_generate_flatbuffers("${TYPE_FOLDERS}" "${CMAKE_CURRENT_SOURCE_DIR}/Include/${target_name}" "cpp" "${NOS_SDK_DIR}/Types;${found_dep_dirs}" ${target_name}_generated)
set(generated_include_root "${CMAKE_CURRENT_BINARY_DIR}/__generated__/${target_name}/Include")
set(generated_include_dir "${generated_include_root}/${target_name}")
nos_generate_flatbuffers("${TYPE_FOLDERS}" "${generated_include_dir}" "cpp" "${NOS_SDK_DIR}/Types;${found_dep_dirs}" ${target_name}_generated)
list(APPEND plugin_include_folders "${generated_include_root}")
list(APPEND plugin_dep_targets ${target_name}_generated)
endif()

Expand Down Expand Up @@ -203,4 +206,4 @@ foreach(cur_plugin_dir ${MODULE_DIRS})
endif()
nos_colored_message(COLOR GREEN "Scanning for plugins in ${cur_plugin_dir}")
_nos_process_plugin_directories_recursive("${cur_plugin_dir}" "" "")
endforeach()
endforeach()
Loading