Skip to content

Add -G command line option to specify generator #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 15, 2016
Merged

Add -G command line option to specify generator #64

merged 9 commits into from
Nov 15, 2016

Conversation

d3x0r
Copy link
Contributor

@d3x0r d3x0r commented Nov 3, 2016

Allow specification of generator from command line.
(Allows use of MinGW-64 instead of visual studio for instance)

MUST complete; if a step fails when using this...

(MinGW Makefiles) cmake script complains if 'sh.exe' is in the path. Normally I can just run cmake . again and finish the process... but cmake-js continues to error.
Second, I ended up doing it in an environment that was missing gcc, but didn't have sh.exe; so it finished with failure to find compilers, and retriggering failed....

But; deleting the build, having no sh.exe, having gcc in my path correctly - am able to finish building with
cmake-js build -G "MinGW Makefiles"

Error: could not find CMAKE_PROJECT_NAME in Cache
I guess; if it fails too soon that's the state.

d3x0r added 4 commits November 2, 2016 18:45
allow specification of generator from commandline.
add -G option.  (more to come)
if options.generator is specified, use that instead of computing one. 
(for windows; which can use mingw64 or openwatcom)
further changes would be to pass toolset through.
Need to revisit ES5 to apply these better edits.
@d3x0r
Copy link
Contributor Author

d3x0r commented Nov 4, 2016

node.lib is c++ so the name mangling between gcc and msvc is incompatible... and all symbols from node.exe are failing :)
Except for a very specific case; this option is probably not very useful.

@@ -60,8 +60,14 @@ Toolset.prototype.initializePosix = function (install) {
this.cCompilerPath = "gcc";
}

if( this.options.generator ){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style is off,

if (install) {
this.log.info("TOOL", "Using " + this.options.generator + " generator, as specified from commandline.");
}
this.generator = this.options.generator;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you set this.generator again? It's already have options.generator's value at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not already set. The code immediately after this point sets the generator to a computed default.
(Oh it COULD be set, but it might not be....)

Because initially I left the generator initialization as = null; but I modified that to initialize to the options.generator thinking I could later check if generator is set, don't set it.

Then there's the logging that's done to report what generator was used....

// 2: Generator
if (environment.isOSX) {
else if (environment.isOSX) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't put generator override code at this point. Let toolset find its defaults and then, after initialize() around line 34, we should override the default value by logging out the exact information about which default generator got changed into which one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it was pretty silly to do any sort of work to determine a default if it was already specified externally.

@@ -60,11 +60,10 @@ Toolset.prototype.initializePosix = function (install) {
this.cCompilerPath = "gcc";
}

if( this.options.generator ){
if( this.generator ){ // if it's already set because of options...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but this is still not following CMake.js' code style.

You know this is all edited on github... could have just moved the comments for me :p
I didn't see a lot of examples; and even so the language isn't in the style either.
@@ -149,7 +149,8 @@ Toolset.prototype._setupGNUStd = function (install) {

Toolset.prototype.initializeWin = async(function*(install) {
// Visual Studio:
if( this.generator ){ // if it's already set because of options...
// if it's already set because of options...
if( this.generator ){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) I mean:

if (this.generator) {

instead of

if( this.generator ){

@unbornchikken unbornchikken merged commit 6389122 into cmake-js:master Nov 15, 2016
@unbornchikken
Copy link
Member

Thanks. Will test and release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants