use absolute paths for include for all compilers and insert include files before include directories

This commit is contained in:
swaldhoer 2020-04-24 14:53:56 +02:00
parent 4c309af079
commit 13f337b8b4
3 changed files with 3 additions and 10 deletions

View File

@ -17,7 +17,7 @@ def c_hook(self, node):
class c(Task.Task):
"Compiles C files into object files"
run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${CPPFILES_ST:INCFILES} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPFILES_ST:INCFILES} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
vars = ['CCDEPS'] # unused variable to depend on, just in case
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
scan = c_preproc.scan

View File

@ -141,14 +141,7 @@ def apply_incfiles(self):
node_lst.append(x)
else:
node_lst.append(self.path.find_node(x))
cwd = self.get_cwd()
if self.env.CXX_NAME == "msvc":
# CL.exe treats file includes relative to the source file. So either we calculate the relative
# file include path for each source file, or we just do it once using absolute paths, which is
# simpler and just works.
self.env.INCFILES = [x.abspath() for x in node_lst if x.is_file()]
else:
self.env.INCFILES = [x.path_from(cwd) for x in node_lst if x.is_file()]
self.env.INCFILES = [x.abspath() for x in node_lst if x.is_file()]
class link_task(Task.Task):
"""

View File

@ -18,7 +18,7 @@ if not '.c' in TaskGen.task_gen.mappings:
class cxx(Task.Task):
"Compiles C++ files into object files"
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${CPPFILES_ST:INCFILES} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPFILES_ST:INCFILES} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
vars = ['CXXDEPS'] # unused variable to depend on, just in case
ext_in = ['.h'] # set the build order easily by using ext_out=['.h']
scan = c_preproc.scan