Skip to content
SunDaw edited this page Jan 15, 2023 · 1 revision

Kinc uses a javascript file called kfile.js where you configure your project. A basic kfile.js looks like this:

var project = new Project('ProjectName');

await project.addProject('Kinc');

project.addFile('Sources/**');
project.setDebugDir('Deployment');

project.flatten();

resolve(project);

This sets the Source folders and the Deployment folder, and uses the default configuration for other options. The DebugDir specified will contain the compiled Shader files if ever you had any in the folder specified by addFile.

Add a Custom Icon

Add the icon.png file to the root project directory to use it as a new icon. The desired resolution is 512x512 or 1024x1024 for high-dpi monitors. You can also set custom path:

project.icon = 'path/icon.png';

Add a Source folder

project.addFile('Sources/**');

You can use multiple source folders, including external folders.

Add a Include folder

project.addIncludeDir('include');

Add a Native Library

project.addLib('libv8_monolith.a');

Add a Subproject

await project.addProject(pathToProject);

kmake can integrate other Kinc projects, it will parse their kfiles and include all sources and shaders. Be aware that addProject is asynchronous - use await to synchronize execution.

Add a Shader folder

project.addFiles('Sources/Shaders/**');

Set compiler C/C++ standard version flags

project.cStd = 'c11';
project.cppStd = 'c++17';

Add a Conditional Compilation Flag for Kinc builds

project.addDefine('SOME_DEFINE=1');

alternatively flags for c or cpp can be added like so:

project.addCFlag('SOME_DEFINE=1');
project.addCppFlag('KINCY_STUFF=1');

Set specific options for the android target

const android = project.targetOptions.android;
android.package = 'com.example.app';
android.versionCode = 1;
android.versionName = '1.0';
// https://developer.android.com/guide/topics/manifest/activity-element.html#screen
android.screenOrientation = 'portrait';
android.permissions = ['android.permission.VIBRATE'];
// https://developer.android.com/guide/topics/manifest/manifest-element#install
android.installLocation = "internalOnly";
// https://developer.android.com/guide/topics/manifest/meta-data-element
android.metadata = [];
// same as <meta-data android:name="disableStickyImmersiveMode" android:value="true"/>
android.disableStickyImmersiveMode = true;
android.globalBuildGradlePath = 'data/android/build.gradle';
android.buildGradlePath = 'data/android/app/build.gradle';
android.proguardRulesPath = 'data/android/app/proguard-rules.pro';
// for files in Android Studio project-level dir
android.customFilesPath = 'data/android/files';

Set specific options for the iOS target

project.targetOptions.ios.bundle = 'com.example.$(PRODUCT_NAME:rfc1034identifier)';
project.targetOptions.ios.organizationName = 'Your Awesome Organization';
project.targetOptions.ios.developmentTeam = 'XXXXXXXXXX';
project.targetOptions.ios.version = '1.0';
project.targetOptions.ios.build = '1';

(to find your development team ID, visit https://developer.apple.com/account/#/membership and use the alphanumeric code under Team ID)