Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding .S file to Xcode target via qmake
Forum Updated to NodeBB v4.3 + New Features

Adding .S file to Xcode target via qmake

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    patrickkidd
    wrote on 12 Jan 2018, 17:53 last edited by
    #1

    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!

    https://alaskafamilysystems.com/

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 12 Jan 2018, 21:06 last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply 13 Jan 2018, 05:34
      0
      • S SGaist
        12 Jan 2018, 21:06

        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

        P Offline
        P Offline
        patrickkidd
        wrote on 13 Jan 2018, 05:34 last edited by
        #3

        @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.

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 14 Jan 2018, 21:52 last edited by
          #4

          From a quick look, the Xcode project generator doesn't handle .S files at all currently.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          P 1 Reply Last reply 3 Feb 2018, 03:02
          0
          • S SGaist
            14 Jan 2018, 21:52

            From a quick look, the Xcode project generator doesn't handle .S files at all currently.

            P Offline
            P Offline
            patrickkidd
            wrote on 3 Feb 2018, 03:02 last edited by
            #5

            @SGaist

            Crap. It's a simple checkbox to add it to the target in the gui, I wonder if there is some way to hack this.

            https://alaskafamilysystems.com/

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 4 Feb 2018, 22:17 last edited by
              #6

              Can you compare the original Xcode projects and the one with that checkbox ticked ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • P Offline
                P Offline
                patrickkidd
                wrote on 4 Feb 2019, 17:44 last edited by
                #7

                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.

                https://alaskafamilysystems.com/

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 4 Feb 2019, 22:02 last edited by
                  #8

                  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 ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved