Skip to content

Commit

Permalink
Add other supported generation languages to generate_get_config.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
mtyszczak committed Dec 12, 2024
1 parent bc40a76 commit 909b0dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libraries/protocol/get_config.d/generate_get_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ macro(generate_get_config path_to_config_hpp get_config_cpp_in get_config_cpp_ou

# removing includes and pragmas
file(STRINGS ${path_to_new_config_hpp} file_content )
get_filename_component(file_extension "${get_config_cpp_out}" EXT)
string(SUBSTRING "${file_extension}" 1 -1 file_extension)
string(TOLOWER "${file_extension}" file_extension)
list(FILTER file_content EXCLUDE REGEX "#(include|pragma)" )
set(prepared_get_content)
foreach(x ${file_content})
Expand Down Expand Up @@ -55,7 +58,13 @@ macro(generate_get_config path_to_config_hpp get_config_cpp_in get_config_cpp_ou
string(REGEX REPLACE "#define ([A-Z0-9_]+) .*" "\\1" UNSAFE_VALUE "${line}")
string(STRIP ${UNSAFE_VALUE} VALUE)
if( NOT ${VALUE} STREQUAL "HIVE_CHAIN_ID" )
list( APPEND list_of_new_lines " result[\"${VALUE}\"] = ${VALUE}\;\n" )
if ("${file_extension}" STREQUAL "cpp")
list( APPEND list_of_new_lines " result[\"${VALUE}\"] = ${VALUE}\;\n" )
elseif ("${file_extension}" STREQUAL "ts")
list( APPEND list_of_new_lines " \"${VALUE}\": string\;\n" )
else()
message(FATAL_ERROR "Unsupported language detected for get_config file generation: ${file_extension}")
endif()
endif()
endif()
endforeach()
Expand Down

0 comments on commit 909b0dd

Please sign in to comment.