mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-29 01:51:59 +08:00
Moved shell.cpp to ../common, borrowed and modified for FORCE_GUI from @bubnikv
Changed path in compile_wrapper, made makefile for linux with default paths pointed at where they would be on Travis.
This commit is contained in:
parent
c77c524c07
commit
23f3df4b1f
@ -1,16 +1,19 @@
|
||||
#include <EXTERN.h> // from the Perl distribution
|
||||
#include <perl.h> // from the Perl distribution
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
// 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 <wchar.h>
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifdef WIN32
|
||||
int main(int argc, char **argv, char **env)
|
||||
{
|
||||
|
||||
@ -95,4 +98,25 @@ int main(int argc, char **argv, char **env)
|
||||
#endif
|
||||
free(command_line);
|
||||
}
|
||||
#else
|
||||
|
||||
int main(int argc, char **argv, char **env)
|
||||
{
|
||||
PerlInterpreter *my_perl = perl_alloc();
|
||||
if (my_perl == NULL) {
|
||||
fprintf(stderr, "Cannot start perl interpreter. Exiting.\n");
|
||||
return -1;
|
||||
}
|
||||
perl_construct(my_perl);
|
||||
|
||||
#ifdef FORCE_GUI
|
||||
char* command_line[] = { "slic3r", "slic3r.pl", "--gui" };
|
||||
#else
|
||||
char* command_line[] = { "slic3r", "slic3r.pl" };
|
||||
#endif
|
||||
perl_parse(my_perl, NULL, 3, command_line, (char **)NULL);
|
||||
perl_run(my_perl);
|
||||
perl_destruct(my_perl);
|
||||
perl_free(my_perl);
|
||||
}
|
||||
#endif
|
31
package/linux/build_shell.mk
Normal file
31
package/linux/build_shell.mk
Normal file
@ -0,0 +1,31 @@
|
||||
src=../common/shell.cpp
|
||||
|
||||
# override with environment variable
|
||||
CXX ?= g++
|
||||
|
||||
# Path to perl header files
|
||||
INCLUDEDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE
|
||||
|
||||
# path to library files for perl
|
||||
LIBDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE
|
||||
|
||||
LIBS += -lperl -lpthread -lcrypt
|
||||
|
||||
CXXFLAGS += -std=c++11 -static-libgcc -static-libstdc++ -I${INCLUDEDIR}
|
||||
LDFLAGS += -L${LIBDIR}
|
||||
|
||||
.PHONY: all clean
|
||||
all: Slic3r Slic3r-console
|
||||
|
||||
Slic3r: slic3r.o
|
||||
${CXX} ${LDFLAGS} -o $@ $< ${LIBS}
|
||||
|
||||
Slic3r-console: slic3r-console.o
|
||||
${CXX} ${LDFLAGS} -o $@ $< ${LIBS}
|
||||
slic3r-console.o: ${src}
|
||||
${CXX} -c ${CXXFLAGS} -o $@ $<
|
||||
slic3r.o: ${src}
|
||||
${CXX} -c -DFORCE_GUI ${CXXFLAGS} -o $@ $<
|
||||
|
||||
clean:
|
||||
rm *.o Slic3r*
|
@ -8,10 +8,11 @@ if ($args[0])
|
||||
}
|
||||
|
||||
$perllib = "-lperl$perlver"
|
||||
$shell_loc = "..\common\shell.cpp"
|
||||
|
||||
windres slic3r.rc -O coff -o slic3r.res
|
||||
g++ -c -I'C:\strawberry\perl\lib\CORE\' shell.cpp -o slic3r.o
|
||||
g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI shell.cpp -o slic3r-gui.o
|
||||
g++ -c -I'C:\strawberry\perl\lib\CORE\' $shell_loc -o slic3r.o
|
||||
g++ -c -I'C:\strawberry\perl\lib\CORE\' -DFORCE_GUI $shell_loc -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' -mwindows -L'C:\strawberry\perl\bin' -L'C:\strawberry\perl\lib\CORE\' $perllib slic3r-gui.o slic3r.res -o slic3r.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-debug-console.exe | Write-Host
|
||||
|
Loading…
x
Reference in New Issue
Block a user