2023-05-18 13:22:09 +00:00
|
|
|
# This will re-generate the headers if any file within src was modified.
|
2023-06-08 11:03:59 +00:00
|
|
|
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/stdlib/src/)
|
2023-05-18 13:22:09 +00:00
|
|
|
|
|
|
|
set(STDLIB stub)
|
|
|
|
set(GENERATED_STDLIB_HEADERS)
|
|
|
|
foreach(src IN LISTS STDLIB)
|
2023-06-08 11:03:59 +00:00
|
|
|
set(STDLIB_FILE ${PROJECT_SOURCE_DIR}/libstdlib/src/${src}.sol)
|
2023-05-18 13:22:09 +00:00
|
|
|
file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX)
|
|
|
|
string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
|
|
|
list(REMOVE_ITEM STDLIB_FILE_CONTENT "0d")
|
|
|
|
string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
|
|
|
set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}")
|
|
|
|
set(STDLIB_FILE_NAME ${src})
|
2023-06-09 16:21:55 +00:00
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.src.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h NEWLINE_STYLE LF @ONLY)
|
|
|
|
list(APPEND GENERATED_STDLIB_HEADERS ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h)
|
2023-05-18 13:22:09 +00:00
|
|
|
endforeach()
|
|
|
|
|
2023-06-09 16:21:55 +00:00
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/stdlib.h NEWLINE_STYLE LF @ONLY)
|