mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-13 05:31:50 +08:00
Added windows shell and script (#3723)
* Slightly modified perl wrapper from @bubnikv and added a short powershell script to build it (assuming Strawberry Perl is installed) * added shell and tweaked build script to package 5.18 or 5.24 * moved class::accessor to local-lib * Using different thread library for packager (x64), wrapper is verbose. * Statically link libgcc for shell program, include pthreadGC2-w64.dll * set default perl version, added more linker options Added libgcc_s_sjlj-1.dll to pack list. * Removed Sub::Util from manual dependency list. * Added resource file for wrapper exe and appended compile steps.. * added Win32 perl module * Add libglut-0.dll
This commit is contained in:
parent
dd22a28160
commit
4fe58d768a
15
package/win/compile_wrapper.ps1
Normal file
15
package/win/compile_wrapper.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
# Short Powershell script to build a wrapper exec
|
||||
if ($args[0])
|
||||
{
|
||||
$perlver = $args[0]
|
||||
} else
|
||||
{
|
||||
$perlver = 518
|
||||
}
|
||||
|
||||
$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
|
||||
|
@ -12,6 +12,14 @@ New-Variable -Name "current_branch" -Value ""
|
||||
New-Variable -Name "current_date" -Value "$(Get-Date -UFormat '%Y.%m.%d')"
|
||||
New-Variable -Name "output_file" -Value ""
|
||||
|
||||
if ($args[0]) {
|
||||
$perlversion = $args[0]
|
||||
} else {
|
||||
$perlversion = "524"
|
||||
}
|
||||
|
||||
$perldll = "perl$perlversion"
|
||||
|
||||
git branch | foreach {
|
||||
if ($env:APPVEYOR) {
|
||||
if ($_ -match "` (.*)") {
|
||||
@ -35,25 +43,22 @@ New-Variable -Name "STRAWBERRY_PATH" -Value "C:\Strawberry"
|
||||
cpanm "PAR::Packer"
|
||||
|
||||
pp `
|
||||
-a "../../utils;utils" `
|
||||
-a "autorun.bat;slic3r.bat" `
|
||||
-a "../../var;var" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\perl5.24.0.exe;perl5.24.0.exe" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\perl524.dll;perl524.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\libgcc_s_sjlj-1.dll;libgcc_s_sjlj-1.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\libstdc++-6.dll;libstdc++-6.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\libwinpthread-1.dll;libwinpthread-1.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\freeglut.dll;freeglut.dll" `
|
||||
-a "${STRAWBERRY_PATH}\c\bin\libglut-0_.dll;libglut-0_.dll" `
|
||||
-a "slic3r.exe;slic3r.exe" `
|
||||
-a "../../lib;lib" `
|
||||
-a "../../local-lib;local-lib" `
|
||||
-a "../../slic3r.pl;slic3r.pl" `
|
||||
-a "../../utils;utils" `
|
||||
-a "../../var;var" `
|
||||
-a "../../FreeGLUT/freeglut.dll;freeglut.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\perl${perlversion}.dll;perl${perlversion}.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\libstdc++-6.dll;libstdc++-6.dll" `
|
||||
-a "${STRAWBERRY_PATH}\perl\bin\libgcc_s_sjlj-1.dll;libgcc_s_sjlj-1.dll" `
|
||||
-a "${STRAWBERRY_PATH}\c\bin\pthreadGC2-w64.dll;pthreadGC2-w64.dll" `
|
||||
-a "${STRAWBERRY_PATH}\c\bin\libglut-0__.dll;libglut-0__.dll" `
|
||||
-M AutoLoader `
|
||||
-M B `
|
||||
-M Carp `
|
||||
-M Class::Accessor `
|
||||
-M Class::XSAccessor `
|
||||
-M Class::XSAccessor::Heavy `
|
||||
-M Config `
|
||||
-M Crypt::CBC `
|
||||
-M Cwd `
|
||||
@ -109,7 +114,6 @@ pp `
|
||||
-M Sub::Exporter `
|
||||
-M Sub::Exporter::Progressive `
|
||||
-M Sub::Name `
|
||||
-M Sub::Util `
|
||||
-M Symbol `
|
||||
-M Term::Cap `
|
||||
-M Text::ParseWords `
|
||||
@ -124,6 +128,7 @@ pp `
|
||||
-M URI::Escape `
|
||||
-M URI::http `
|
||||
-M Unicode::Normalize `
|
||||
-M Win32 `
|
||||
-M Win32::API `
|
||||
-M Win32::TieRegistry `
|
||||
-M Win32::WinError `
|
||||
|
84
package/win/shell.cpp
Normal file
84
package/win/shell.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#include <EXTERN.h> // from the Perl distribution
|
||||
#include <perl.h> // from the Perl distribution
|
||||
|
||||
// Perl win32 specific includes, found in perl\\lib\\CORE\\win32.h
|
||||
// Defines the windows specific convenience RunPerl() function,
|
||||
// which is not available on other operating systems.
|
||||
#include <win32.h>
|
||||
// the standard Windows. include
|
||||
//#include <Windows.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char **argv, char **env)
|
||||
{
|
||||
|
||||
// replaces following Windows batch file: @"%~dp0\perl5.24.0.exe"
|
||||
// "%~dp0\slic3r.pl" --DataDir "C:\Users\Public\Documents\Prusa3D\Slic3r
|
||||
// settings MK2"%*
|
||||
|
||||
// If the Slic3r is installed in a localized directory (containing non-iso
|
||||
// characters), spaces or semicolons, use short file names.
|
||||
|
||||
char exe_path[MAX_PATH] = {0};
|
||||
char script_path[MAX_PATH];
|
||||
char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 1));
|
||||
{
|
||||
// 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
|
||||
// short path (using 8.3 directory names).
|
||||
|
||||
wchar_t exe_path_w[MAX_PATH] = {0};
|
||||
char drive[_MAX_DRIVE];
|
||||
char dir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME];
|
||||
char ext[_MAX_EXT];
|
||||
bool needs_short_paths = false;
|
||||
int len;
|
||||
int i;
|
||||
GetModuleFileNameA(NULL, exe_path, MAX_PATH-1);
|
||||
GetModuleFileNameW(NULL, exe_path_w, MAX_PATH-1);
|
||||
len = strlen(exe_path);
|
||||
|
||||
if (len != wcslen(exe_path_w)) {
|
||||
needs_short_paths = true;
|
||||
} else {
|
||||
for (i = 0; i < len; ++ i)
|
||||
if ((wchar_t)exe_path[i] != exe_path_w[i] || exe_path[i] == ' ' ||
|
||||
exe_path[i] == ';') {
|
||||
needs_short_paths = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (needs_short_paths) {
|
||||
wchar_t exe_path_short[MAX_PATH] = {0};
|
||||
GetShortPathNameW(exe_path_w, exe_path_short, MAX_PATH);
|
||||
len = wcslen(exe_path_short);
|
||||
for (i = 0; i <= len; ++ i)
|
||||
exe_path[i] = (char)exe_path_short[i];
|
||||
}
|
||||
_splitpath(exe_path, drive, dir, fname, ext);
|
||||
_makepath(script_path, drive, dir, NULL, NULL);
|
||||
if (needs_short_paths)
|
||||
printf("Slic3r installed in a loclized path. Using an 8.3 path: \"%s\"\n",
|
||||
script_path);
|
||||
SetDllDirectoryA(script_path);
|
||||
_makepath(script_path, drive, dir, "slic3r", "pl");
|
||||
command_line[0] = exe_path;
|
||||
command_line[1] = script_path;
|
||||
memcpy(command_line + 2, argv + 1, sizeof(char*) * (argc - 2));
|
||||
command_line[argc] = NULL;
|
||||
// Unset the PERL5LIB and PERLLIB environment variables.
|
||||
SetEnvironmentVariable("PERL5LIB", NULL);
|
||||
SetEnvironmentVariable("PERLLIB", NULL);
|
||||
#if 0
|
||||
printf("Arguments: \r\n");
|
||||
for (size_t i = 0; i < argc + 1; ++ i)
|
||||
printf(" %d: %s\r\n", i, command_line[i]);
|
||||
#endif
|
||||
}
|
||||
RunPerl(argc, command_line, NULL);
|
||||
free(command_line);
|
||||
}
|
||||
|
25
package/win/slic3r.rc
Normal file
25
package/win/slic3r.rc
Normal file
@ -0,0 +1,25 @@
|
||||
id ICON "../../var/Slic3r.ico"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,3,0,0
|
||||
PRODUCTVERSION 1,3,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Slic3r.org"
|
||||
VALUE "FileDescription", "3D Printer Slicer application"
|
||||
VALUE "FileVersion", "1.3.0"
|
||||
VALUE "InternalName", "slic3r"
|
||||
VALUE "LegalCopyright", "Alessandro Ranellucci"
|
||||
VALUE "OriginalFilename", "slic3r.exe"
|
||||
VALUE "ProductName", "Slic3r"
|
||||
VALUE "ProductVersion", "1.3.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
Loading…
x
Reference in New Issue
Block a user