Skip to content

Commit

Permalink
CXX: Add initial version of the static library compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
agdavydov81 committed Sep 28, 2023
1 parent eeb3ae9 commit 4a5c924
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 249 deletions.
29 changes: 29 additions & 0 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,32 @@ target_compile_definitions(dfpmath PRIVATE API_PREFIX=ddfpmath${VERSION_SUFFIX}_
target_link_libraries (dfpmath LINK_PUBLIC bid)
set_target_properties(dfpmath PROPERTIES OUTPUT_NAME "ddfpmath${VERSION_SUFFIX}")
install(TARGETS dfpmath DESTINATION ./binmath/${CMAKE_BUILD_TYPE}/${INSTALL_SUFFIX})

file(GLOB BID_SRCS_STATIC
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/src/*.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_bid.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_bessel.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_cbrt.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_erf.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_exp.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_int.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_inv_hyper.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_inv_trig.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_lgamma.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_log.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_mod.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_powi.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_pow.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_sqrt.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_trig.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_ops.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_ux_ops_64.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_four_over_pi.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.c
../thirdparty/IntelRDFPMathLib20U2/LIBRARY/float128/sqrt_tab_t.c)

add_library(dfpStatic STATIC NativeImpl.c ${BID_SRCS_STATIC})
include_directories(../thirdparty/IntelRDFPMathLib20U2/LIBRARY/src)
target_compile_definitions(dfpStatic PRIVATE API_PREFIX=ddfp${VERSION_SUFFIX}_ NOJAVA)
set_target_properties(dfpStatic PROPERTIES OUTPUT_NAME "ddfpStatic${VERSION_SUFFIX}")
install(TARGETS dfpStatic DESTINATION ./bin/${CMAKE_BUILD_TYPE}/${INSTALL_SUFFIX})
2 changes: 2 additions & 0 deletions native/NativeImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DDFP_API(int32) PPCAT(API_PREFIX, compare) ( BID_UINT64 a, BID_UINT64 b) {
return 0;
return bid64_isNaN(b) - bid64_isNaN(a);
}
JAVA_API_IMPL(
JNI_API(int32) PPCAT(PPCAT(Java_, JAVA_PREFIX), compare) (void *jEnv, void *jClass, BID_UINT64 a, BID_UINT64 b) {
if (bid64_quiet_less(a, b))
return -1;
Expand All @@ -56,6 +57,7 @@ JNI_API(int32) PPCAT(PPCAT(JavaCritical_, JAVA_PREFIX), compare) ( BID_UINT64 a,
return 0;
return bid64_isNaN(a) - bid64_isNaN(b);
}
)

OPN_BOOL(isEqual, bid64_quiet_equal(a, b), BID_UINT64 a, BID_UINT64 b)
OPN_BOOL(isNotEqual, bid64_quiet_not_equal(a, b), BID_UINT64 a, BID_UINT64 b)
Expand Down
11 changes: 10 additions & 1 deletion native/NativeImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,25 @@ STATIC_ASSERT(sizeof(uint32) == 4)
STATIC_ASSERT(sizeof(int64) == 8)
STATIC_ASSERT(sizeof(uint64) == 8)

#ifndef NOJAVA
#define JAVA_API_IMPL(X) X
#else
#define JAVA_API_IMPL(X)
#endif


#define OPNRR(mcr__name, mcr__type, mcr__body, ...) \
DDFP_API(mcr__type) PPCAT(API_PREFIX, mcr__name) (__VA_ARGS__) { \
mcr__body \
} \
JAVA_API_IMPL( \
JNI_API(mcr__type) PPCAT(PPCAT(Java_, JAVA_PREFIX), mcr__name) (void *jEnv, void *jClass, __VA_ARGS__) { \
mcr__body \
} \
JNI_API(mcr__type) PPCAT(PPCAT(JavaCritical_, JAVA_PREFIX), mcr__name) (__VA_ARGS__) { \
mcr__body \
}
} \
)

#define OPNR(mcr__name, mcr__type, mcr__body, ...) OPNRR(mcr__name, mcr__type, return (mcr__body);, __VA_ARGS__)

Expand Down
270 changes: 22 additions & 248 deletions thirdparty/IntelRDFPMathLib20U2/LIBRARY/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,253 +1,27 @@
set(NAME bid)

set(${NAME}_SRCS
src/bid64_acos.c
src/bid64_acosh.c
src/bid64_asin.c
src/bid64_asinh.c
src/bid64_atan.c
src/bid64_atan2.c
src/bid64_atanh.c
src/bid64_cbrt.c
src/bid64_cos.c
src/bid64_cosh.c
src/bid64_erf.c
src/bid64_erfc.c
src/bid64_exp.c
src/bid64_exp10.c
src/bid64_exp2.c
src/bid64_expm1.c
src/bid64_hypot.c
src/bid64_lgamma.c
src/bid64_log.c
src/bid64_log10.c
src/bid64_log1p.c
src/bid64_log2.c
src/bid64_pow.c
src/bid64_sin.c
src/bid64_sinh.c
src/bid64_tan.c
src/bid64_tanh.c
src/bid64_tgamma.c
src/bid128_acos.c
src/bid128_acosh.c
src/bid128_asin.c
src/bid128_asinh.c
src/bid128_atan.c
src/bid128_atan2.c
src/bid128_atanh.c
src/bid128_cbrt.c
src/bid128_cos.c
src/bid128_cosh.c
src/bid128_erf.c
src/bid128_erfc.c
src/bid128_exp.c
src/bid128_exp10.c
src/bid128_exp2.c
src/bid128_expm1.c
src/bid128_hypot.c
src/bid128_lgamma.c
src/bid128_log.c
src/bid128_log10.c
src/bid128_log1p.c
src/bid128_log2.c
src/bid128_pow.c
src/bid128_sin.c
src/bid128_sinh.c
src/bid128_tan.c
src/bid128_tanh.c
src/bid128_tgamma.c
src/bid32_add.c
src/bid32_compare.c
src/bid32_div.c
src/bid32_fdimd.c
src/bid32_fma.c
src/bid32_fmod.c
src/bid32_frexp.c
src/bid32_ldexp.c
src/bid32_llrintd.c
src/bid32_logb.c
src/bid32_logbd.c
src/bid32_lrintd.c
src/bid32_lround.c
src/bid32_minmax.c
src/bid32_modf.c
src/bid32_mul.c
src/bid32_nearbyintd.c
src/bid32_next.c
src/bid32_nexttowardd.c
src/bid32_noncomp.c
src/bid32_quantexpd.c
src/bid32_quantize.c
src/bid32_rem.c
src/bid32_round_integral.c
src/bid32_scalb.c
src/bid32_scalbl.c
src/bid32_sqrt.c
src/bid32_string.c
src/bid32_to_int16.c
src/bid32_to_int32.c
src/bid32_to_int64.c
src/bid32_to_int8.c
src/bid32_to_uint16.c
src/bid32_to_uint32.c
src/bid32_to_uint64.c
src/bid32_to_uint8.c
src/bid32_llround.c
src/bid32_llquantexpd.c
src/bid32_quantumd.c
src/bid64_add.c
src/bid64_compare.c
src/bid64_div.c
src/bid64_fdimd.c
src/bid64_fma.c
src/bid64_fmod.c
src/bid64_frexp.c
src/bid64_ldexp.c
src/bid64_llrintd.c
src/bid64_logb.c
src/bid64_logbd.c
src/bid64_lrintd.c
src/bid64_lround.c
src/bid64_minmax.c
src/bid64_modf.c
src/bid64_mul.c
src/bid64_nearbyintd.c
src/bid64_next.c
src/bid64_nexttowardd.c
src/bid64_noncomp.c
src/bid64_quantexpd.c
src/bid64_quantize.c
src/bid64_rem.c
src/bid64_round_integral.c
src/bid64_scalb.c
src/bid64_scalbl.c
src/bid64_sqrt.c
src/bid64_string.c
src/bid64_to_int16.c
src/bid64_to_int32.c
src/bid64_to_int64.c
src/bid64_to_int8.c
src/bid64_to_uint16.c
src/bid64_to_uint32.c
src/bid64_to_uint64.c
src/bid64_to_uint8.c
src/bid64_llround.c
src/bid64_llquantexpd.c
src/bid64_quantumd.c
src/bid128_add.c
src/bid128_compare.c
src/bid128_div.c
src/bid128_fdimd.c
src/bid128_fma.c
src/bid128_fmod.c
src/bid128_frexp.c
src/bid128_ldexp.c
src/bid128_llrintd.c
src/bid128_logb.c
src/bid128_logbd.c
src/bid128_lrintd.c
src/bid128_lround.c
src/bid128_minmax.c
src/bid128_modf.c
src/bid128_mul.c
src/bid128_nearbyintd.c
src/bid128_next.c
src/bid128_nexttowardd.c
src/bid128_noncomp.c
src/bid128_quantexpd.c
src/bid128_quantize.c
src/bid128_rem.c
src/bid128_round_integral.c
src/bid128_scalb.c
src/bid128_scalbl.c
src/bid128_sqrt.c
src/bid128_string.c
src/bid128_to_int16.c
src/bid128_to_int32.c
src/bid128_to_int64.c
src/bid128_to_int8.c
src/bid128_to_uint16.c
src/bid128_to_uint32.c
src/bid128_to_uint64.c
src/bid128_to_uint8.c
src/bid128_llround.c
src/bid128_llquantexpd.c
src/bid128_quantumd.c
src/strtod32.c
src/strtod64.c
src/strtod128.c
src/wcstod32.c
src/wcstod64.c
src/wcstod128.c
src/bid32_acos.c
src/bid32_acosh.c
src/bid32_asin.c
src/bid32_asinh.c
src/bid32_atan.c
src/bid32_atan2.c
src/bid32_atanh.c
src/bid32_cbrt.c
src/bid32_cos.c
src/bid32_cosh.c
src/bid32_erf.c
src/bid32_erfc.c
src/bid32_exp.c
src/bid32_exp10.c
src/bid32_exp2.c
src/bid32_expm1.c
src/bid32_hypot.c
src/bid32_lgamma.c
src/bid32_log.c
src/bid32_log10.c
src/bid32_log1p.c
src/bid32_log2.c
src/bid32_pow.c
src/bid32_sin.c
src/bid32_sinh.c
src/bid32_tan.c
src/bid32_tanh.c
src/bid32_tgamma.c
src/bid32_sub.c
src/bid32_to_bid128.c
src/bid32_to_bid64.c
src/bid64_to_bid128.c
src/bid128_2_str_tables.c
src/bid_binarydecimal.c
src/bid_convert_data.c
src/bid_decimal_data.c
src/bid_decimal_globals.c
src/bid_dpd.c
src/bid_feclearexcept.c
src/bid_fegetexceptflag.c
src/bid_feraiseexcept.c
src/bid_fesetexceptflag.c
src/bid_fetestexcept.c
src/bid_flag_operations.c
src/bid_from_int.c
src/bid_round.c
src/bid128.c
float128/dpml_ux_bid.c
float128/dpml_ux_bessel.c
float128/dpml_ux_cbrt.c
float128/dpml_ux_erf.c
float128/dpml_ux_exp.c
float128/dpml_ux_int.c
float128/dpml_ux_inv_hyper.c
float128/dpml_ux_inv_trig.c
float128/dpml_ux_lgamma.c
float128/dpml_ux_log.c
float128/dpml_ux_mod.c
float128/dpml_ux_powi.c
float128/dpml_ux_pow.c
float128/dpml_ux_sqrt.c
float128/dpml_ux_trig.c
float128/dpml_ux_ops.c
float128/dpml_ux_ops_64.c
float128/dpml_four_over_pi.c
float128/dpml_exception.c
float128/sqrt_tab_t.c
)
file(GLOB ${NAME}_SRCS
src/*.c
float128/dpml_ux_bid.c
float128/dpml_ux_bessel.c
float128/dpml_ux_cbrt.c
float128/dpml_ux_erf.c
float128/dpml_ux_exp.c
float128/dpml_ux_int.c
float128/dpml_ux_inv_hyper.c
float128/dpml_ux_inv_trig.c
float128/dpml_ux_lgamma.c
float128/dpml_ux_log.c
float128/dpml_ux_mod.c
float128/dpml_ux_powi.c
float128/dpml_ux_pow.c
float128/dpml_ux_sqrt.c
float128/dpml_ux_trig.c
float128/dpml_ux_ops.c
float128/dpml_ux_ops_64.c
float128/dpml_four_over_pi.c
float128/dpml_exception.c
float128/sqrt_tab_t.c)

add_library(${NAME} STATIC ${${NAME}_SRCS})

Expand Down

0 comments on commit 4a5c924

Please sign in to comment.