aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2014-06-20 23:38:19 +0100
committerRui Abreu Ferreira <raf-ep@gmx.com>2014-11-29 23:39:52 +0000
commit05d72e98265b260f645835701a0183596b674c97 (patch)
tree98523b677a53cc20fd232f34299c3645ce1d9636 /src
parent75524dbf9ac0013305fa4357066c36f41784a87c (diff)
downloadrneovim-05d72e98265b260f645835701a0183596b674c97.tar.gz
rneovim-05d72e98265b260f645835701a0183596b674c97.tar.bz2
rneovim-05d72e98265b260f645835701a0183596b674c97.zip
Refactor declaration generation
- Call compiler from CMake instead of lua script to generate a preprocessor file - allows for better/early error detection if the compiler fails - Preprocessor files are saved along with the headers as .i files - Accept preprocessor lines with trailing chars after # as is the case in Clang/Windows - The fourth argument to gendeclarations.lua is now the path to the proprocessor output file
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 3b05c7329c..69b7440da2 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -109,13 +109,15 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
get_directory_property(gen_cdefs COMPILE_DEFINITIONS)
-foreach(gen_cdef ${gen_cdefs})
- set(gen_cflags "${gen_cflags} -D${gen_cdef}")
+foreach(gen_cdef ${gen_cdefs} DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
+ if(NOT "${gen_cdef}" MATCHES "INCLUDE_GENERATED_DECLARATIONS")
+ list(APPEND gen_cflags "-D${gen_cdef}")
+ endif()
endforeach()
get_directory_property(gen_includes INCLUDE_DIRECTORIES)
foreach(gen_include ${gen_includes})
- set(gen_cflags "${gen_cflags} -I${gen_include}")
+ list(APPEND gen_cflags "-I${gen_include}")
endforeach()
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
set(gen_cflags "${gen_cflags} ${CMAKE_C_FLAGS_${build_type}} ${CMAKE_C_FLAGS}")
@@ -132,11 +134,12 @@ foreach(sfile ${NEOVIM_SOURCES}
endif()
set(gf1 "${GENERATED_DIR}/${r}.c.generated.h")
set(gf2 "${GENERATED_INCLUDES_DIR}/${r}.h.generated.h")
+ set(gf3 "${GENERATED_DIR}/${r}.i")
+ separate_arguments(C_FLAGS_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS})
add_custom_command(
OUTPUT "${gf1}" "${gf2}"
- COMMAND "${LUA_PRG}" "${HEADER_GENERATOR}"
- "${sfile}" "${gf1}" "${gf2}"
- "${CMAKE_C_COMPILER} ${gen_cflags} -E"
+ COMMAND ${CMAKE_C_COMPILER} ${sfile} -o ${gf3} ${gen_cflags} -E ${C_FLAGS_ARRAY}
+ COMMAND "${LUA_PRG}" "${HEADER_GENERATOR}" "${sfile}" "${gf1}" "${gf2}" "${gf3}"
DEPENDS "${HEADER_GENERATOR}" "${sfile}"
)
list(APPEND NEOVIM_GENERATED_SOURCES "${gf1}")