Comparar commits
3 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| f660f3cd2d | |||
| 54fd9c1f5b | |||
| 72ce68ac33 |
@@ -42,6 +42,20 @@ if(NOT APPLE AND NOT WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(/DNOMINMAX)
|
||||
if (MSVC)
|
||||
# Switch the runtime to use static linking on MSVC
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} libs)
|
||||
|
||||
add_library(clipper STATIC libs/clipper/clipper.cpp)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License */
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "MeshGroup.h"
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include <cmath> // sqrt
|
||||
#include <fstream> // debug IO
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "progress/Progress.h"
|
||||
#include "weaveDataStorage.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <string> // stoi
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <execinfo.h>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace cura {
|
||||
*/
|
||||
void PathOrderOptimizer::optimize()
|
||||
{
|
||||
bool picked[polygons.size()];
|
||||
bool *picked = static_cast<bool*>(alloca(sizeof(bool) * polygons.size()));
|
||||
memset(picked, false, sizeof(bool) * polygons.size());/// initialized as falses
|
||||
|
||||
for (PolygonRef poly : polygons) /// find closest point to initial starting point within each polygon +initialize picked
|
||||
@@ -154,7 +154,7 @@ void LineOrderOptimizer::optimize()
|
||||
{
|
||||
int gridSize = 5000; // the size of the cells in the hash grid. TODO
|
||||
SparsePointGridInclusive<unsigned int> line_bucket_grid(gridSize);
|
||||
bool picked[polygons.size()];
|
||||
bool *picked = static_cast<bool*>(alloca(sizeof(bool) * polygons.size()));
|
||||
memset(picked, false, sizeof(bool) * polygons.size());/// initialized as falses
|
||||
|
||||
for (unsigned int poly_idx = 0; poly_idx < polygons.size(); poly_idx++) /// find closest point to initial starting point within each polygon +initialize picked
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream> // debug IO
|
||||
#ifndef WIN32
|
||||
#include <libgen.h> // dirname
|
||||
#else
|
||||
extern char *dirname(char *path);
|
||||
#endif
|
||||
#include <string>
|
||||
#include <cstring> // strtok (split string using delimiters) strcpy
|
||||
#include <fstream> // ifstream (to see if file exists)
|
||||
@@ -151,7 +155,7 @@ int SettingRegistry::loadJSONsettings(std::string filename, SettingsBase* settin
|
||||
if (err) { return err; }
|
||||
|
||||
{ // add parent folder to search paths
|
||||
char filename_cstr[filename.size()];
|
||||
char *filename_cstr = static_cast<char*>(alloca(filename.size()));
|
||||
std::strcpy(filename_cstr, filename.c_str()); // copy the string because dirname(.) changes the input string!!!
|
||||
std::string folder_name = std::string(dirname(filename_cstr));
|
||||
search_paths.emplace(folder_name);
|
||||
@@ -381,3 +385,15 @@ void SettingRegistry::_loadSettingValues(SettingConfig* config, const rapidjson:
|
||||
}
|
||||
|
||||
}//namespace cura
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
|
||||
char *dirname(char *path)
|
||||
{
|
||||
static char folder_name[MAX_PATH + 1], *p;
|
||||
GetFullPathNameA(path, _countof(folder_name), folder_name, &p);
|
||||
p[-1] = 0;
|
||||
return folder_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
#include <stdio.h> // for file output
|
||||
#include <sstream>
|
||||
#include <iostream> // debug IO
|
||||
#ifndef WIN32
|
||||
#include <libgen.h> // dirname
|
||||
#else
|
||||
extern char *dirname(char *path);
|
||||
#endif
|
||||
#include <string>
|
||||
#include <algorithm> // find_if
|
||||
#include <regex> // regex_search
|
||||
|
||||
@@ -180,7 +180,7 @@ bool SettingsBaseVirtual::getSettingBoolean(std::string key) const
|
||||
return true;
|
||||
if (value == "yes")
|
||||
return true;
|
||||
if (value == "true" or value == "True") //Python uses "True"
|
||||
if (value == "true" || value == "True") //Python uses "True"
|
||||
return true;
|
||||
int num = atoi(value.c_str());
|
||||
return num != 0;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
#ifndef GETTIME_H
|
||||
#define GETTIME_H
|
||||
|
||||
#ifdef __WIN32
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#ifdef USE_CPU_TIME
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stddef.h>
|
||||
#include <cassert>
|
||||
#endif
|
||||
@@ -18,9 +18,9 @@ namespace cura
|
||||
{
|
||||
static inline double getTime()
|
||||
{
|
||||
#ifdef __WIN32
|
||||
#ifdef WIN32
|
||||
return double(GetTickCount()) / 1000.0;
|
||||
#else // not __WIN32
|
||||
#else // not WIN32
|
||||
#if USE_CPU_TIME // Use cpu usage time if available, otherwise wall clock time
|
||||
struct rusage usage;
|
||||
#ifdef DEBUG
|
||||
@@ -38,7 +38,7 @@ static inline double getTime()
|
||||
gettimeofday(&tv, nullptr);
|
||||
return double(tv.tv_sec) + double(tv.tv_usec) / 1000000.0;
|
||||
#endif // USE_CPU_TIME
|
||||
#endif // __WIN32
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
class TimeKeeper
|
||||
|
||||
@@ -119,9 +119,9 @@ unsigned int Polygons::findInside(Point p, bool border_result)
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t min_x[size()];
|
||||
int64_t *min_x = static_cast<int64_t*>(alloca(sizeof(int64_t) * size()));
|
||||
std::fill_n(min_x, size(), std::numeric_limits<int64_t>::max()); // initialize with int.max
|
||||
int crossings[size()];
|
||||
int *crossings = static_cast<int*>(alloca(sizeof(int) * size()));
|
||||
std::fill_n(crossings, size(), 0); // initialize with zeros
|
||||
|
||||
for (unsigned int poly_idx = 0; poly_idx < size(); poly_idx++)
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário