diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-06 16:18:56 +0100 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2018-02-12 23:46:48 +0000 |
commit | 0b300c94094412fbf36e942fe00c18da0e5ed62a (patch) | |
tree | f3cacf3fe8a8a8398a2afb7ab87cf1cd99b5caf6 /mkspecs/features/simd.prf | |
parent | 211791d01cf89bb75691f965d3a4ebc42c5ed8ee (diff) |
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>
Diffstat (limited to 'mkspecs/features/simd.prf')
-rw-r--r-- | mkspecs/features/simd.prf | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mkspecs/features/simd.prf b/mkspecs/features/simd.prf index 8471ce7e7c..e4bee7107c 100644 --- a/mkspecs/features/simd.prf +++ b/mkspecs/features/simd.prf @@ -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) |