Coder Social home page Coder Social logo

kode / kmake Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 13.0 648.48 MB

Meta build system

License: Other

JavaScript 60.28% Makefile 0.28% Shell 0.20% R 0.04% HTML 0.86% C++ 21.19% Python 12.36% C 2.82% Assembly 0.01% DTrace 0.20% Roff 0.05% Batchfile 0.22% Emacs Lisp 0.08% Perl 0.06% TypeScript 1.36% CMake 0.01%

kmake's Introduction

kmake is a meta-build-tool for C/C++ projects similar in its functionality to premake and cmake. It is an extended fork of Node.js so it provides the speed of V8 and all of the Node.js-API to kmake-build-scripts.

For when you are only changing TypeScript and/or JavaScript files without also doing changes to the native side, clone this repo and with your normal kmake binary do:

kmake --dev absolute/path/to/kmake_repo

For when you are changing TypeScript and/or JavaScript files to create a node build that pulls them in at runtime, build with the following command:

Windows: vcbuild.bat openssl-no-asm without-intl node-builtin-modules-path %cd%

*nix based: ./configure --openssl-no-asm --without-intl --node-builtin-modules-path $(pwd)

kmake's People

Contributors

addaleax avatar aduh95 avatar apapirovski avatar bnoordhuis avatar bridgear avatar cjihrig avatar danbev avatar indutny avatar isaacs avatar jasnell avatar joyeecheung avatar mhdawson avatar mscdex avatar mylesborins avatar piscisaureus avatar refack avatar richardlau avatar robdangerous avatar ronag avatar rvagg avatar ry avatar sam-github avatar shigeki avatar targos avatar tjfontaine avatar tniessen avatar tootallnate avatar trevnorris avatar trott avatar vsemozhetbyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kmake's Issues

Feature Request: Provide way to access relative path to main `DebugDir`

Currently there appears to be no way to determine the path to the directory specified in setDebugDir of the top most project, thus no straight forward way to place assets from a sub-project in that directory.

A way to determine that directory inside the kfile of a sub-project for copy operations would be great.

Feature Request: Enable passing parameters to `addProject` calls

Please extend the addProject method to accept optional parameter(s) that can be used in the kfile.js of the added project.

This would allow the user to handle setup of a project depending on whether arguments were passed or not.

In my specific use case it would serve to avoid adding the same project multiple times due to nested dependencies when the project is being used as a sub-project, compared to when it is used as standalone project.

It seems cppStd doesn't work for visual studio

let project = new Project('project')
project.cpp = true;
project.cppStd = 'c++17';
project.addFile('Sources/**');
project.setDebugDir('Deployment');
project.addIncludeDir('Sources');
resolve(project);

I create a project like this, but in visual studio the c++ language standard is still c++14. Do I miss anything?

new android khafile.js settings doesn't work as expected.

bug introduced with Kode/kincmake@d5c5a9a
template values are not filled in a project with
project.targetOptions.android.package = 'it.asdasd.'+projecName;
project.targetOptions.android.versionCode = 1;
project.targetOptions.android.versionName = '1.0';
project.targetOptions.android.screenOrientation = 'landscape';
for the new parameters.
old parameters seems to work well.
new ones just retain the {variable} syntax in the output file.

example output
compileSdkVersion {compileSdkVersion}
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "it.asdasd.Sample"
minSdkVersion {minSdkVersion}
targetSdkVersion {targetSdkVersion}

expected output
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "it.asdasd.Sample"
minSdkVersion 14
targetSdkVersion 29

even specifying the values in the kincfile.js doesn't fix the problem

Feature Request: Improved Error messages

Whenever an error happens in kmake, the resulting error message doesn't include the offending kfile.js + line number that caused the error.

One typically gets an error along these lines:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:372:5)
    at validateString (node:internal/validators:119:11)
    at Object.resolve (node:path:167:9)
    at node:kmake/Project:106:45
    at new Promise (<anonymous>)
    at loadProject (node:kmake/Project:73:12)
    at Project.addProject (node:kmake/Project:663:31)
    at eval (eval at <anonymous> (node:kmake/Project:109:27), <anonymous>:15:35)
    at node:kmake/Project:109:278
    at new Promise (<anonymous>) {
  code: 'ERR_INVALID_ARG_TYPE'
}
Error: kfile did not call resolve, no project created.
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

The error shows where it happens in kmake, but it originates as anonymous promise which makes it hard to determine where it originated in my kfile.js

The requested feature would ideally show the respective kfile.js + line number that triggered the exception. Not sure if it is even possible, but any approximation would already be a big improvement imho.

Only compile shaders that have changed or need to recompile

What is the problem this feature will solve?

Only compile shaders when necessary:

  1. When the shader source has changed
  2. When targeting another graphics backend

What is the feature you are proposing to solve the problem?

AFAIK, khamake already handles shader compilation that way. So similar/same strategy for Kinc/kmake projects.

What alternatives have you considered?

No real alternative viable.. I tend to add/remove the --noshaders flag to speed up / recompile all

Customizing platform build files for android

hi robert,

i'm currently testing a build on android-native. after much debugging on why the app crashed when i access network features, i figured out i need to add <uses-permission android:name="android.permission.INTERNET" /> to the AndroidManifest.xml.

This is an excerpt of the old Adobe Air descriptor we were using for our app, and i basically need to supply all these infos now with kha as well

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
...
<uses-permission android:name="XXX.permission.C2D_MESSAGE" />

... old air native extensions, not sure yet how this translates to new libraries ...

