Skip to content
Snippets Groups Projects
Commit 035ccd87 authored by Nick Zavaritsky's avatar Nick Zavaritsky
Browse files

Fix tarantool.h generation on osx

Pass sysroot.
Abort build if preprocessing fails (a stage in tarantool.h generation).
parent 3010b98b
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
function(rebuild_module_api)
set (dstfile "${CMAKE_CURRENT_BINARY_DIR}/tarantool.h")
set (tmpfile "${dstfile}.new")
set (errcodefile "${CMAKE_CURRENT_BINARY_DIR}/errcode.i")
set (headers)
# Get absolute path for header files (required of out-of-source build)
foreach (header ${ARGN})
......@@ -12,16 +13,24 @@ function(rebuild_module_api)
endif()
endforeach()
set (cflags ${CMAKE_C_FLAGS})
separate_arguments(cflags)
# Pass sysroot settings on OSX
if (NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "")
set (cflags ${cflags} ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT})
endif()
add_custom_command(OUTPUT ${dstfile}
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/tarantool_header.h > ${tmpfile}
COMMAND cat ${headers} | ${CMAKE_SOURCE_DIR}/extra/apigen >> ${tmpfile}
COMMAND ${CMAKE_C_COMPILER}
${cflags}
-I ${CMAKE_SOURCE_DIR}/src -I ${CMAKE_BINARY_DIR}/src
-E ${CMAKE_SOURCE_DIR}/src/box/errcode.h |
grep "enum box_error_code" >> ${tmpfile}
-E ${CMAKE_SOURCE_DIR}/src/box/errcode.h > ${errcodefile}
COMMAND
grep "enum box_error_code" ${errcodefile} >> ${tmpfile}
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/tarantool_footer.h >> ${tmpfile}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tmpfile} ${dstfile}
COMMAND ${CMAKE_COMMAND} -E remove ${tmpfile}
COMMAND ${CMAKE_COMMAND} -E remove ${errcodefile} ${tmpfile}
DEPENDS ${srcfiles} ${CMAKE_SOURCE_DIR}/src/box/errcode.h
${CMAKE_CURRENT_SOURCE_DIR}/tarantool_header.h
${CMAKE_CURRENT_SOURCE_DIR}/tarantool_footer.h
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment