mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-24 17:41:39 +08:00
added CMAKE-check for existence of _j0 or j0, should fix issue https://github.com/jkriege2/JKQtPlotter/issues/124
This commit is contained in:
parent
ffb33a507e
commit
7f4972a0e1
@ -10,3 +10,16 @@ math(EXPR JKQtPlotter_BIT_DEPTH ${CMAKE_SIZEOF_VOID_P}*8)
|
||||
|
||||
find_package( CImg QUIET )
|
||||
find_package( OpenCV QUIET )
|
||||
|
||||
include(CheckFunctionExists)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "cmath")
|
||||
CHECK_FUNCTION_EXISTS(j0 JKQtPlotter_HAS_j0)
|
||||
CHECK_FUNCTION_EXISTS(_j0 JKQtPlotter_HAS__j0)
|
||||
CHECK_FUNCTION_EXISTS(y0 JKQtPlotter_HAS_y0)
|
||||
CHECK_FUNCTION_EXISTS(_y0 JKQtPlotter_HAS__y0)
|
||||
CHECK_FUNCTION_EXISTS(jn JKQtPlotter_HAS_jn)
|
||||
CHECK_FUNCTION_EXISTS(_jn JKQtPlotter_HAS__jn)
|
||||
CHECK_FUNCTION_EXISTS(yn JKQtPlotter_HAS_yn)
|
||||
CHECK_FUNCTION_EXISTS(_yn JKQtPlotter_HAS__yn)
|
||||
|
||||
|
@ -38,6 +38,31 @@ function(jkqtplotter_setDefaultLibOptions TARGETNAME libBaseName PRECOMPHEADERFI
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC NOMINMAX)
|
||||
endif()
|
||||
|
||||
if(JKQtPlotter_HAS_j0)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS_j0)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS__j0)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS__j0)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS_y0)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS_y0)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS__y0)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS__y0)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS_jn)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS_jn)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS__jn)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS__jn)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS_yn)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS_yn)
|
||||
endif()
|
||||
if(JKQtPlotter_HAS__yn)
|
||||
target_compile_definitions(${TARGETNAME} PUBLIC JKQtPlotter_HAS__yn)
|
||||
endif()
|
||||
|
||||
# enable TIMING INFO output (if activated by option JKQtPlotter_BUILD_WITH_TIMING_INFO_OUTPUT)
|
||||
if(JKQtPlotter_BUILD_WITH_TIMING_INFO_OUTPUT)
|
||||
target_compile_definitions(${TARGETNAME} PRIVATE JKQTBP_AUTOTIMER)
|
||||
|
@ -391,77 +391,87 @@ inline T jkqtp_inversePropSaveDefault(const T& v) {
|
||||
return jkqtp_inversePropSave<T>(v, std::numeric_limits<T>::epsilon()*100.0);
|
||||
}
|
||||
|
||||
/*! \brief j0() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
#if defined(JKQtPlotter_HAS_j0) || defined(JKQtPlotter_HAS__j0) || defined(DOXYGEN)
|
||||
|
||||
*/
|
||||
inline double jkqtp_j0(double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _j0(x);
|
||||
#else
|
||||
return j0(x);
|
||||
/*! \brief j0() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_j0(double x) {
|
||||
#ifdef JKQtPlotter_HAS__j0
|
||||
return _j0(x);
|
||||
#elif defined(JKQtPlotter_HAS_j0)
|
||||
return j0(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief j1() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_j1(double x) {
|
||||
#ifdef JKQtPlotter_HAS__j0
|
||||
return _j1(x);
|
||||
#elif defined(JKQtPlotter_HAS_j0)
|
||||
return j1(x);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief j1() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
#if defined(JKQtPlotter_HAS_jn) || defined(JKQtPlotter_HAS__jn) || defined(DOXYGEN)
|
||||
/*! \brief jn() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_j1(double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _j1(x);
|
||||
#else
|
||||
return j1(x);
|
||||
*/
|
||||
inline double jkqtp_jn(int n, double x) {
|
||||
#ifdef JKQtPlotter_HAS__jn
|
||||
return _jn(n,x);
|
||||
#elif defined(JKQtPlotter_HAS_jn)
|
||||
return jn(n,x);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief y0() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_y0(double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _y0(x);
|
||||
#else
|
||||
return y0(x);
|
||||
#if defined(JKQtPlotter_HAS_y0) || defined(JKQtPlotter_HAS__y0) || defined(DOXYGEN)
|
||||
/*! \brief y0() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_y0(double x) {
|
||||
#ifdef JKQtPlotter_HAS__y0
|
||||
return _y0(x);
|
||||
#elif defined(JKQtPlotter_HAS_y0)
|
||||
return y0(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief y1() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_y1(double x) {
|
||||
#ifdef JKQtPlotter_HAS__y0
|
||||
return _y1(x);
|
||||
#elif defined(JKQtPlotter_HAS_y0)
|
||||
return y1(x);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(JKQtPlotter_HAS_yn) || defined(JKQtPlotter_HAS__yn) || defined(DOXYGEN)
|
||||
/*! \brief yn() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
/*! \brief y1() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_y1(double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _y1(x);
|
||||
#else
|
||||
return y1(x);
|
||||
*/
|
||||
inline double jkqtp_yn(int n, double x) {
|
||||
#ifdef JKQtPlotter_HAS__yn
|
||||
return _yn(n,x);
|
||||
#elif defined(JKQtPlotter_HAS_yn)
|
||||
return yn(n,x);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief jn() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_jn(int n, double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _jn(n,x);
|
||||
#else
|
||||
return jn(n,x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief yn() function (without compiler issues)
|
||||
\ingroup jkqtptools_math_basic
|
||||
|
||||
*/
|
||||
inline double jkqtp_yn(int n, double x) {
|
||||
#if Q_CC_MSVC
|
||||
return _yn(n,x);
|
||||
#else
|
||||
return yn(n,x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief calculate the distance between two QPointF points
|
||||
* \ingroup jkqtptools_math_basic
|
||||
|
@ -25,6 +25,7 @@
|
||||
#endif
|
||||
#include <cmath>
|
||||
#include "jkqtmath/jkqtpmathparser.h" // class's header file
|
||||
#include "jkqtcommon/jkqtpmathtools.h"
|
||||
#include <iostream>
|
||||
#include <float.h>
|
||||
#include <ctime>
|
||||
@ -324,16 +325,13 @@ namespace { // anonymous namespace to limit availability to this module (CPP-fil
|
||||
return r;
|
||||
}
|
||||
|
||||
#if defined(JKQtPlotter_HAS_j0) || defined(JKQtPlotter_HAS__j0)
|
||||
JKQTPMathParser::jkmpResult fJ0(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=1) p->jkmpError("j0 accepts 1 argument");
|
||||
if (params[0].type!=JKQTPMathParser::jkmpDouble) p->jkmpError("j0 needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num = _j0(params[0].num);
|
||||
#else
|
||||
r.num = j0(params[0].num);
|
||||
#endif
|
||||
r.num = jkqtp_j0(params[0].num);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -342,24 +340,32 @@ namespace { // anonymous namespace to limit availability to this module (CPP-fil
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=1) p->jkmpError("j1 accepts 1 argument");
|
||||
if (params[0].type!=JKQTPMathParser::jkmpDouble) p->jkmpError("j1 needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num=_j1(params[0].num);
|
||||
#else
|
||||
r.num=j1(params[0].num);
|
||||
#endif
|
||||
r.num = jkqtp_j1(params[0].num);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(JKQtPlotter_HAS_jn) || defined(JKQtPlotter_HAS__jn)
|
||||
JKQTPMathParser::jkmpResult fJn(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=2) p->jkmpError("jn accepts 2 argument");
|
||||
if ((params[0].type!=JKQTPMathParser::jkmpDouble)||(params[1].type!=JKQTPMathParser::jkmpDouble)) p->jkmpError("jn needs double argument");
|
||||
r.num=jkqtp_jn(static_cast<int>(params[0].num), params[1].num);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(JKQtPlotter_HAS_y0) || defined(JKQtPlotter_HAS__y0)
|
||||
JKQTPMathParser::jkmpResult fY0(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=1) p->jkmpError("y0 accepts 1 argument");
|
||||
if (params[0].type!=JKQTPMathParser::jkmpDouble) p->jkmpError("y0 needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num=_y0(params[0].num);
|
||||
#else
|
||||
r.num=y0(params[0].num);
|
||||
#endif
|
||||
r.num = jkqtp_y0(params[0].num);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -368,39 +374,20 @@ namespace { // anonymous namespace to limit availability to this module (CPP-fil
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=1) p->jkmpError("y1 accepts 1 argument");
|
||||
if (params[0].type!=JKQTPMathParser::jkmpDouble) p->jkmpError("y1 needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num=_y1(params[0].num);
|
||||
#else
|
||||
r.num=y1(params[0].num);
|
||||
#endif
|
||||
r.num = jkqtp_y1(params[0].num);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if defined(JKQtPlotter_HAS_yn) || defined(JKQtPlotter_HAS__yn)
|
||||
JKQTPMathParser::jkmpResult fYn(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=2) p->jkmpError("yn accepts 2 argument");
|
||||
if ((params[0].type!=JKQTPMathParser::jkmpDouble)||(params[1].type!=JKQTPMathParser::jkmpDouble)) p->jkmpError("yn needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num=_yn(static_cast<int>(params[0].num), params[1].num);
|
||||
#else
|
||||
r.num=yn(static_cast<int>(params[0].num), params[1].num);
|
||||
#endif
|
||||
r.num=jkqtp_yn(static_cast<int>(params[0].num), params[1].num);
|
||||
return r;
|
||||
}
|
||||
|
||||
JKQTPMathParser::jkmpResult fJn(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
r.type=JKQTPMathParser::jkmpDouble;
|
||||
if (n!=2) p->jkmpError("jn accepts 2 argument");
|
||||
if ((params[0].type!=JKQTPMathParser::jkmpDouble)||(params[1].type!=JKQTPMathParser::jkmpDouble)) p->jkmpError("jn needs double argument");
|
||||
#if Q_CC_MSVC
|
||||
r.num=_jn(static_cast<int>(params[0].num), params[1].num);
|
||||
#else
|
||||
r.num=jn(static_cast<int>(params[0].num), params[1].num);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
JKQTPMathParser::jkmpResult fSRand(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
|
||||
JKQTPMathParser::jkmpResult r;
|
||||
@ -700,12 +687,20 @@ void JKQTPMathParser::addStandardFunctions(){
|
||||
addFunction("erfc", fErfc);
|
||||
addFunction("lgamma", flGamma);
|
||||
addFunction("tgamma", ftGamma);
|
||||
#if defined(JKQtPlotter_HAS_j0) || defined(JKQtPlotter_HAS__j0)
|
||||
addFunction("j0", fJ0);
|
||||
addFunction("j1", fJ1);
|
||||
#endif
|
||||
#if defined(JKQtPlotter_HAS_jn) || defined(JKQtPlotter_HAS__jn)
|
||||
addFunction("jn", fJn);
|
||||
#endif
|
||||
#if defined(JKQtPlotter_HAS_y0) || defined(JKQtPlotter_HAS__y0)
|
||||
addFunction("y0", fY0);
|
||||
addFunction("y1", fY1);
|
||||
#endif
|
||||
#if defined(JKQtPlotter_HAS_yn) || defined(JKQtPlotter_HAS__yn)
|
||||
addFunction("yn", fYn);
|
||||
#endif
|
||||
addFunction("rand", fRand);
|
||||
addFunction("srand", fSRand);
|
||||
addFunction("ceil", fCeil);
|
||||
|
Loading…
Reference in New Issue
Block a user