Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2021-01-03 23:18:02 +0300
committerFormerLurker <hochgebe@gmail.com>2021-01-03 23:18:02 +0300
commitd4852e3e537ab891309f4a6c6d25cae4954c9225 (patch)
tree1969a95f3bcc01d06f19f63370fc33c15587c8cc
parentb0ffde1402a0fe3b1fd448bd00f0a18a0050d678 (diff)
Add static linking for windows exe. Remove mingw build. Add copyright notices for fpconv to exe output.
-rw-r--r--.github/workflows/ccpp.yml14
-rw-r--r--ArcWelder/CMakeLists.txt8
-rw-r--r--ArcWelder/segmented_shape.cpp6
-rw-r--r--ArcWelderConsole/ArcWelderConsole.cpp2
-rw-r--r--ArcWelderConsole/CMakeLists.txt9
-rw-r--r--ArcWelderInverseProcessor/CMakeLists.txt9
-rw-r--r--ArcWelderTest/ArcWelderTest.h1
-rw-r--r--CMakeLists.txt8
-rw-r--r--GcodeProcessorLib/CMakeLists.txt7
-rw-r--r--GcodeProcessorLib/fpconv.cpp42
-rw-r--r--GcodeProcessorLib/fpconv.h7
-rw-r--r--PyArcWelder/CMakeLists.txt8
-rw-r--r--PyArcWelder/sourcelist.cmake2
-rw-r--r--TCLAP/CMakeLists.txt2
14 files changed, 80 insertions, 45 deletions
diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
index 08d6e47..41a44f5 100644
--- a/.github/workflows/ccpp.yml
+++ b/.github/workflows/ccpp.yml
@@ -24,13 +24,13 @@ jobs:
cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
- - {
- name: "Windows Latest MinGW",
- artifact_tar: "Windows-MinGW.tar.xz",
- artifact_zip: "Windows-MinGW.zip",
- os: windows-latest,
- cc: "gcc", cxx: "g++"
- }
+ #- {
+ # name: "Windows Latest MinGW",
+ # artifact_tar: "Windows-MinGW.tar.xz",
+ # artifact_zip: "Windows-MinGW.zip",
+ # os: windows-latest,
+ # cc: "gcc", cxx: "g++"
+ # }
- {
name: "Ubuntu Latest GCC",
artifact_tar: "Linux.tar.xz",
diff --git a/ArcWelder/CMakeLists.txt b/ArcWelder/CMakeLists.txt
index a03c9fc..5a1569b 100644
--- a/ArcWelder/CMakeLists.txt
+++ b/ArcWelder/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(ArcWelder C CXX)
@@ -17,6 +17,12 @@ include(sourcelist.cmake)
# Add a library using our ArcWelderSources variable from our sourcelist file
add_library(${PROJECT_NAME} STATIC ${ArcWelderSources})
+
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
install(
TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
diff --git a/ArcWelder/segmented_shape.cpp b/ArcWelder/segmented_shape.cpp
index 83142e2..6fc83df 100644
--- a/ArcWelder/segmented_shape.cpp
+++ b/ArcWelder/segmented_shape.cpp
@@ -684,12 +684,12 @@ bool arc::ray_intersects_segment(const point rayOrigin, const point rayDirection
vector v2 = point2 - point1;
vector v3 = vector(-rayDirection.y, rayDirection.x, 0);
- float dot = dot(v2, v3);
+ double dot = dot(v2, v3);
if (std::fabs(dot) < 0.000001)
return false;
- float t1 = vector::cross_product_magnitude(v2, v1) / dot;
- float t2 = dot(v1,v3) / dot;
+ double t1 = vector::cross_product_magnitude(v2, v1) / dot;
+ double t2 = dot(v1,v3) / dot;
if (t1 >= 0.0 && (t2 >= 0.0 && t2 <= 1.0))
return true;
diff --git a/ArcWelderConsole/ArcWelderConsole.cpp b/ArcWelderConsole/ArcWelderConsole.cpp
index b301237..3b3c03b 100644
--- a/ArcWelderConsole/ArcWelderConsole.cpp
+++ b/ArcWelderConsole/ArcWelderConsole.cpp
@@ -61,6 +61,8 @@ int main(int argc, char* argv[])
info.append(", Branch: ").append(GIT_BRANCH);
info.append(", BuildDate: ").append(BUILD_DATE);
info.append("\n").append("Copyright(C) ").append(COPYRIGHT_DATE).append(" - ").append(AUTHOR);
+ info.append("\n").append("An algorithm for producing fast floating point strings, fpconv, was added with the following notice: Copyright (C) 2014 Milo Yip");
+ info.append("\n").append("The original fpconv algorithm provides the following notice: Copyright(c) 2013 Andreas Samoljuk");
std::stringstream arg_description_stream;
diff --git a/ArcWelderConsole/CMakeLists.txt b/ArcWelderConsole/CMakeLists.txt
index 6ce4b2c..0859c5b 100644
--- a/ArcWelderConsole/CMakeLists.txt
+++ b/ArcWelderConsole/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(ArcWelderConsole C CXX)
@@ -13,6 +13,10 @@ include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS}
# ArcWelderConsoleSources variable
include(sourcelist.cmake)
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
# Add an executable our ArcWelderConsoleSources variable from our sourcelist file
add_executable(${PROJECT_NAME} ${ArcWelderConsoleSources})
@@ -25,9 +29,10 @@ install(
DESTINATION bin
)
-
# specify linking to the GcodeProcessorLib and ArcWelder libraries
target_link_libraries(${PROJECT_NAME} GcodeProcessorLib ArcWelder TCLAP)
+
+
diff --git a/ArcWelderInverseProcessor/CMakeLists.txt b/ArcWelderInverseProcessor/CMakeLists.txt
index d12b33f..5636096 100644
--- a/ArcWelderInverseProcessor/CMakeLists.txt
+++ b/ArcWelderInverseProcessor/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(ArcWelderInverseProcessor C CXX)
@@ -13,6 +13,12 @@ include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS}
# ArcWelderConsoleSources variable
include(sourcelist.cmake)
+
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
# Add an executable our ArcWelderConsoleSources variable from our sourcelist file
add_executable(
${PROJECT_NAME}
@@ -28,3 +34,4 @@ install(
# specify linking to the GcodeProcessorLib and ArcWelder libraries
target_link_libraries(${PROJECT_NAME} TCLAP GcodeProcessorLib ArcWelder)
+
diff --git a/ArcWelderTest/ArcWelderTest.h b/ArcWelderTest/ArcWelderTest.h
index ea3e48e..47f704f 100644
--- a/ArcWelderTest/ArcWelderTest.h
+++ b/ArcWelderTest/ArcWelderTest.h
@@ -97,6 +97,7 @@ static std::string ISSUE_99 = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutte
static std::string CONE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\ConeTest.gcode";
static std::string CONE_TEST_VASE = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\ConeTestVase.gcode";
static std::string BAD_ARC_DIRECTIONS = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\BadArcDirections.gcode";
+static std::string UNICODE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\BenchyMinRadiusTest_with_unicode.gcode";
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3140c3a..bc84053 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
set(CMAKE_VERBOSE_MAKEFILE ON)
# You can tweak some common (for all subprojects) stuff here. For example:
@@ -19,6 +19,12 @@ IF(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
# add a definition so our libraries know that the version info is available
add_definitions("-DHAS_GENERATED_VERSION")
# include the generated header.
diff --git a/GcodeProcessorLib/CMakeLists.txt b/GcodeProcessorLib/CMakeLists.txt
index 41b729e..8e1ed3e 100644
--- a/GcodeProcessorLib/CMakeLists.txt
+++ b/GcodeProcessorLib/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(GcodeProcessorLib C CXX)
@@ -61,6 +61,11 @@ option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON)
# GcodeProcessorLibSources variable
include(sourcelist.cmake)
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
# Add a library using our GcodeProcessorLibSources variable from our sourcelist file
add_library(${PROJECT_NAME} STATIC ${GcodeProcessorLibSources})
diff --git a/GcodeProcessorLib/fpconv.cpp b/GcodeProcessorLib/fpconv.cpp
index 5d34203..e22731a 100644
--- a/GcodeProcessorLib/fpconv.cpp
+++ b/GcodeProcessorLib/fpconv.cpp
@@ -51,9 +51,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <stdbool.h>
#include <string.h>
-
#include "fpconv.h"
#define fracmask 0x000FFFFFFFFFFFFFU
@@ -65,7 +63,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define absv(n) ((n) < 0 ? -(n) : (n))
#define minv(a, b) ((a) < (b) ? (a) : (b))
-static uint64_t tens[] = {
+static unsigned long long tens[] = {
10000000000000000000U, 1000000000000000000U, 100000000000000000U,
10000000000000000U, 1000000000000000U, 100000000000000U,
10000000000000U, 1000000000000U, 100000000000U,
@@ -75,11 +73,11 @@ static uint64_t tens[] = {
10U, 1U
};
-static /*inline */uint64_t get_dbits(double d)
+static /*inline */unsigned long long get_dbits(double d)
{
union {
double dbl;
- uint64_t i;
+ unsigned long long i;
} dbl_bits = { d };
return dbl_bits.i;
@@ -87,7 +85,7 @@ static /*inline */uint64_t get_dbits(double d)
static Fp build_fp(double d)
{
- uint64_t bits = get_dbits(d);
+ unsigned long long bits = get_dbits(d);
Fp fp;
fp.frac = bits & fracmask;
@@ -145,14 +143,14 @@ static void get_normalized_boundaries(Fp* fp, Fp* lower, Fp* upper)
static Fp multiply(Fp* a, Fp* b)
{
- const uint64_t lomask = 0x00000000FFFFFFFF;
+ const unsigned long long lomask = 0x00000000FFFFFFFF;
- uint64_t ah_bl = (a->frac >> 32) * (b->frac & lomask);
- uint64_t al_bh = (a->frac & lomask) * (b->frac >> 32);
- uint64_t al_bl = (a->frac & lomask) * (b->frac & lomask);
- uint64_t ah_bh = (a->frac >> 32) * (b->frac >> 32);
+ unsigned long long ah_bl = (a->frac >> 32) * (b->frac & lomask);
+ unsigned long long al_bh = (a->frac & lomask) * (b->frac >> 32);
+ unsigned long long al_bl = (a->frac & lomask) * (b->frac & lomask);
+ unsigned long long ah_bh = (a->frac >> 32) * (b->frac >> 32);
- uint64_t tmp = (ah_bl & lomask) + (al_bh & lomask) + (al_bl >> 32);
+ unsigned long long tmp = (ah_bl & lomask) + (al_bh & lomask) + (al_bl >> 32);
/* round up */
tmp += 1U << 31;
@@ -164,7 +162,7 @@ static Fp multiply(Fp* a, Fp* b)
return fp;
}
-static void round_digit(char* digits, int ndigits, uint64_t delta, uint64_t rem, uint64_t kappa, uint64_t frac)
+static void round_digit(char* digits, int ndigits, unsigned long long delta, unsigned long long rem, unsigned long long kappa, unsigned long long frac)
{
while (rem < frac && delta - rem >= kappa &&
(rem + kappa < frac || frac - rem > rem + kappa - frac)) {
@@ -176,22 +174,22 @@ static void round_digit(char* digits, int ndigits, uint64_t delta, uint64_t rem,
static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
{
- uint64_t wfrac = upper->frac - fp->frac;
- uint64_t delta = upper->frac - lower->frac;
+ unsigned long long wfrac = upper->frac - fp->frac;
+ unsigned long long delta = upper->frac - lower->frac;
Fp one;
one.frac = 1ULL << -upper->exp;
one.exp = upper->exp;
- uint64_t part1 = upper->frac >> -one.exp;
- uint64_t part2 = upper->frac & (one.frac - 1);
+ unsigned long long part1 = upper->frac >> -one.exp;
+ unsigned long long part2 = upper->frac & (one.frac - 1);
int idx = 0, kappa = 10;
- uint64_t* divp;
+ unsigned long long* divp;
/* 1000000000 */
for (divp = tens + 10; kappa > 0; divp++) {
- uint64_t div = *divp;
+ unsigned long long div = *divp;
unsigned digit = part1 / div;
if (digit || idx) {
@@ -201,7 +199,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
part1 -= digit * div;
kappa--;
- uint64_t tmp = (part1 << -one.exp) + part2;
+ unsigned long long tmp = (part1 << -one.exp) + part2;
if (tmp <= delta) {
*K += kappa;
round_digit(digits, idx, delta, tmp, div << -one.exp, wfrac);
@@ -211,7 +209,7 @@ static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K)
}
/* 10 */
- uint64_t* unit = tens + 18;
+ unsigned long long* unit = tens + 18;
while (true) {
part2 *= 10;
@@ -458,7 +456,7 @@ static int filter_special(double fp, char* dest)
return 1;
}
- uint64_t bits = get_dbits(fp);
+ unsigned long long bits = get_dbits(fp);
bool nan = (bits & expmask) == expmask;
diff --git a/GcodeProcessorLib/fpconv.h b/GcodeProcessorLib/fpconv.h
index 2156eb5..6896a3a 100644
--- a/GcodeProcessorLib/fpconv.h
+++ b/GcodeProcessorLib/fpconv.h
@@ -52,8 +52,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef FPCONV_H
#define FPCONV_H
-
-#include <stdint.h>
/* Fast and accurate double to string conversion based on Florian Loitsch's
* Grisu-algorithm[1].
*
@@ -96,7 +94,7 @@ int fpconv_dtos(double fp, char dest[24], unsigned char precision);
typedef struct Fp {
- uint64_t frac;
+ unsigned long long frac;
int exp;
} Fp;
@@ -171,4 +169,5 @@ static Fp find_cachedpow10(int exp, int* k)
return powers_ten[idx];
}
-} \ No newline at end of file
+}
+
diff --git a/PyArcWelder/CMakeLists.txt b/PyArcWelder/CMakeLists.txt
index 593eaf2..c4462a6 100644
--- a/PyArcWelder/CMakeLists.txt
+++ b/PyArcWelder/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(PyArcWelder C CXX)
@@ -15,6 +15,12 @@ include_directories(${PYTHON_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} ${GcodeProc
# PyArcWelderSources variable
include(sourcelist.cmake)
+
+if(MSVC)
+ # link to the msvc runtime statically, keeping debug info if we are in debug config
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
# Create our library
add_library(${PROJECT_NAME} SHARED ${PyArcWelderSources})
diff --git a/PyArcWelder/sourcelist.cmake b/PyArcWelder/sourcelist.cmake
index ff43231..e1a425d 100644
--- a/PyArcWelder/sourcelist.cmake
+++ b/PyArcWelder/sourcelist.cmake
@@ -7,4 +7,4 @@ set(PyArcWelderSources ${PyArcWelderSources}
py_logger.h
python_helpers.cpp
python_helpers.h
-) \ No newline at end of file
+)
diff --git a/TCLAP/CMakeLists.txt b/TCLAP/CMakeLists.txt
index 6b0b43f..eefe7d0 100644
--- a/TCLAP/CMakeLists.txt
+++ b/TCLAP/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION "3.13")
+cmake_minimum_required (VERSION "3.15")
project(TCLAP C CXX)