solidity/stdlib/CMakeLists.txt
2023-02-02 11:17:15 +01:00

22 lines
961 B
CMake

# This will re-generate the headers if any file within src was modified.
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/stdlib/src/)
set(STDLIB precompiles)
set(GENERATED_STDLIB_HEADERS)
foreach(src IN LISTS STDLIB)
set(STDLIB_FILE ${CMAKE_SOURCE_DIR}/stdlib/src/${src}.sol)
file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX)
string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}")
set(STDLIB_FILE_NAME ${src})
configure_file("${CMAKE_SOURCE_DIR}/stdlib/stdlib.src.h.in" ${CMAKE_BINARY_DIR}/include/stdlib/${src}.h @ONLY)
list(APPEND GENERATED_STDLIB_HEADERS ${CMAKE_BINARY_DIR}/include/stdlib/${src}.h)
endforeach()
configure_file("${CMAKE_SOURCE_DIR}/stdlib/stdlib.h.in" ${CMAKE_BINARY_DIR}/include/stdlib.h @ONLY)
#add_library(stdlib
# ${GENERATED_STDLIB_HEADERS}
#)