compile_wrapper.ps1 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Short Powershell script to build a wrapper exec
  2. Param
  3. (
  4. [string]$perlVersion = "524",
  5. [string]$STRAWBERRY_PATH = "C:\Strawberry",
  6. # Path to C++ compiler, or just name if it is in path
  7. [string]$cxx = "g++"
  8. )
  9. function Get-ScriptDirectory
  10. {
  11. $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  12. Split-Path $Invocation.MyCommand.Path
  13. }
  14. $scriptDir = Get-ScriptDirectory
  15. $perllib = "-lperl$perlVersion"
  16. $shell_loc = "${scriptDir}\..\common\shell.cpp"
  17. # Build the resource file (used to load icon, etc)
  18. windres ${scriptDir}\slic3r.rc -O coff -o ${scriptDir}\slic3r.res
  19. # Compile an object file that does not have gui forced.
  20. Invoke-Expression "$cxx -c -I'${STRAWBERRY_PATH}\perl\lib\CORE\' $shell_loc -o ${scriptDir}/slic3r.o"
  21. # Compile an object file with --gui automatically passed as an argument
  22. Invoke-Expression "$cxx -c -I'${STRAWBERRY_PATH}\perl\lib\CORE\' -DFORCE_GUI $shell_loc -o ${scriptDir}/slic3r-gui.o"
  23. # Build the EXE for the unforced version as slic3r-console
  24. Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r-console.exe | Write-Host"
  25. # Build the EXE for the forced GUI
  26. Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -mwindows -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r-gui.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r.exe | Write-Host"
  27. # Build an extra copy of the GUI version that creates a console window
  28. Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r-gui.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r-debug-console.exe | Write-Host"