simd.prf: Add support for compiling .c sources with the C compiler

Right now we are using the C++ compiler here, which relies on
the compilers automatically switching mode. This behavior is also
deprecated in newer clang versions and block clang developer
builds.

Task-number: QTBUG-64822
Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I4d3c00ac528a45934c85777f42d243d0fe367c92
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-02-06 16:18:56 +01:00 committed by Jake Petroules
parent 211791d01c
commit 0b300c9409

View File

@ -23,6 +23,7 @@ defineTest(addSimdCompiler) {
upname = $$upper($$name)
headers_var = $${upname}_HEADERS
sources_var = $${upname}_SOURCES
csources_var = $${upname}_C_SOURCES
asm_var = $${upname}_ASM
CONFIG($$1) {
@ -34,6 +35,14 @@ defineTest(addSimdCompiler) {
export(SOURCES)
} else {
# We need special compiler flags
# Split C and C++ sources
$$csources_var = $$find($$sources_var, ".*\\.c$")
$$sources_var -= $$eval($$csources_var)
export($$csources_var)
export($$sources_var)
# Add C++ compiler
$${name}_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $$cflags $(INCPATH) ${QMAKE_FILE_IN}
msvc: $${name}_compiler.commands += -Fo${QMAKE_FILE_OUT}
else: $${name}_compiler.commands += -o ${QMAKE_FILE_OUT}
@ -52,6 +61,26 @@ defineTest(addSimdCompiler) {
export($${name}_compiler.input)
export($${name}_compiler.variable_out)
export($${name}_compiler.name)
# Add a C compiler
$${name}_c_compiler.commands = $$QMAKE_CC -c $(CFLAGS) $$cflags $(INCPATH) ${QMAKE_FILE_IN}
msvc: $${name}_c_compiler.commands += -Fo${QMAKE_FILE_OUT}
else: $${name}_c_compiler.commands += -o ${QMAKE_FILE_OUT}
$${name}_c_compiler.dependency_type = TYPE_C
$${name}_c_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
$${name}_c_compiler.input = $$csources_var
$${name}_c_compiler.variable_out = OBJECTS
$${name}_c_compiler.name = compiling[$${name}] ${QMAKE_FILE_IN}
silent: $${name}_c_compiler.commands = @echo compiling[$${name}] ${QMAKE_FILE_IN} && $$eval($${name}_c_compiler.commands)
QMAKE_EXTRA_COMPILERS += $${name}_c_compiler
export($${name}_c_compiler.commands)
export($${name}_c_compiler.dependency_type)
export($${name}_c_compiler.output)
export($${name}_c_compiler.input)
export($${name}_c_compiler.variable_out)
export($${name}_c_compiler.name)
}
# We always need an assembler (need to run the C compiler and without precompiled headers)