diff --git a/README.md b/README.md index 49a6755f..40083525 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ that's it. If the build system is unable to find your GMP installation, please edit the paths in file makeConstants. In general, the project uses a basic makefile. In the event that you have to do something more complicated to get the library to compile, or if you are unable to get it to compile, please e-mail me or open an issue on GitHub. Doing so is much more effective than cursing at your computer, and will save other users trouble in the future. -Windows +Windows Native ---- Cork uses C++11, so you will need the most recent compiler; Visual Studio 2012 or higher please. You will also need to install the MPIR arithmetic library into your Visual Studio environment. @@ -50,6 +50,15 @@ Cork uses C++11, so you will need the most recent compiler; Visual Studio 2012 o Once this is done, you can use the solution and project files in the /win/ subdirectory to build the demo program. The solution/project is not currently configured to build a DLL. Please bug me if this is an issue for you. +Cross-Compiling on Unix for Windows +----------------------------------- + +Cork can be cross compiled for windows using [mingw-w64](http://mingw-w64.sourceforge.net) and [wclang](https://github.com/tpoechtrager/wclang) which is a clang frontend for mingw. You first need to cross compile the GMP library using mingw-w64 and then: + + make CC=w32-clang CXX=w32-clang++ GMP_INC_DIR=/usr/i686-w64-mingw32/include/ GMP_LIB_DIR=/usr/i686-w64-mingw32/lib/ + +Tune the `GMP_INC_DIR` and `GMP_LIB_DIR` variables according to where gmp was compiled. It should build a Windows executable under `bin/cork`. You can rename it `cork.exe` and you are set. + Licensing ========= diff --git a/src/isct/fixint.h b/src/isct/fixint.h index 37465a1d..ccc20740 100644 --- a/src/isct/fixint.h +++ b/src/isct/fixint.h @@ -45,7 +45,7 @@ -#ifdef _WIN32 +#ifdef _MSC_VER #include #else #include diff --git a/src/isct/gmpext4.h b/src/isct/gmpext4.h index 1a5541c9..fb76fab6 100644 --- a/src/isct/gmpext4.h +++ b/src/isct/gmpext4.h @@ -25,7 +25,7 @@ // +------------------------------------------------------------------------- #pragma once -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(disable: 4800) #pragma warning(disable: 4244) #include diff --git a/src/mesh/mesh.isct.tpp b/src/mesh/mesh.isct.tpp index 6c48930a..9c2b16d2 100644 --- a/src/mesh/mesh.isct.tpp +++ b/src/mesh/mesh.isct.tpp @@ -632,7 +632,7 @@ public: quantized_coords.resize(N); uint write = 0; TopoCache::verts.for_each([&](Vptr v) { -#ifdef _WIN32 +#ifdef _MSC_VER Vec3d raw = mesh->verts[v->ref].pos; #else Vec3d raw = TopoCache::mesh->verts[v->ref].pos; diff --git a/src/mesh/mesh.tpp b/src/mesh/mesh.tpp index 9da1614d..bc63204d 100644 --- a/src/mesh/mesh.tpp +++ b/src/mesh/mesh.tpp @@ -250,7 +250,7 @@ typename Mesh::NeighborCache } // This function signature is an amazing disaster... -#ifdef _WIN32 +#ifdef _MSC_VER template template typename Mesh::EGraphCache diff --git a/src/util/prelude.h b/src/util/prelude.h index 00329aad..24a03b16 100644 --- a/src/util/prelude.h +++ b/src/util/prelude.h @@ -31,6 +31,10 @@ #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + #ifndef uint typedef unsigned int uint; #endif