summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPaul Cercueil <paul.cercueil@analog.com>2015-09-14 14:53:35 +0200
committerJohnathan Corgan <johnathan@corganlabs.com>2016-05-30 13:23:22 -0700
commit25142dad0464bed59dc03672931aab637f82d376 (patch)
tree1ec31795dbb5a1d98aa941e17c38b30c58964e02 /cmake
parentae26f969c9c260556aad4ffd006fea96f3452d01 (diff)
cmake: Windows-specific fixes for compatibility
* Properly wrap the prefix variables in quotation marks. This allows to set an empty prefix. * Fix library names when compiling for Windows. This now also works when using mingw-w64. * Fix boost module name when compiling with mingw-w64 * Fix build under mingw-w64 * Fix config.h header to avoid macro redefinition * Remove duplicated Boost::thread entry in dependencies list
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/GrBoost.cmake7
-rw-r--r--cmake/msvc/config.h7
2 files changed, 13 insertions, 1 deletions
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake
index ecf58a9367..6e036a5bdc 100644
--- a/cmake/Modules/GrBoost.cmake
+++ b/cmake/Modules/GrBoost.cmake
@@ -31,10 +31,15 @@ set(BOOST_REQUIRED_COMPONENTS
program_options
filesystem
system
- thread
regex
)
+if (MINGW)
+ set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread_win32)
+else(MINGW)
+ set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread)
+endif(MINGW)
+
if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h
index 43792c7837..50515104db 100644
--- a/cmake/msvc/config.h
+++ b/cmake/msvc/config.h
@@ -21,19 +21,25 @@ typedef ptrdiff_t ssize_t;
////////////////////////////////////////////////////////////////////////
// rint functions
////////////////////////////////////////////////////////////////////////
+#define _USE_MATH_DEFINES
#include <math.h>
+#if _MSC_VER < 1800
static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);}
static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);}
+#endif
////////////////////////////////////////////////////////////////////////
// math constants
////////////////////////////////////////////////////////////////////////
+#ifndef INFINITY
#define INFINITY HUGE_VAL
+#endif
+#ifndef _MATH_DEFINES_DEFINED
# define M_E 2.7182818284590452354 /* e */
# define M_LOG2E 1.4426950408889634074 /* log_2 e */
# define M_LOG10E 0.43429448190325182765 /* log_10 e */
@@ -47,6 +53,7 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x
# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+#endif
////////////////////////////////////////////////////////////////////////
// random and srandom