diff --git a/cmake/FindRPCGenerator.cmake b/cmake/FindRPCGenerator.cmake index 296b3171..b867b20f 100644 --- a/cmake/FindRPCGenerator.cmake +++ b/cmake/FindRPCGenerator.cmake @@ -133,6 +133,18 @@ function( else() message("target ${dep}_generate does not exist so skipped") endif() + # when installed (used through a package) idl dependencies can be found through their *_host (or *_enclave) targets: + # we know that /${param_install_dir}/interfaces/include is in the target's include directories, and + # that the idls themselves are in /${param_install_dir} + if(TARGET ${dep}_host) + get_target_property(include_dirs ${dep}_host INTERFACE_INCLUDE_DIRECTORIES) + foreach(include_dir ${include_dirs}) + if(${include_dir} MATCHES "/interfaces/include$") + string(REPLACE "/interfaces/include" "" idl_dir ${include_dir}) + set(PATHS_PARAMS ${PATHS_PARAMS} --path ${idl_dir}) + endif() + endforeach() + endif() endforeach() if(NOT ${namespace} STREQUAL "") @@ -402,6 +414,7 @@ function( endif() if(params_install_dir) + # install the files when creating a package install(DIRECTORY "$" DESTINATION ${params_install_dir}/interfaces/include) install(DIRECTORY "$" @@ -409,5 +422,9 @@ function( install(DIRECTORY "$" DESTINATION ${params_install_dir}/interfaces/check_sums) install(FILES "$" DESTINATION ${params_install_dir}/${idl_relative_dir}) + # make sure the files can be found when used through a package + target_include_directories(${name}_idl_host INTERFACE $) + target_include_directories(${name}_idl_enclave + INTERFACE $) endif() endfunction() diff --git a/generator/src/json_schema/generator.cpp b/generator/src/json_schema/generator.cpp index fa5641e8..27c6c9df 100644 --- a/generator/src/json_schema/generator.cpp +++ b/generator/src/json_schema/generator.cpp @@ -2,6 +2,7 @@ #include "cpp_parser.h" // Your parser API header #include "json_schema/generator.h" #include "json_schema/writer.h" +#include #include #include #include @@ -335,7 +336,7 @@ namespace json_schema_generator writer.write_string_property("type", "integer"); writer.write_key("enum"); writer.open_array(); - int next_value = 0; + int64_t next_value = 0; std::vector value_descriptions; using underlying = std::underlying_type::type; const entity_type ALL_POSSIBLE_MEMBERS @@ -348,7 +349,7 @@ namespace json_schema_generator std::string enum_value_name = clean_type_name(element_ptr->get_name()); if (!enum_value_name.empty() && enum_value_name.find_first_of("{}[]() \t\n\r") == std::string::npos) { - int assigned_value = next_value; + int64_t assigned_value = next_value; const function_entity* value_entity = dynamic_cast(element_ptr.get()); if (value_entity) { @@ -357,7 +358,7 @@ namespace json_schema_generator { try { - assigned_value = std::stoi(explicit_value_str); + assigned_value = std::stoll(explicit_value_str); } catch (const std::exception& e) {