<application>
    <!-- milkman - goviral ane settings -->
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fbXXXXXXXXXXX"/>
    <meta-data android:name="com.facebook.sdk.ApplicationName" android:value="XXXXXXXXX" />

    <activity android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="XXXXX" />
    <provider android:authorities="com.facebook.app.FacebookContentProviderXXXXXXXXX" android:name="com.facebook.FacebookContentProvider" android:exported="true" />

    <!-- milkman - coremobile settings -->
    <receiver android:name="com.milkmangames.extensions.android.CMLocalNotificationReceiver"/>

... a lot more stuff ...

Have any opinion on how i should add all the stuff that i later need?

  1. go with how {package} and {screenOrientation} are used now:
  • add project.targetOptions.android_native.XXX = 'some string' in khafile.js
  • replace the {XXX} with the 'some string' when writing the AndroidManifest.xml
  1. just supply the whole manifest file in the khafile.js
  • project.buildOptions.android_native.manifest = 'google-playstore.xml'
  • project.buildOptions.android_native.manifest = 'amazon-appshop.xml'
  1. ...?

enhancement option to make shareable project files.(no absolute paths)

Now when you share a project you have 2 options , force others to use your exact same directory structure or make them install node js and build the project themself with koremake. a flag to make Visual studio project includes and libraries paths relative could be a real time saver.

problem #defining in project a file to be used in #include "filename.h" in html5 due to lack of " " in the expansion.

project.addDefine('IMGUI_USER_CONFIG="imguiconfig.h"');
#include IMGUI_USER_CONFIG
get expanded to #include imguiconfig.h instead of #include "imguiconfig.h" in html5 only.
Kincmake should catch these cases and fix to get consistency among platforms.

the correctly escaped string for html5 is project.addDefine('IMGUI_USER_CONFIG="\"imguiconfig.h\""');
so addDefine should transform odd " to "\" and even " to \"" right?
this in the case the addDefine comes in the same format as my reference sample.

[Feature Request] option to only output JSON information to stdout

I would like to use kmake a bit like pkg-config, i.e. retrieve CFLAGS, LDFLAGS etc. for use in my build system. The --json flag almost gets me there, except for:

  • it outputs to a file; support for /dev/stdout would be nice (if only to avoid race conditions with parallel builds)
  • it re-creates all the build files; this undoes my post-kmake steps so I need to be extra careful with the order of operations

None of that is really critical and I can find workarounds, but it would be nice to have. Does that make sense?

Add additional project file at root level?

I am wondering if it is possible to add additional projects at the root level when including other libraries in a project. For example, I am including Entt, and would like it to appear at the same root level as Kore in the project navigator in Xcode (see attached image). I tried a few approaches, including seeing whether an instance of the main project is being passed to the korefile.js at the project root, but I couldn't find it. This is the code I am using in the project's korefile.js:

let project = new Project('MyProject');

// add Entt
project.addFile('Entt/src/entt/**');
project.addIncludeDir('Entt/src/entt');

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

resolve(project);

structure

enhancement Visual studio custom path for added files instead of the full relative path.

Having my project in root/projects/project and everything else in as root/kore, root/engine, root/modules/module/include I end up in visual studio having everything very nested starting under ../../ .
It would be great a way to specify custom filters in add files to have more clear and concise paths in visual studio.
e.g. "module/file.h" instead of ../../modules/module/include/module/file.h .
the api could be project.addFile("module/include/module/**","module");

"Shaders failing to compile" issue on OS X when --from / --to are specifed

When trying to build Kinc on OS X, the following command

node ./Karp/Kinc/make --dynlib --kincfile kincfile.js --kinc ./Karp/Kinc --from ./Karp/ --to ./build/kinc/

Doesn't work and produces a shader compiler error with the following:

(null): Error unable to open input file (use -h for usage)

However running the same command without specifying --from / --to works:

node ./Karp/Kinc/make --dynlib --kincfile kincfile.js --kinc ./Karp/Kinc

For now I'm just using the second command to get around the issue, but would love for the to/from parameters to work.

Generated solution for Visual Studio failing on build when a --to flag passed at SLN generation time

I'm having an issue where, when I specify a from/to directory, the SLN exporter falsely appends the paths on top of each other, throwing an error.

If I have a directory structure like

Top/
  build/
  KincProj/
    Kinc/
  kincfile.js

And I run the following command from inside Top/

node ./KincProj/Kinc/make --dynlib --kincfile kincfile.js --kinc ./KincProj/Kinc --from ./KincProj/ --to ./build/kinc/

and then try to build that generated solution, I get:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(1170,14): error MSB4023: Cannot evaluate the item metadata "%(RootDir)". The item met
applied to the path "..\..\KincProj\C:\Users\kyle\Workspace\Top\KincProj\Deployment\g1.frag". The given path's format is not supported. [C:\Users\kyle\Workspace\Top\build\kinc\Kinc.vcxproj]

This directory:

..\..\KincProj\C:\Users\kyle\Workspace\Top\KincProj\Deployment\g1.frag

..\..\KincProj is the location of the KincProject from the perspective of Kinc, but not where the project actually is (via --to).

CodeBlocksExporter for Windows?

Currently I build a project with the command node Kha/make, and I get the VS solution. I imported the solution into Code::Blocks, and I could not build the resulting project with neither CLang nor TDM64-GCC. I assume, there is something wrong with macro & defines. It would be great if there was the ability to generate the working Code::Blocks project for Windows and not for Visual Studio. Is the support of the option planned?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.