Rename jerry-libm to jerry-math (#4410)
That "libm" in the name of the library resulted in awkward naming on *nix systems (`libjerry-libm.*`, "lib" occurring twice). And the name of the corresponding header is `math.h` anyway. Note that this is a breaking change in some sense. The commit contains no API change, but the build system does change for users of the math library. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+12
-12
@@ -53,7 +53,7 @@ set(JERRY_CMDLINE_SNAPSHOT OFF CACHE BOOL "Build jerry snapshot command line to
|
||||
set(JERRY_LIBFUZZER OFF CACHE BOOL "Build jerry with libfuzzer support?")
|
||||
set(JERRY_PORT_DEFAULT ON CACHE BOOL "Build default jerry port implementation?")
|
||||
set(JERRY_EXT ON CACHE BOOL "Build jerry-ext?")
|
||||
set(JERRY_LIBM ON CACHE BOOL "Build and use jerry-libm?")
|
||||
set(JERRY_MATH ON CACHE BOOL "Build and use jerry-math?")
|
||||
set(UNITTESTS OFF CACHE BOOL "Build unit tests?")
|
||||
set(DOCTESTS OFF CACHE BOOL "Build doc tests?")
|
||||
|
||||
@@ -82,21 +82,21 @@ if(JERRY_CMDLINE OR DOCTESTS)
|
||||
endif()
|
||||
|
||||
if("${PLATFORM}" STREQUAL "DARWIN")
|
||||
set(JERRY_LIBM OFF)
|
||||
set(JERRY_MATH OFF)
|
||||
set(ENABLE_LTO OFF)
|
||||
set(ENABLE_STRIP OFF)
|
||||
|
||||
set(JERRY_LIBM_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(JERRY_MATH_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(ENABLE_STRIP_MESSAGE " (FORCED BY PLATFORM)")
|
||||
endif()
|
||||
|
||||
if("${PLATFORM}" STREQUAL "ESP-IDF")
|
||||
set(JERRY_LIBM OFF)
|
||||
set(JERRY_MATH OFF)
|
||||
set(ENABLE_LTO OFF)
|
||||
set(ENABLE_STRIP OFF)
|
||||
|
||||
set(JERRY_LIBM_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(JERRY_MATH_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
|
||||
set(ENABLE_STRIP_MESSAGE " (FORCED BY PLATFORM)")
|
||||
endif()
|
||||
@@ -108,10 +108,10 @@ if(USING_TI)
|
||||
endif()
|
||||
|
||||
if(USING_MSVC)
|
||||
set(JERRY_LIBM OFF)
|
||||
set(JERRY_MATH OFF)
|
||||
set(ENABLE_STRIP OFF)
|
||||
|
||||
set(JERRY_LIBM_MESSAGE " (FORCED BY COMPILER)")
|
||||
set(JERRY_MATH_MESSAGE " (FORCED BY COMPILER)")
|
||||
set(ENABLE_STRIP_MESSAGE " (FORCED BY COMPILER)")
|
||||
endif()
|
||||
|
||||
@@ -136,7 +136,7 @@ message(STATUS "JERRY_CMDLINE_SNAPSHOT " ${JERRY_CMDLINE_SNAPSHOT} ${JER
|
||||
message(STATUS "JERRY_LIBFUZZER " ${JERRY_LIBFUZZER} ${JERRY_LIBFUZZER_MESSAGE})
|
||||
message(STATUS "JERRY_PORT_DEFAULT " ${JERRY_PORT_DEFAULT} ${JERRY_PORT_DEFAULT_MESSAGE})
|
||||
message(STATUS "JERRY_EXT " ${JERRY_EXT} ${JERRY_EXT_MESSAGE})
|
||||
message(STATUS "JERRY_LIBM " ${JERRY_LIBM} ${JERRY_LIBM_MESSAGE})
|
||||
message(STATUS "JERRY_MATH " ${JERRY_MATH} ${JERRY_MATH_MESSAGE})
|
||||
message(STATUS "UNITTESTS " ${UNITTESTS})
|
||||
message(STATUS "DOCTESTS " ${DOCTESTS})
|
||||
|
||||
@@ -257,8 +257,8 @@ endif()
|
||||
add_custom_target(generate-single-source)
|
||||
|
||||
# Jerry's libm
|
||||
if(JERRY_LIBM)
|
||||
add_subdirectory(jerry-libm)
|
||||
if(JERRY_MATH)
|
||||
add_subdirectory(jerry-math)
|
||||
endif()
|
||||
|
||||
# Jerry's core
|
||||
@@ -282,8 +282,8 @@ endif()
|
||||
# Unittests
|
||||
if(UNITTESTS)
|
||||
add_subdirectory(tests/unit-core)
|
||||
if(JERRY_LIBM)
|
||||
add_subdirectory(tests/unit-libm)
|
||||
if(JERRY_MATH)
|
||||
add_subdirectory(tests/unit-math)
|
||||
endif()
|
||||
if(JERRY_EXT)
|
||||
add_subdirectory(tests/unit-ext)
|
||||
|
||||
@@ -286,7 +286,7 @@ a set of files into the `gen_src` directory (Note that the command is executed i
|
||||
but can be adapted to run outside of the project root dir):
|
||||
|
||||
```sh
|
||||
$ python tools/srcgenerator.py --output-dir gen_src --jerry-core --jerry-port-default --jerry-libm
|
||||
$ python tools/srcgenerator.py --output-dir gen_src --jerry-core --jerry-port-default --jerry-math
|
||||
```
|
||||
|
||||
The command creates the following files in the `gen_src` dir:
|
||||
@@ -296,7 +296,7 @@ The command creates the following files in the `gen_src` dir:
|
||||
* `jerryscript-config.h`
|
||||
* `jerryscript-port-default.c`
|
||||
* `jerryscript-port-default.h`
|
||||
* `jerryscript-libm.c`
|
||||
* `jerryscript-math.c`
|
||||
* `math.h`
|
||||
|
||||
**Important**: the `jerryscript-config.h` contains the configurations mentioned above and
|
||||
@@ -307,7 +307,7 @@ These files can be directly compiled with an application using the JerryScript A
|
||||
For example with the following command:
|
||||
|
||||
```sh
|
||||
$ gcc -Wall -o demo_app demo_app.c gen_src/jerryscript.c gen_src/jerryscript-port-default.c jerryscript-libm.c -Igen_src/
|
||||
$ gcc -Wall -o demo_app demo_app.c gen_src/jerryscript.c gen_src/jerryscript-port-default.c jerryscript-math.c -Igen_src/
|
||||
```
|
||||
|
||||
Please note that the headers must be available on the include path.
|
||||
|
||||
+11
-11
@@ -32,7 +32,7 @@ $ export PKG_CONFIG_PATH=$(pwd)/example_install/lib/pkgconfig/
|
||||
Test if the `pkg-config` works for JerryScript:
|
||||
|
||||
```sh
|
||||
$ pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-ext libjerry-libm
|
||||
$ pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-ext libjerry-math
|
||||
```
|
||||
|
||||
## Example 1. Execute JavaScript from your application
|
||||
@@ -58,7 +58,7 @@ main (void)
|
||||
To compile it one can use the following command:
|
||||
|
||||
```sh
|
||||
$ gcc api-example-1.c -o api-example-1 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-1.c -o api-example-1 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application returns with a zero exit code:
|
||||
@@ -118,7 +118,7 @@ main (void)
|
||||
To compile it one can use the following command:
|
||||
|
||||
```sh
|
||||
$ gcc api-example-2.c -o api-example-2 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-2.c -o api-example-2 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application returns with a zero exit code:
|
||||
@@ -181,7 +181,7 @@ main (void)
|
||||
To compile it one can use the following command:
|
||||
|
||||
```sh
|
||||
$ gcc api-example-3.c -o api-example-3 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-3.c -o api-example-3 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application returns with a zero exit code:
|
||||
@@ -285,7 +285,7 @@ main (void)
|
||||
To compile it one can use the following command:
|
||||
|
||||
```sh
|
||||
$ gcc api-example-4.c -o api-example-4 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-4.c -o api-example-4 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application should print out the message present in the `print_handler` method:
|
||||
@@ -405,7 +405,7 @@ main (void)
|
||||
To compile it one can use the following command:
|
||||
|
||||
```sh
|
||||
$ gcc api-example-5.c -o api-example-5 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-5.c -o api-example-5 $(pkg-config --cflags --libs libjerry-core libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application should print out the string passed for the `print` method in the JS code:
|
||||
@@ -473,7 +473,7 @@ To compile it one can use the following command:
|
||||
(**Note** that the `libjerry-ext` was added **before** the `libjerry-port-default` entry for the `pkg-config` call.
|
||||
|
||||
```sh
|
||||
$ gcc api-example-6.c -o api-example-6 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-6.c -o api-example-6 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
If everything is correct the application should print out the string passed for the `print` method in the JS code:
|
||||
@@ -549,7 +549,7 @@ To compile it one can use the following command:
|
||||
(**Note** that the `libjerry-ext` was added **before** the `libjerry-port-default` entry for the `pkg-config` call.
|
||||
|
||||
```sh
|
||||
$ gcc api-example-7.c -o api-example-7 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-7.c -o api-example-7 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
The sample will output 'Hello from C!'. However, now it is not just a part of the source script, but the value, dynamically supplied to the engine:
|
||||
@@ -822,7 +822,7 @@ To compile it one can use the following command:
|
||||
(**Note** that the `libjerry-ext` was added **before** the `libjerry-port-default` entry for the `pkg-config` call.
|
||||
|
||||
```sh
|
||||
$ gcc api-example-8-shell.c -o api-example-8-shell $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-8-shell.c -o api-example-8-shell $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
The application reads lines from standard input and evaluates them, one after another. To try out run:
|
||||
@@ -922,7 +922,7 @@ To compile it one can use the following command:
|
||||
(**Note** that the `libjerry-ext` was added **before** the `libjerry-port-default` entry for the `pkg-config` call.
|
||||
|
||||
```sh
|
||||
$ gcc api-example-9.c -o api-example-9 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-9.c -o api-example-9 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
Execute the example with:
|
||||
@@ -1053,7 +1053,7 @@ To compile it one can use the following command:
|
||||
(**Note** that the `libjerry-ext` was added **before** the `libjerry-port-default` entry for the `pkg-config` call.
|
||||
|
||||
```sh
|
||||
$ gcc api-example-10.c -o api-example-10 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-libm)
|
||||
$ gcc api-example-10.c -o api-example-10 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port-default libjerry-math)
|
||||
```
|
||||
|
||||
Execute the example with:
|
||||
|
||||
@@ -410,9 +410,9 @@ if(ENABLE_LTO)
|
||||
set(JERRY_CORE_PKGCONFIG_CFLAGS "${JERRY_CORE_PKGCONFIG_CFLAGS} -flto")
|
||||
endif()
|
||||
|
||||
if(JERRY_LIBM)
|
||||
target_link_libraries(${JERRY_CORE_NAME} jerry-libm)
|
||||
set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-libm)
|
||||
if(JERRY_MATH)
|
||||
target_link_libraries(${JERRY_CORE_NAME} jerry-math)
|
||||
set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-math)
|
||||
endif()
|
||||
|
||||
separate_arguments(EXTERNAL_LINK_LIBS)
|
||||
|
||||
@@ -13,55 +13,55 @@
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
set(JERRY_LIBM_NAME jerry-libm)
|
||||
project (${JERRY_LIBM_NAME} C)
|
||||
set(JERRY_MATH_NAME jerry-math)
|
||||
project (${JERRY_MATH_NAME} C)
|
||||
|
||||
# Compiler / linker flags
|
||||
# TODO: Reduce the below list of warning/error disablings as much as possible
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=sign-compare")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-error=sign-conversion")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-sign-conversion")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-sign-compare")
|
||||
set(COMPILE_FLAGS_LIBM "${COMPILE_FLAGS_LIBM} -Wno-strict-aliasing")
|
||||
set(COMPILE_FLAGS_MATH "${COMPILE_FLAGS_MATH} -Wno-error=sign-compare")
|
||||
set(COMPILE_FLAGS_MATH "${COMPILE_FLAGS_MATH} -Wno-error=sign-conversion")
|
||||
set(COMPILE_FLAGS_MATH "${COMPILE_FLAGS_MATH} -Wno-sign-conversion")
|
||||
set(COMPILE_FLAGS_MATH "${COMPILE_FLAGS_MATH} -Wno-sign-compare")
|
||||
set(COMPILE_FLAGS_MATH "${COMPILE_FLAGS_MATH} -Wno-strict-aliasing")
|
||||
|
||||
# Include directories
|
||||
set(INCLUDE_LIBM "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
set(INCLUDE_MATH "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
# Source directories
|
||||
file(GLOB SOURCE_LIBM *.c)
|
||||
file(GLOB SOURCE_MATH *.c)
|
||||
|
||||
# "Single" JerryScript libm source/header build.
|
||||
# The process will create the following files:
|
||||
# * jerryscript-libm.c
|
||||
# * jerryscript-math.c
|
||||
# * math.h
|
||||
if(ENABLE_ALL_IN_ONE_SOURCE)
|
||||
file(GLOB HEADER_LIBM *.h)
|
||||
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/src/jerryscript-libm.c")
|
||||
file(GLOB HEADER_MATH *.h)
|
||||
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/src/jerryscript-math.c")
|
||||
set(ALL_IN_FILE_H "${CMAKE_BINARY_DIR}/src/math.h")
|
||||
|
||||
add_custom_command(OUTPUT ${ALL_IN_FILE} ${ALL_IN_FILE_H} ${JERRYSCRIPT_CONFIG_H}
|
||||
COMMAND python ${CMAKE_SOURCE_DIR}/tools/srcgenerator.py
|
||||
--jerry-libm
|
||||
--jerry-math
|
||||
--output-dir ${CMAKE_BINARY_DIR}/src
|
||||
DEPENDS ${SOURCE_LIBM}
|
||||
${HEADER_LIBM}
|
||||
DEPENDS ${SOURCE_MATH}
|
||||
${HEADER_MATH}
|
||||
${CMAKE_SOURCE_DIR}/tools/srcgenerator.py
|
||||
${CMAKE_SOURCE_DIR}/tools/srcmerger.py
|
||||
)
|
||||
add_custom_target(generate-single-source-libm DEPENDS ${ALL_IN_FILE} ${ALL_IN_FILE_H})
|
||||
add_dependencies(generate-single-source generate-single-source-libm)
|
||||
add_custom_target(generate-single-source-math DEPENDS ${ALL_IN_FILE} ${ALL_IN_FILE_H})
|
||||
add_dependencies(generate-single-source generate-single-source-math)
|
||||
|
||||
set(SOURCE_LIBM ${ALL_IN_FILE} ${ALL_IN_FILE_H})
|
||||
set(SOURCE_MATH ${ALL_IN_FILE} ${ALL_IN_FILE_H})
|
||||
endif()
|
||||
|
||||
add_library(${JERRY_LIBM_NAME} ${SOURCE_LIBM})
|
||||
set_property(TARGET ${JERRY_LIBM_NAME}
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_LIBM}")
|
||||
add_library(${JERRY_MATH_NAME} ${SOURCE_MATH})
|
||||
set_property(TARGET ${JERRY_MATH_NAME}
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_MATH}")
|
||||
|
||||
target_include_directories(${JERRY_LIBM_NAME} PUBLIC ${INCLUDE_LIBM})
|
||||
target_include_directories(${JERRY_MATH_NAME} PUBLIC ${INCLUDE_MATH})
|
||||
|
||||
configure_file(libjerry-libm.pc.in libjerry-libm.pc @ONLY)
|
||||
configure_file(libjerry-math.pc.in libjerry-math.pc @ONLY)
|
||||
|
||||
install(TARGETS ${JERRY_LIBM_NAME} DESTINATION lib)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-libm.pc DESTINATION lib/pkgconfig)
|
||||
install(DIRECTORY ${INCLUDE_LIBM}/ DESTINATION include/jerryscript-libm)
|
||||
install(TARGETS ${JERRY_MATH_NAME} DESTINATION lib)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-math.pc DESTINATION lib/pkgconfig)
|
||||
install(DIRECTORY ${INCLUDE_MATH}/ DESTINATION include/jerryscript-math)
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_acos.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* acos(x)
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_acosh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* acosh(x)
|
||||
* Method :
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_asin.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* asin(x)
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_asinh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* asinh(x)
|
||||
* Method :
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_atan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* atan(x)
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_atan2.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* atan2(y,x)
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_atanh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* atanh(x)
|
||||
* Method :
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_cbrt.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* cbrt(x)
|
||||
* Return cube root of x
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_ceil.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* ceil(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_copysign.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* copysign(x,y) returns a value with the magnitude of x and
|
||||
* with the sign bit of y.
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_cosh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* cosh(x)
|
||||
* Method:
|
||||
@@ -24,7 +24,7 @@
|
||||
* @(#)e_exp.c 1.6 04/04/22
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* exp(x)
|
||||
* Returns the exponential of x.
|
||||
@@ -24,7 +24,7 @@
|
||||
* @(#)s_expm1.c 5.1 93/09/24
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* expm1(x)
|
||||
* Returns exp(x)-1, the exponential of x minus 1.
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_fabs.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* fabs(x) returns the absolute value of x.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_finite.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* finite(x) returns 1 is x is finite, else 0;
|
||||
* no branching!
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_floor.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* floor(x)
|
||||
* Return x rounded toward -inf to integral value
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_fmod.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* fmod(x,y)
|
||||
* Return x mod y in exact arithmetic
|
||||
@@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef JERRY_LIBM_MATH_H
|
||||
#define JERRY_LIBM_MATH_H
|
||||
#ifndef JERRY_MATH_H
|
||||
#define JERRY_MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@@ -92,4 +92,4 @@ double nextafter (double, double);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* !JERRY_LIBM_MATH_H */
|
||||
#endif /* !JERRY_MATH_H */
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_isnan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* isnan(x) returns 1 is x is nan, else 0;
|
||||
* no branching!
|
||||
@@ -24,8 +24,8 @@
|
||||
* @(#)fdlibm.h 1.5 04/04/22
|
||||
*/
|
||||
|
||||
#ifndef JERRY_LIBM_INTERNAL_H
|
||||
#define JERRY_LIBM_INTERNAL_H
|
||||
#ifndef JERRY_MATH_INTERNAL_H
|
||||
#define JERRY_MATH_INTERNAL_H
|
||||
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
@@ -123,4 +123,4 @@ double nextafter (double x, double y);
|
||||
double copysign (double x, double y);
|
||||
double scalbn (double x, int n);
|
||||
|
||||
#endif /* !JERRY_LIBM_INTERNAL_H */
|
||||
#endif /* !JERRY_MATH_INTERNAL_H */
|
||||
@@ -1,10 +1,10 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include/jerry-libm
|
||||
includedir=${prefix}/include/jerry-math
|
||||
|
||||
Name: libjerry-libm
|
||||
Name: libjerry-math
|
||||
Description: JerryScript: lightweight JavaScript engine (minimal math library)
|
||||
URL: https://github.com/jerryscript-project/jerryscript
|
||||
Version: @JERRY_VERSION@
|
||||
Libs: -L${libdir} -ljerry-libm
|
||||
Libs: -L${libdir} -ljerry-math
|
||||
Cflags: -I${includedir}
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_log.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* log(x)
|
||||
* Return the logrithm of x
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_log10.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* log10(x)
|
||||
* Return the base 10 logarithm of x
|
||||
@@ -24,7 +24,7 @@
|
||||
* @(#)s_log1p.c 5.1 93/09/24
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* log1p(x)
|
||||
* Method :
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_log2.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* log2(x)
|
||||
* Return the base 2 logarithm of x. See e_log.c and k_log.h for most
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_nextafter.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
double
|
||||
nextafter (double x,
|
||||
@@ -24,7 +24,7 @@
|
||||
* @(#)e_pow.c 1.5 04/04/22
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* pow(x,y) return x**y
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_scalbn.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* scalbn(x,n) returns x* 2**n computed by exponent
|
||||
* manipulation rather than by actually performing an
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_sinh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* __sinh(x)
|
||||
* Method:
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)e_sqrt.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* sqrt(x)
|
||||
* Return correctly rounded sqrt.
|
||||
@@ -25,7 +25,7 @@
|
||||
* @(#)s_tanh.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
/* tanh(x)
|
||||
* Return the Hyperbolic Tangent of x
|
||||
@@ -32,7 +32,7 @@
|
||||
* @(#)s_tan.c 1.3 95/01/18
|
||||
*/
|
||||
|
||||
#include "jerry-libm-internal.h"
|
||||
#include "jerry-math-internal.h"
|
||||
|
||||
#define zero 0.00000000000000000000e+00 /* 0x00000000, 0x00000000 */
|
||||
#define half 5.00000000000000000000e-01 /* 0x3FE00000, 0x00000000 */
|
||||
@@ -76,7 +76,7 @@ def build_jerry_data(jerry_path):
|
||||
"""
|
||||
jerry_sources = []
|
||||
jerry_dirs = set()
|
||||
for sub_dir in ['jerry-core', 'jerry-libm', os.path.join('targets', 'curie_bsp', 'source')]:
|
||||
for sub_dir in ['jerry-core', 'jerry-math', os.path.join('targets', 'curie_bsp', 'source')]:
|
||||
for file in find_sources(os.path.normpath(jerry_path), sub_dir):
|
||||
path = os.path.join('jerryscript', file)
|
||||
jerry_sources.append(path)
|
||||
@@ -198,7 +198,7 @@ def create_quark_kbuild(project_path, jerry_path):
|
||||
quark_include_paths = [
|
||||
'include',
|
||||
'jerryscript',
|
||||
os.path.join('jerryscript', 'jerry-libm', 'include'),
|
||||
os.path.join('jerryscript', 'jerry-math', 'include'),
|
||||
os.path.join('jerryscript', 'targets' ,'curie_bsp', 'include')
|
||||
] + list(jerry_data['dirs'])
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
This is a port for espressif's esp-idf (esp32). The LIBM, LTO and STRIP options should be disabled, so to build under the IDF toolchain, just run the following command
|
||||
This is a port for espressif's esp-idf (esp32). The MATH, LTO and STRIP options should be disabled, so to build under the IDF toolchain, just run the following command
|
||||
|
||||
```
|
||||
python tools\build.py --toolchain=cmake/toolchain-esp32.cmake --cmake-param "-GUnix Makefiles" --jerry-cmdline=OFF --jerry-port-default=OFF --jerry-libm=OFF --lto=OFF --strip=OFF
|
||||
python tools\build.py --toolchain=cmake/toolchain-esp32.cmake --cmake-param "-GUnix Makefiles" --jerry-cmdline=OFF --jerry-port-default=OFF --jerry-math=OFF --lto=OFF --strip=OFF
|
||||
```
|
||||
|
||||
NB: the LIBM, STRIP and LTO might be disabled by platform as well. I strongly suggest limiting heap memorry with '--mem-heap=128' but that really depends on the SRAM avaiulable on your esp32.
|
||||
NB: the MATH, STRIP and LTO might be disabled by platform as well. I strongly suggest limiting heap memorry with '--mem-heap=128' but that really depends on the SRAM avaiulable on your esp32.
|
||||
|
||||
Then copy the artefacts 'build/lib/\*.a' in an esp-idf component named 'jerryscript' (eg) and use a 'CMakeLists.txt' like this one
|
||||
|
||||
```
|
||||
# assumes there is a component with this the following
|
||||
# assumes there is a component with this the following
|
||||
# - set the JERRY_DIR wherever the jerryscript source code (the include files) is
|
||||
# - a "lib" directory with the 2 libraries below
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ LINKFLAGS_eagle.app.v6 = \
|
||||
-lwps \
|
||||
-L./libs \
|
||||
-ljerry-core \
|
||||
-ljerry-libm \
|
||||
-ljerry-math \
|
||||
$(DEP_LIBS_eagle.app.v6) \
|
||||
-Wl,--end-group
|
||||
|
||||
@@ -113,7 +113,7 @@ DEPENDS_eagle.app.v6 = \
|
||||
$(LDDIR)/eagle.rom.addr.v6.ld \
|
||||
./include/jerry-targetjs.h \
|
||||
./libs/libjerry-core.a \
|
||||
./libs/libjerry-libm.a
|
||||
./libs/libjerry-math.a
|
||||
|
||||
|
||||
#############################################################
|
||||
|
||||
@@ -55,9 +55,9 @@ jerry:
|
||||
-DEXTERNAL_COMPILE_FLAGS="$(ESP_CFLAGS)" \
|
||||
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
|
||||
|
||||
make -C$(BUILD_DIR) jerry-core jerry-libm
|
||||
make -C$(BUILD_DIR) jerry-core jerry-math
|
||||
cp $(BUILD_DIR)/lib/libjerry-core.a $(COPYTARGET)/
|
||||
cp $(BUILD_DIR)/lib/libjerry-libm.a $(COPYTARGET)/
|
||||
cp $(BUILD_DIR)/lib/libjerry-math.a $(COPYTARGET)/
|
||||
|
||||
js2c:
|
||||
tools/js2c.py --dest targets/esp8266/include --js-source targets/esp8266/js
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake/*
|
||||
docs/*
|
||||
jerry-libm/*
|
||||
jerry-main/*
|
||||
jerry-math/*
|
||||
jerry-port/default/default-date.c
|
||||
jerry-port/default/default-io.c
|
||||
targets/*
|
||||
|
||||
@@ -30,10 +30,10 @@ JERRYSCRIPT_ROOT_DIR ?= ../../../jerryscript
|
||||
CFLAGS += -std=c99
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-core/include
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-ext/include
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-libm/include
|
||||
CFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-math/include
|
||||
|
||||
# These libs should be copied from the JerryScript project.
|
||||
LIBS = libjerry-core.a libjerry-ext.a libjerry-libm.a
|
||||
LIBS = libjerry-core.a libjerry-ext.a libjerry-math.a
|
||||
|
||||
APPNAME = jerry
|
||||
ASRCS = setjmp.S
|
||||
|
||||
@@ -51,7 +51,7 @@ install: install-apt-get-deps install-noapt
|
||||
|
||||
# Build JerryScript.
|
||||
script-build-jerryscript:
|
||||
tools/build.py --clean --toolchain cmake/toolchain_mcu_stm32f4.cmake --profile=es.next --jerry-cmdline OFF --lto OFF --jerry-libm ON --all-in-one ON --jerry-port-default OFF --mem-heap 70 --compile-flag='--sysroot=../nuttx'
|
||||
tools/build.py --clean --toolchain cmake/toolchain_mcu_stm32f4.cmake --profile=es.next --jerry-cmdline OFF --lto OFF --jerry-math ON --all-in-one ON --jerry-port-default OFF --mem-heap 70 --compile-flag='--sysroot=../nuttx'
|
||||
|
||||
# Link in the NuttX JerryScript target directory under the NuttX apps tree.
|
||||
script-add-jerryscript-app:
|
||||
|
||||
@@ -41,7 +41,7 @@ jerryscript/tools/build.py \
|
||||
--clean \
|
||||
--lto=OFF \
|
||||
--jerry-cmdline=OFF \
|
||||
--jerry-libm=ON \
|
||||
--jerry-math=ON \
|
||||
--all-in-one=ON \
|
||||
--mem-heap=70 \
|
||||
--profile=es.next \
|
||||
|
||||
@@ -45,7 +45,7 @@ jerrycore:
|
||||
-DCMAKE_C_COMPILER_WORKS=TRUE \
|
||||
-DENABLE_LTO=ON \
|
||||
-DENABLE_ALL_IN_ONE=OFF \
|
||||
-DJERRY_LIBM=OFF \
|
||||
-DJERRY_MATH=OFF \
|
||||
-DJERRY_CMDLINE=OFF \
|
||||
-DJERRY_PROFILE=minimal \
|
||||
-DENABLE_STRIP=OFF \
|
||||
|
||||
@@ -47,7 +47,7 @@ libjerry:
|
||||
-DCMAKE_C_COMPILER_WORKS=TRUE \
|
||||
-DENABLE_LTO=OFF \
|
||||
-DENABLE_ALL_IN_ONE=OFF \
|
||||
-DJERRY_LIBM=OFF \
|
||||
-DJERRY_MATH=OFF \
|
||||
-DJERRY_CMDLINE=OFF \
|
||||
-DJERRY_PROFILE="es5.1" \
|
||||
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
|
||||
|
||||
@@ -42,7 +42,7 @@ make -f ./targets/riot-stm32f4/Makefile.riot
|
||||
This will generate the following libraries:
|
||||
```
|
||||
/build/bin/release.riotstm32f4/librelease.jerry-core.a
|
||||
/build/bin/release.riotstm32f4/librelease.jerry-libm.lib.a
|
||||
/build/bin/release.riotstm32f4/librelease.jerry-math.lib.a
|
||||
```
|
||||
|
||||
This will copy one library files to `targets/riot-stm32f4/bin` folder:
|
||||
|
||||
@@ -75,7 +75,7 @@ make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101
|
||||
This will generate the following libraries:
|
||||
```
|
||||
./build/arduino_101/librelease-cp_minimal.jerry-core.a
|
||||
./build/arduino_101/librelease-cp_minimal.jerry-libm.lib.a
|
||||
./build/arduino_101/librelease-cp_minimal.jerry-math.lib.a
|
||||
./build/arduino_101/librelease.external-cp_minimal-entry.a
|
||||
```
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (unit-libm C)
|
||||
project (unit-math C)
|
||||
|
||||
# Unit tests main modules
|
||||
file(GLOB SOURCE_UNIT_TEST_MAIN_MODULES *.c)
|
||||
|
||||
# Unit tests declaration
|
||||
add_custom_target(unittests-libm)
|
||||
add_custom_target(unittests-math)
|
||||
|
||||
foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)
|
||||
@@ -29,7 +29,7 @@ foreach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${LINKER_FLAGS_COMMON}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests")
|
||||
|
||||
target_link_libraries(${TARGET_NAME} jerry-libm)
|
||||
target_link_libraries(${TARGET_NAME} jerry-math)
|
||||
|
||||
add_dependencies(unittests-libm ${TARGET_NAME})
|
||||
add_dependencies(unittests-math ${TARGET_NAME})
|
||||
endforeach()
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unit test for jerry-libm
|
||||
* Unit test for jerry-math
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
@@ -90,7 +90,7 @@ int
|
||||
main (void)
|
||||
{
|
||||
#define INF INFINITY
|
||||
#include "test-libm.inc.h"
|
||||
#include "test-math.inc.h"
|
||||
|
||||
return passed ? 0 : 1;
|
||||
} /* main */
|
||||
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This file is automatically generated by the gen-test-libm.sh script.
|
||||
/* This file is automatically generated by the gen-test-math.sh script.
|
||||
* Do not edit! */
|
||||
|
||||
check_double ("acos (0.0)", acos (0.0), 1.57079632679489655800E+00);
|
||||
+3
-3
@@ -98,8 +98,8 @@ def get_arguments():
|
||||
help=devhelp('build jerry with libfuzzer support (%(choices)s)'))
|
||||
compgrp.add_argument('--jerry-ext', metavar='X', choices=['ON', 'OFF'], type=str.upper,
|
||||
help='build jerry-ext (%(choices)s)')
|
||||
compgrp.add_argument('--jerry-libm', metavar='X', choices=['ON', 'OFF'], type=str.upper,
|
||||
help='build and use jerry-libm (%(choices)s)')
|
||||
compgrp.add_argument('--jerry-math', metavar='X', choices=['ON', 'OFF'], type=str.upper,
|
||||
help='build and use jerry-math (%(choices)s)')
|
||||
compgrp.add_argument('--jerry-port-default', metavar='X', choices=['ON', 'OFF'], type=str.upper,
|
||||
help='build default jerry port implementation (%(choices)s)')
|
||||
compgrp.add_argument('--unittests', metavar='X', choices=['ON', 'OFF'], type=str.upper,
|
||||
@@ -189,7 +189,7 @@ def generate_build_options(arguments):
|
||||
build_options_append('JERRY_CMDLINE_TEST', arguments.jerry_cmdline_test)
|
||||
build_options_append('JERRY_LIBFUZZER', arguments.libfuzzer)
|
||||
build_options_append('JERRY_EXT', arguments.jerry_ext)
|
||||
build_options_append('JERRY_LIBM', arguments.jerry_libm)
|
||||
build_options_append('JERRY_MATH', arguments.jerry_math)
|
||||
build_options_append('JERRY_PORT_DEFAULT', arguments.jerry_port_default)
|
||||
build_options_append('UNITTESTS', arguments.unittests)
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ fi
|
||||
JERRY_CORE_DIRS=`find jerry-core -type d`
|
||||
JERRY_EXT_DIRS=`find jerry-ext -type d`
|
||||
JERRY_PORT_DIRS=`find jerry-port -type d`
|
||||
JERRY_LIBM_DIRS=`find jerry-libm -type d`
|
||||
JERRY_MATH_DIRS=`find jerry-math -type d`
|
||||
|
||||
|
||||
INCLUDE_DIRS=()
|
||||
for DIR in $JERRY_CORE_DIRS $JERRY_EXT_DIRS $JERRY_PORT_DIRS $JERRY_LIBM_DIRS
|
||||
for DIR in $JERRY_CORE_DIRS $JERRY_EXT_DIRS $JERRY_PORT_DIRS $JERRY_MATH_DIRS
|
||||
do
|
||||
INCLUDE_DIRS=("${INCLUDE_DIRS[@]}" "-I$DIR")
|
||||
done
|
||||
@@ -44,4 +44,4 @@ cppcheck -j$CPPCHECK_JOBS --force \
|
||||
--exitcode-suppressions=tools/cppcheck/suppressions-list \
|
||||
--suppressions-list=tools/cppcheck/suppressions-list \
|
||||
"${INCLUDE_DIRS[@]}" \
|
||||
jerry-core jerry-ext jerry-port jerry-libm jerry-main tests/unit-*
|
||||
jerry-core jerry-ext jerry-port jerry-math jerry-main tests/unit-*
|
||||
|
||||
@@ -42,7 +42,7 @@ INCLUDE_DIRS = [
|
||||
'cmake',
|
||||
'jerry-core',
|
||||
'jerry-ext',
|
||||
'jerry-libm',
|
||||
'jerry-math',
|
||||
'jerry-main',
|
||||
'jerry-port',
|
||||
'targets',
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.h"`
|
||||
JERRY_EXT_FILES=`find ./jerry-ext -name "*.c" -or -name "*.h"`
|
||||
JERRY_PORT_FILES=`find ./jerry-port -name "*.c" -or -name "*.h"`
|
||||
JERRY_LIBM_FILES=`find ./jerry-libm -name "*.c" -or -name "*.h"`
|
||||
JERRY_MATH_FILES=`find ./jerry-math -name "*.c" -or -name "*.h"`
|
||||
JERRY_MAIN_FILES=`find ./jerry-main -name "*.c" -or -name "*.h"`
|
||||
UNIT_TEST_FILES=`find ./tests/unit-* -name "*.c" -or -name "*.h"`
|
||||
|
||||
@@ -28,4 +28,4 @@ fi
|
||||
|
||||
vera++ -r tools/vera++ -p jerry \
|
||||
-e --no-duplicate \
|
||||
$MANUAL_CHECK_FILES $JERRY_CORE_FILES $JERRY_EXT_FILES $JERRY_PORT_FILES $JERRY_LIBM_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
|
||||
$MANUAL_CHECK_FILES $JERRY_CORE_FILES $JERRY_EXT_FILES $JERRY_PORT_FILES $JERRY_MATH_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
wrongmathcall:tests/unit-libm/test-libm.inc.h
|
||||
variableScope:jerry-libm/*.c
|
||||
invalidPointerCast:jerry-libm/*.c
|
||||
wrongmathcall:tests/unit-math/test-math.inc.h
|
||||
variableScope:jerry-math/*.c
|
||||
invalidPointerCast:jerry-math/*.c
|
||||
|
||||
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h
|
||||
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-helpers-macro-defines.inc.h
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
make -C tools/unit-tests build
|
||||
tools/unit-tests/gen-test-libm >tests/unit-libm/test-libm.inc.h
|
||||
tools/unit-tests/gen-test-math >tests/unit-math/test-math.inc.h
|
||||
make -C tools/unit-tests clean
|
||||
+2
-2
@@ -145,8 +145,8 @@ JERRY_BUILDOPTIONS = [
|
||||
platform.system() != 'Linux' or (platform.machine() != 'i386' and platform.machine() != 'x86_64'),
|
||||
'-m32 is only supported on x86[-64]-linux')
|
||||
),
|
||||
Options('buildoption_test-no_jerry_libm',
|
||||
['--jerry-libm=off', '--link-lib=m'],
|
||||
Options('buildoption_test-no_jerry_math',
|
||||
['--jerry-math=off', '--link-lib=m'],
|
||||
skip=skip_if((sys.platform == 'win32'), 'There is no separated libm on Windows')),
|
||||
Options('buildoption_test-no_lcache_prophashmap',
|
||||
['--compile-flag=-DJERRY_LCACHE=0', '--compile-flag=-DJERRY_PROPRETY_HASHMAP=0']),
|
||||
|
||||
+11
-11
@@ -27,7 +27,7 @@ ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||
SRCMERGER = os.path.join(TOOLS_DIR, 'srcmerger.py')
|
||||
JERRY_CORE = os.path.join(ROOT_DIR, 'jerry-core')
|
||||
JERRY_PORT = os.path.join(ROOT_DIR, 'jerry-port', 'default')
|
||||
JERRY_LIBM = os.path.join(ROOT_DIR, 'jerry-libm')
|
||||
JERRY_MATH = os.path.join(ROOT_DIR, 'jerry-math')
|
||||
|
||||
|
||||
def run_commands(*cmds, **kwargs):
|
||||
@@ -105,17 +105,17 @@ def generate_jerry_port_default(output_dir, verbose=False):
|
||||
run_commands(cmd_port_c_gen, cmd_port_h_gen, verbose=verbose)
|
||||
|
||||
|
||||
def generate_jerry_libm(output_dir, verbose=False):
|
||||
cmd_libm_c_gen = [
|
||||
def generate_jerry_math(output_dir, verbose=False):
|
||||
cmd_math_c_gen = [
|
||||
'python', SRCMERGER,
|
||||
'--base-dir', JERRY_LIBM,
|
||||
'--output={}/jerryscript-libm.c'.format(output_dir),
|
||||
'--base-dir', JERRY_MATH,
|
||||
'--output={}/jerryscript-math.c'.format(output_dir),
|
||||
'--append-c-files',
|
||||
]
|
||||
|
||||
run_commands(cmd_libm_c_gen, verbose=verbose)
|
||||
run_commands(cmd_math_c_gen, verbose=verbose)
|
||||
|
||||
shutil.copyfile('{}/include/math.h'.format(JERRY_LIBM),
|
||||
shutil.copyfile('{}/include/math.h'.format(JERRY_MATH),
|
||||
'{}/math.h'.format(output_dir))
|
||||
|
||||
def main():
|
||||
@@ -124,8 +124,8 @@ def main():
|
||||
help='Generate jerry-core files', default=False)
|
||||
parser.add_argument('--jerry-port-default', action='store_true', dest='jerry_port_default',
|
||||
help='Generate jerry-port-default files', default=False)
|
||||
parser.add_argument('--jerry-libm', action='store_true', dest='jerry_libm',
|
||||
help='Generate jerry-libm files', default=False)
|
||||
parser.add_argument('--jerry-math', action='store_true', dest='jerry_math',
|
||||
help='Generate jerry-math files', default=False)
|
||||
parser.add_argument('--output-dir', metavar='DIR', type=str, dest='output_dir',
|
||||
default='gen_src', help='Output dir')
|
||||
parser.add_argument('--verbose', '-v', action='store_true', default=False)
|
||||
@@ -146,8 +146,8 @@ def main():
|
||||
if args.jerry_port_default:
|
||||
generate_jerry_port_default(args.output_dir, args.verbose)
|
||||
|
||||
if args.jerry_libm:
|
||||
generate_jerry_libm(args.output_dir, args.verbose)
|
||||
if args.jerry_math:
|
||||
generate_jerry_math(args.output_dir, args.verbose)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
CC=gcc
|
||||
LDFLAGS=-lm
|
||||
|
||||
GENS=gen-test-libm
|
||||
GENS=gen-test-math
|
||||
|
||||
.PHONY: build
|
||||
build: $(GENS)
|
||||
@@ -24,5 +24,5 @@ build: $(GENS)
|
||||
clean:
|
||||
rm -f $(GENS)
|
||||
|
||||
gen-test-libm: gen-test-libm.c
|
||||
gen-test-math: gen-test-math.c
|
||||
$(CC) $< -o $@ $(LDFLAGS)
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Unit test generator for jerry-libm.
|
||||
* Unit test generator for jerry-math.
|
||||
* To be compiled separately from the rest of jerry and to be linked to a trusted libm.
|
||||
* Its output should be redirected to test-libm.inc.h.
|
||||
* Its output should be redirected to test-math.inc.h.
|
||||
*
|
||||
* Example:
|
||||
* gcc gen-test-libm.c -o gen-test-libm -lm
|
||||
* ./gen-test-libm >test-libm.inc.h
|
||||
* gcc gen-test-math.c -o gen-test-math -lm
|
||||
* ./gen-test-math >test-math.inc.h
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
@@ -47,7 +47,7 @@ main (int argc, char **args)
|
||||
" * limitations under the License.\n"
|
||||
" */\n"
|
||||
"\n"
|
||||
"/* This file is automatically generated by the gen-test-libm.sh script.\n"
|
||||
"/* This file is automatically generated by the gen-test-math.sh script.\n"
|
||||
" * Do not edit! */\n"
|
||||
"\n");
|
||||
|
||||
@@ -311,7 +311,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (ceil (-7.37e+19));
|
||||
|
||||
/* copysign tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
/* SKIPPED: not publicly declared in jerry-math
|
||||
GEN_DBL_TEST (copysign (0.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (0.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, 0.0));
|
||||
@@ -443,7 +443,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (fabs (-7.37e+19));
|
||||
|
||||
/* finite tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
/* SKIPPED: not publicly declared in jerry-math
|
||||
GEN_INT_TEST (finite (0.0));
|
||||
GEN_INT_TEST (finite (-0.0));
|
||||
GEN_INT_TEST (finite (1.0));
|
||||
@@ -743,7 +743,7 @@ main (int argc, char **args)
|
||||
GEN_DBL_TEST (pow (0.7, 1.2));
|
||||
|
||||
/* scalbn tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
/* SKIPPED: not publicly declared in jerry-math
|
||||
GEN_DBL_TEST (scalbn (0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (-0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (0.0, 1));
|
||||
Reference in New Issue
Block a user