Slic3r was split to a Slic3r.dll / Slic3r.exe / Slic3r-console.exe /
Slic3r-noconsole.exe on Windows.
This commit is contained in:
parent
f651182101
commit
21caa9de48
@ -57,12 +57,18 @@ add_subdirectory(slic3r)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/slic3r.rc.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/slic3r.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.manifest @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
|
||||
add_executable(slic3r slic3r.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
if(SLIC3R_GUI)
|
||||
if (MSVC)
|
||||
add_library(slic3r SHARED slic3r.cpp)
|
||||
else ()
|
||||
add_executable(slic3r slic3r.cpp)
|
||||
endif ()
|
||||
if (NOT MSVC)
|
||||
if(SLIC3R_GUI)
|
||||
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-gui")
|
||||
else()
|
||||
else()
|
||||
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-console")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
target_link_libraries(slic3r libslic3r)
|
||||
if (APPLE)
|
||||
@ -113,6 +119,27 @@ if (SLIC3R_GUI)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# On Windows, a shim application is required to produce a console / non console version of the Slic3r application.
|
||||
# Also the shim may load the Mesa software OpenGL renderer if the default renderer does not support OpenGL 2.0 and higher.
|
||||
if (MSVC)
|
||||
add_executable(slic3r_app_gui WIN32 slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_GUI)
|
||||
add_dependencies(slic3r_app_gui slic3r)
|
||||
target_link_libraries(slic3r_app_gui "-lShell32.lib")
|
||||
set_target_properties(slic3r_app_gui PROPERTIES OUTPUT_NAME "slic3r")
|
||||
|
||||
add_executable(slic3r_app_console slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE -DSLIC3R_WRAPPER_NOGUI)
|
||||
add_dependencies(slic3r_app_console slic3r)
|
||||
set_target_properties(slic3r_app_console PROPERTIES OUTPUT_NAME "slic3r-console")
|
||||
|
||||
add_executable(slic3r_app_noconsole WIN32 slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_noconsole PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_NOGUI)
|
||||
add_dependencies(slic3r_app_noconsole slic3r)
|
||||
target_link_libraries(slic3r_app_gui "-lShell32.lib")
|
||||
set_target_properties(slic3r_app_noconsole PROPERTIES OUTPUT_NAME "slic3r-noconsole")
|
||||
endif ()
|
||||
|
||||
# Link the resources dir to where Slic3r GUI expects it
|
||||
if (MSVC)
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef slic3r_WipeTower_hpp_
|
||||
#define slic3r_WipeTower_hpp_
|
||||
|
||||
#include <math.h>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -42,14 +42,12 @@ using namespace Slic3r;
|
||||
/// utility function for displaying CLI usage
|
||||
void printUsage();
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
int slic3r_main_(int argc, char **argv)
|
||||
#else
|
||||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
// Convert arguments to UTF-8 (needed on Windows). argv then points to memory owned by a.
|
||||
//FIXME On Windows, we want to receive the arguments as 16bit characters!
|
||||
boost::nowide::args a(argc, argv);
|
||||
|
||||
{
|
||||
const char *loglevel = boost::nowide::getenv("SLIC3R_LOGLEVEL");
|
||||
if (loglevel != nullptr) {
|
||||
@ -253,3 +251,20 @@ void printUsage()
|
||||
print_print_options(boost::nowide::cout);
|
||||
std::cout << "****\n";
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
extern "C" {
|
||||
__declspec(dllexport) int __stdcall slic3r_main(int argc, wchar_t **argv)
|
||||
{
|
||||
// Convert wchar_t arguments to UTF8.
|
||||
std::vector<std::string> argv_narrow;
|
||||
std::vector<char*> argv_ptrs(argc + 1, nullptr);
|
||||
for (size_t i = 0; i < argc; ++ i)
|
||||
argv_narrow.emplace_back(boost::nowide::narrow(argv[i]));
|
||||
for (size_t i = 0; i < argc; ++ i)
|
||||
argv_ptrs[i] = const_cast<char*>(argv_narrow[i].data());
|
||||
// Call the UTF8 main.
|
||||
return slic3r_main_(argc, argv_ptrs.data());
|
||||
}
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
Loading…
Reference in New Issue
Block a user