[DEV] correct the Vector2D dependency with cxx

This commit is contained in:
Edouard DUPIN 2016-01-08 22:18:22 +01:00
parent 59bbfffc64
commit 75fba23b73
5 changed files with 13 additions and 17 deletions

View File

@ -88,12 +88,12 @@ std::ostream& etk::operator <<(std::ostream& _os, const std::vector<bvec2 >& _ob
vec2 vec2rotate(const vec2& _val, const vec2& _point, float _angle) {
vec2 out = _val;
#if (defined(__TARGET_OS__MacOs) || defined(__TARGET_OS__IOs) || __cplusplus < 201103L)
float sinAngle = sin(_angle);
float cosAngle = cos(_angle);
#else
#if __CPP_VERSION__ >= 2011 && !defined(__STDCPP_LLVM__)
float sinAngle = std::sin(_angle);
float cosAngle = std::cos(_angle);
#else
float sinAngle = sin(_angle);
float cosAngle = cos(_angle);
#endif
if (_point == vec2(0,0)) {
float tempX = out.x() * cosAngle - out.y() * sinAngle;

View File

@ -242,7 +242,7 @@ namespace etk {
* @brief Return the length of the vector
*/
float length() const {
#if __CPP_VERSION__ >= 2011 && !defined(__TARGET_OS__MacOs) && !defined(__TARGET_OS__IOs)
#if __CPP_VERSION__ >= 2011 && !defined(__STDCPP_LLVM__)
return std::sqrt(length2());
#else
return sqrt(length2());

View File

@ -155,14 +155,10 @@ namespace etk {
* @brief Return the length of the vector
*/
btScalar length() const {
#ifdef ETK_BUILD_LINEARMATH
return btSqrt(length2());
#if __CPP_VERSION__ >= 2011 && !defined(__STDCPP_LLVM__)
return std::sqrt(length2());
#else
#if __CPP_VERSION__ >= 2011 && !defined(__TARGET_OS__MacOs) && !defined(__TARGET_OS__IOs)
return std::sqrt(length2());
#else
return sqrt(length2());
#endif
return sqrt(length2());
#endif
}

View File

@ -14,13 +14,11 @@
#include <unistd.h>
#include <stdlib.h>
double etk::tool::frand(double _a, double _b)
{
double etk::tool::frand(double _a, double _b) {
return (float)(( (double)rand()/(double)RAND_MAX ) * ((double)_b-(double)_a) + (double)_a);
}
int32_t etk::tool::irand(int32_t _a, int32_t _b)
{
int32_t etk::tool::irand(int32_t _a, int32_t _b) {
return (int32_t)(( rand()/(double)RAND_MAX ) * ((double)_b-(double)_a) + (double)_a);
}

View File

@ -88,8 +88,10 @@ def create(target, module_name):
elif target.name != "Windows":
my_module.add_export_flag('link', [
'-ldl'])
# build in C++ mode
my_module.compile_version("c++", 2011)
# ad dependency of the generic C++ library:
my_module.add_module_depend('cxx')
my_module.add_optionnal_module_depend('minizip', ["c++", "-DETK_BUILD_MINIZIP"])
my_module.add_optionnal_module_depend('linearmath', ["c", "-DETK_BUILD_LINEARMATH"], export=True)