diff --git a/package/win/compile_wrapper.ps1 b/package/win/compile_wrapper.ps1 index fc6f15b97b..5704788ff3 100644 --- a/package/win/compile_wrapper.ps1 +++ b/package/win/compile_wrapper.ps1 @@ -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 diff --git a/package/win/package_win32.ps1 b/package/win/package_win32.ps1 index 9c9bc3ed0e..1bc17e0f4c 100644 --- a/package/win/package_win32.ps1 +++ b/package/win/package_win32.ps1 @@ -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" ` diff --git a/package/win/shell.cpp b/package/win/shell.cpp index b0904e9e61..e4fe45d209 100644 --- a/package/win/shell.cpp +++ b/package/win/shell.cpp @@ -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); }