fix paths of includes in clib.c

With the module search path cleverly handled with different install.h
configurations, the genstatic script inserted absolute paths into the
generated clib.c file. This didn't fail on Windows CI as this is an
in-source build. For out-of-source builds, it's crucial that clib.c can
refer to both .c files in the source directory and those generated in
the build directory. As a fix, the genstatic invocation now uses the -I
flag.

This patch also improves the handling of include paths to find the .c.
files mentioned above by trimming down the scope of this property to
clib.c only. Also, there is no need to manually tell the preprocessor
where to look for generated .c, as they live relative to clib.c anyhow.
This commit is contained in:
Lukas Böger 2021-06-18 11:49:35 +01:00
parent 7de835bad8
commit e2555e5fed
2 changed files with 12 additions and 7 deletions

View file

@ -27,7 +27,6 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
endif()
#
# Features
#
@ -284,6 +283,17 @@ if (NOT BUILD_SHARED_LIBS)
${genstatic-helper}
${slds})
# The generated file will #include both manually written files in
# the source directory as well as files generated by chibi-ffi in
# the build directory. The latter can be found without special flags,
# as they are relative to the clib.c, but the preprocessor needs
# help for the former. As only clib.c needs this flag, we set it
# as locally as possible, i.e., not as a target property.
set_source_files_properties(${clibout}
PROPERTIES
INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(libchibi-scheme
PUBLIC
SEXP_USE_STATIC_LIBS=1)
@ -291,11 +301,6 @@ if (NOT BUILD_SHARED_LIBS)
target_sources(libchibi-scheme
PUBLIC
${clibout})
target_include_directories(libchibi-common
INTERFACE
$<BUILD_INTERFACE:${stuboutdir}/..>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
endif()
#

View file

@ -16,7 +16,7 @@ if(NOT OUT)
endif()
execute_process(
COMMAND ${EXEC} ${GENSTATIC} --no-inline
COMMAND ${EXEC} -q -I ./lib ${GENSTATIC} --no-inline
INPUT_FILE ${STUBS}
OUTPUT_FILE ${OUT}
RESULT_VARIABLE rr