Merge pull request #3804 from alexrj/lordofhyphens-split_gui

force --gui for shell during compilation if -DFORCE_GUI is set for compile wrapper. Fixes #3803
This commit is contained in:
Joseph Lenox 2017-03-27 23:15:54 -05:00 committed by GitHub
commit fe9d294687
3 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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" `

View File

@ -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
@ -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);
@ -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);
}