Adding .S file to Xcode target via qmake
-
Hello!
It looks like adding a .S file to SOURCES in a .pro file does not add the file to the target in Xcode, when running qmake with “-spec macx-xcode.”
What is the correct way to add a .S file to the build target when creating and Xcode project with qmake?
See example qmake project linked here.
Thank you!
-
Hi,
I can't currently confirm it works for that mkspec but:
CONFIG -= qt TEMPLATE = app SOURCES = main.c NASMEXTRAFLAGS = -f macho64 OTHER_FILES += $$NASM_SOURCES nasm.output = ${QMAKE_FILE_BASE}.o nasm.commands = nasm $$NASMEXTRAFLAGS -o ${QMAKE_FILE_BASE}.o ${QMAKE_FILE_NAME} nasm.input = NASM_SOURCES QMAKE_EXTRA_COMPILERS += nasm NASM_SOURCES += darwin.S
Will build the .S file when using the default mkspec.
Hope it helps
-
@SGaist said in Adding .S file to Xcode target via qmake:
Hi,
I can't currently confirm it works for that mkspec but:
CONFIG -= qt TEMPLATE = app SOURCES = main.c NASMEXTRAFLAGS = -f macho64 OTHER_FILES += $$NASM_SOURCES nasm.output = ${QMAKE_FILE_BASE}.o nasm.commands = nasm $$NASMEXTRAFLAGS -o ${QMAKE_FILE_BASE}.o ${QMAKE_FILE_NAME} nasm.input = NASM_SOURCES QMAKE_EXTRA_COMPILERS += nasm NASM_SOURCES += darwin.S
Will build the .S file when using the default mkspec.
Hope it helps
Yeah, I saw that I but I think it is a good contribution to the thread. It doesn't work for the mac-xcode make spec, however. Or at least in the form posted above.
I read somewhere that .S files are yet-to-be preprocessed .s files. Maybe it's possible that Xcode automatically registers this .S file for pre-processing when added to the target via the gui and maybe qmake is not prepared for that? No idea.
-
From a quick look, the Xcode project generator doesn't handle .S files at all currently.
-
Can you compare the original Xcode projects and the one with that checkbox ticked ?
-
Sorry for the delay. This problem went away for a while (and deadlines got in the way), then resurfaced in 5.12.0.
It is impractical to do a diff comparison between the project files (probably due to Apple using unordered dicts/lists internally), but I was able to figure out that all Xcode does when you check the box to add the .S to the target is add a single reference to the source file in the "Compile Sources" dictionary in the pbxproj:
CD97B22A2208AF9100128C7C /* darwin64.S in Compile Sources / = {isa = PBXBuildFile; fileRef = 231D74EABC38BAD8EFB89ACB / darwin64.S */; };
The first hash key denotes the entry in the compile sources list; this key is not in the pbxproj before I checked the box. The second hash key is the reference to the source file itself; this key is in the pbxproj before I check the box.
I hope that helps.
-
Thanks for the analysis !
Would it be possible for you to provide a minimal project with the two corresponding Xcode projects ?
If not already there, would you open a feature request on the bug report system with it ?