Skip to content

Commit

Permalink
Merge pull request #3804 from alexrj/lordofhyphens-split_gui
Browse files Browse the repository at this point in the history
force --gui for shell during compilation if -DFORCE_GUI is set for compile wrapper. Fixes #3803
  • Loading branch information
lordofhyphens authored Mar 28, 2017
2 parents 41407f3 + 00744c2 commit fe9d294
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package/win/compile_wrapper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ $perllib = "-lperl$perlver"

windres slic3r.rc -O coff -o slic3r.res
g++ -c -I'C:\strawberry\perl\lib\CORE\' shell.cpp -o slic3r.o
g++ -v -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r.exe | Write-Host
g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI shell.cpp -o slic3r-gui.o
g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r.o slic3r.res -o slic3r-console.exe | Write-Host
g++ -static-libgcc -static-libstdc++ -L'C:\strawberry\c\lib' -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.exe | Write-Host

1 change: 1 addition & 0 deletions package/win/package_win32.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ cpanm "PAR::Packer"

pp `
-a "slic3r.exe;slic3r.exe" `
-a "slic3r.exe;slic3r-console.exe" `
-a "../../lib;lib" `
-a "../../local-lib;local-lib" `
-a "../../slic3r.pl;slic3r.pl" `
Expand Down
14 changes: 14 additions & 0 deletions package/win/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ int main(int argc, char **argv, char **env)

char exe_path[MAX_PATH] = {0};
char script_path[MAX_PATH];
char gui_flag[6] = {"--gui"};
#ifdef FORCE_GUI
char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 2));
#else
char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 1));
#endif
{
// Unicode path. This will not be used directly, but to test, whether
// there are any non-ISO characters, in which case the path is converted to a
Expand Down Expand Up @@ -68,7 +73,12 @@ int main(int argc, char **argv, char **env)
command_line[0] = exe_path;
command_line[1] = script_path;
memcpy(command_line + 2, argv + 1, sizeof(char*) * (argc - 2));
#ifdef FORCE_GUI
command_line[argc] = gui_flag;
command_line[argc+1] = NULL;
#else
command_line[argc] = NULL;
#endif
// Unset the PERL5LIB and PERLLIB environment variables.
SetEnvironmentVariable("PERL5LIB", NULL);
SetEnvironmentVariable("PERLLIB", NULL);
Expand All @@ -78,7 +88,11 @@ int main(int argc, char **argv, char **env)
printf(" %d: %s\r\n", i, command_line[i]);
#endif
}
#ifdef FORCE_GUI
RunPerl(argc+1, command_line, NULL);
#else
RunPerl(argc, command_line, NULL);
#endif
free(command_line);
}

0 comments on commit fe9d294

Please sign in to comment.