Kode/kincmake

Compile only shaders

kirnuarp opened this issue · 2 comments

it would be nice if there would be an option to only compile the shaders so for example you wouldn't have to reopen the XCode project every time you change shaders and build the whole project.

Changes required would be something like this:

diff --git a/out/koremake.js b/out/koremake.js
index 5f7ba76..79fd866 100644
--- a/out/koremake.js
+++ b/out/koremake.js
@@ -137,6 +137,11 @@ let options = [
         value: true,
         description: 'Use a specific compiler',
         default: Compiler_1.Compiler.Default
+    },
+    {
+        full: 'onlyshaders',
+        value: false,
+        description: 'Compile only shaders'
     }
 ];
 let parsedOptions = {};
diff --git a/out/main.js b/out/main.js
index 07ff393..ac5b933 100644
--- a/out/main.js
+++ b/out/main.js
@@ -205,7 +205,12 @@ async function compileShader(projectDir, type, from, to, temp, platform, builddi
 }
 async function exportKoremakeProject(from, to, platform, options) {
     log.info('korefile found.');
-    log.info('Creating ' + fromPlatform(platform) + ' project files.');
+    if(options.onlyshaders) {
+         log.info('Only compiling shaders.');
+    } 
+    else {
+        log.info('Creating ' + fromPlatform(platform) + ' project files.');
+    }
     Project_1.Project.root = path.resolve(from);
     let project;
     try {
@@ -244,6 +249,10 @@ async function exportKoremakeProject(from, to, platform, options) {
             }
         }
     }
+
+    if(options.onlyshaders){
+        return project;
+    }
     // Run again to find new shader files for Metal
     project.searchFiles(undefined);
     project.flatten();
@@ -378,6 +387,9 @@ async function run(options, loglog) {
         return '';
     }
     let solutionName = project.getName();
+    if(options.onlyshaders){
+        return solutionName;
+    }
     if (options.compile && solutionName !== '') {
         log.info('Compiling...');
         const dothemath = true;

I agree. Would you like to create a pull request?

created pull request. It's only quick fix and could probably be done better but it works for me