Added various manifests,

added auto generation of includes and manifests from version and build
variables,
resurrected SLIC3R_LOGLEVEL env var.
This commit is contained in:
bubnikv 2018-09-24 11:53:05 +02:00
parent 9f2cd347e3
commit 96e035b2f8
11 changed files with 100 additions and 26 deletions

View File

@ -1,6 +1,9 @@
project(Slic3r)
cmake_minimum_required(VERSION 3.2)
include("version.inc")
set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
@ -108,12 +111,12 @@ if (0)
message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
endif()
# Find and configure boost

View File

@ -53,9 +53,11 @@ endif()
add_subdirectory(slic3r)
# Create a slic3r executable
#FIXME add Windows resource file
#add_executable(slic3r slic3r.cpp slic3r.rc)
add_executable(slic3r slic3r.cpp)
# Process mainfests for various platforms.
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)
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-gui")
else()
@ -67,7 +69,10 @@ if (APPLE)
# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
# -liconv: boost links to libiconv by default
target_link_libraries(slic3r "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
elseif (NOT MSVC)
elseif (MSVC)
# Manifest is provided through slic3r.rc, don't generate your own.
set(CMAKE_EXE_LINKER_FLAGS /MANIFEST:NO)
else ()
target_link_libraries(slic3r -ldl -lstdc++)
endif ()

View File

@ -1,6 +1,8 @@
project(libslic3r)
cmake_minimum_required(VERSION 2.6)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY)
add_library(libslic3r STATIC
BoundingBox.cpp
BoundingBox.hpp
@ -96,6 +98,7 @@ add_library(libslic3r STATIC
Layer.hpp
LayerRegion.cpp
libslic3r.h
"${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h"
Line.cpp
Line.hpp
Model.cpp
@ -149,7 +152,7 @@ add_library(libslic3r STATIC
)
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB ${PNG_DEFINITIONS})
target_include_directories(libslic3r PUBLIC BEFORE ${LIBNEST2D_INCLUDES} ${PNG_INCLUDE_DIRS})
target_include_directories(libslic3r PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${LIBNEST2D_INCLUDES} ${PNG_INCLUDE_DIRS})
target_link_libraries(libslic3r
${LIBNEST2D_LIBRARIES}
admesh

View File

@ -1,6 +1,8 @@
#ifndef _libslic3r_h_
#define _libslic3r_h_
#include "libslic3r_version.h"
// this needs to be included early for MSVC (listing it in Build.PL is not enough)
#include <ostream>
#include <iostream>
@ -15,10 +17,6 @@
#include "Technologies.hpp"
#define SLIC3R_FORK_NAME "Slic3r Prusa Edition"
#define SLIC3R_VERSION "1.41.0"
#define SLIC3R_BUILD "UNKNOWN"
typedef int32_t coord_t;
typedef double coordf_t;

View File

@ -0,0 +1,8 @@
#ifndef __SLIC3R_VERSION_H
#define __SLIC3R_VERSION_H
#define SLIC3R_FORK_NAME "@SLIC3R_FORK_NAME@"
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
#define SLIC3R_BUILD "@SLIC3R_BUILD@"
#endif /* __SLIC3R_VERSION_H */

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
<assemblyIdentity version="SLIC3R_RC_VERSION_DOTS" name="Slic3r" type="Win32" />
<assemblyIdentity version="@SLIC3R_RC_VERSION_DOTS@" name="Slic3r" type="Win32" />
<description>Perl</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>

View File

@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION SLIC3R_RC_VERSION
PRODUCTVERSION SLIC3R_RC_VERSION
FILEVERSION @SLIC3R_RC_VERSION@
PRODUCTVERSION @SLIC3R_RC_VERSION@
{
BLOCK "StringFileInfo"
{
@ -8,9 +8,9 @@ PRODUCTVERSION SLIC3R_RC_VERSION
{
VALUE "CompanyName", "Prusa Research"
VALUE "FileDescription", "Slic3r Prusa Edition"
VALUE "FileVersion", "SLIC3R_BUILD_ID"
VALUE "FileVersion", "@SLIC3R_BUILD_ID@"
VALUE "ProductName", "Slic3r Prusa Edition"
VALUE "ProductVersion", "SLIC3R_BUILD_ID"
VALUE "ProductVersion", "@SLIC3R_BUILD_ID@"
VALUE "InternalName", "Slic3r Prusa Edition"
VALUE "LegalCopyright", "Copyright \251 2011-2017 Alessandro Ranelucci, \251 2016 Prusa Research"
VALUE "OriginalFilename", "slic3r.exe"
@ -21,5 +21,5 @@ PRODUCTVERSION SLIC3R_RC_VERSION
VALUE "Translation", 0x409, 1252
}
}
2 ICON "../resources/icons/Slic3r.ico"
2 ICON "@SLIC3R_RESOURCES_DIR@/icons/Slic3r.ico"
1 24 "slic3r.manifest"

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Slic3r</string>
<key>CFBundleGetInfoString</key>
<string>Slic3r Copyright (C) 2011-2017 Alessandro Ranellucci, (C) 2016-2018 Prusa Reseach</string>
<key>CFBundleIconFile</key>
<string>Slic3r.icns</string>
<key>CFBundleName</key>
<string>Slic3r</string>
<key>CFBundleShortVersionString</key>
<string>Slic3r @SLIC3R_BUILD_ID@</string>
<key>CFBundleIdentifier</key>
<string>com.prusa3d.slic3r/</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@SLIC3R_BUILD_ID@</string>
<key>CGDisableCoalescedUpdates</key>
<false/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

View File

@ -27,6 +27,7 @@
#include <math.h>
#include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp>
#include <boost/nowide/cenv.hpp>
#include <boost/nowide/iostream.hpp>
#ifdef USE_WX
@ -48,6 +49,16 @@ int main(int argc, char **argv)
//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) {
if (loglevel[0] >= '0' && loglevel[0] <= '9' && loglevel[1] == 0)
set_logging_level(loglevel[0] - '0');
else
boost::nowide::cerr << "Invalid SLIC3R_LOGLEVEL environment variable: " << loglevel << std::endl;
}
}
// parse all command line options into a DynamicConfig
DynamicPrintAndCLIConfig config;
t_config_option_keys input_files;
@ -89,7 +100,7 @@ int main(int argc, char **argv)
// apply command line options to a more handy CLIConfig
CLIConfig cli_config;
cli_config.apply(config, true);
set_local_dir(cli_config.datadir.value);
set_data_dir(cli_config.datadir.value);
DynamicPrintConfig print_config;

View File

@ -116,10 +116,15 @@ void MainFrame::init_tabpanel()
auto panel = m_tabpanel->GetCurrentPage();
// panel->OnActivate(); if panel->can('OnActivate');
std::vector<std::string> tab_names = { "print", "filament", "printer" };
for (auto& tab_name : tab_names) {
if (tab_name == panel->GetName())
m_options_tabs.at(tab_name)->OnActivate();
for (auto& tab_name : { "print", "filament", "printer" }) {
if (tab_name == panel->GetName()) {
// On GTK, the wxEVT_NOTEBOOK_PAGE_CHANGED event is triggered
// before the MainFrame is fully set up.
auto it = m_options_tabs.find(tab_name);
assert(it != m_options_tabs.end());
if (it != m_options_tabs.end())
it->second->OnActivate();
}
}
});

9
version.inc Normal file
View File

@ -0,0 +1,9 @@
# Included by CMakeLists, edited by the build script
# (the version numbers are generated by the build script from the git current label)
set(SLIC3R_FORK_NAME "Slic3r Prusa Edition")
set(SLIC3R_VERSION "1.42.0-alpha")
set(SLIC3R_BUILD "UNKNOWN")
set(SLIC3R_RC_VERSION "1,42,0,0")
set(SLIC3R_RC_VERSION_DOTS "1.42.0.0")
set(SLIC3R_BUILD_ID "${SLIC3R_VERSION}+${SLIC3R_BUILD}")