nitc ios: xcode support per file cflags
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 13 Dec 2017 18:49:35 +0000 (13:49 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Jan 2018 20:30:12 +0000 (15:30 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/platform/xcode_templates.nit

index 19c04be..6e0231a 100644 (file)
@@ -85,6 +85,9 @@ class PbxFile
        # Path to `self`
        var path: String
 
+       # Compiler flags for this source file
+       var cflags: String = "" is writable
+
        # UUID for build elements
        private var build_uuid: String = sys.pbx_uuid_generator.next_uuid is lazy
 
@@ -104,15 +107,22 @@ class PbxFile
        end
 
        # PBX description of this file
-       private fun description: Writable do return """
+       private fun description: Writable
+       do
+               var extra = ""
+               var cflags = cflags
+               if not cflags.is_empty then extra = "\nsettings = \{COMPILER_FLAGS = \"{cflags}\"; \};"
+
+               return """
                {{{ref_uuid}}} /* {{{doc}}} */ = {
                        isa = PBXFileReference;
                        fileEncoding = 4;
                        lastKnownFileType = {{{file_type}}};
                        path = {{{path}}};
-                       sourceTree = "<group>";
+                       sourceTree = "<group>";{{{extra}}}
                        };
 """
+       end
 
        private fun add_to_project(project: PbxprojectTemplate)
        do