mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Check-in all generated C files
Closes: https://github.com/quickjs-ng/quickjs/issues/262
This commit is contained in:
parent
7ded62c536
commit
7f928d289f
8 changed files with 27 additions and 51 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -15,6 +15,15 @@ on:
|
|||
- master
|
||||
|
||||
jobs:
|
||||
codegen:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: build
|
||||
run: |
|
||||
make codegen
|
||||
- name: Check if the git repository is clean
|
||||
run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1)
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
|
|
@ -5,9 +5,6 @@ project(quickjs LANGUAGES C)
|
|||
include(CheckCCompilerFlag)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# TODO:
|
||||
# - Support cross-compilation
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS ON)
|
||||
|
@ -183,19 +180,10 @@ target_link_libraries(qjsc ${qjs_libs})
|
|||
# QuickJS CLI
|
||||
#
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT repl.c
|
||||
COMMAND qjsc -o ./repl.c -m ${CMAKE_CURRENT_SOURCE_DIR}/repl.js
|
||||
DEPENDS qjsc
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compile repl.js to bytecode"
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/repl.js
|
||||
)
|
||||
|
||||
add_executable(qjs_exe
|
||||
gen/repl.c
|
||||
qjs.c
|
||||
quickjs-libc.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/repl.c
|
||||
)
|
||||
set_target_properties(qjs_exe PROPERTIES
|
||||
OUTPUT_NAME "qjs"
|
||||
|
@ -236,16 +224,8 @@ add_executable(unicode_gen EXCLUDE_FROM_ALL
|
|||
)
|
||||
target_compile_definitions(unicode_gen PRIVATE ${qjs_defines})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT function_source.c
|
||||
COMMAND qjsc -e -o function_source.c ${CMAKE_CURRENT_SOURCE_DIR}/tests/function_source.js
|
||||
DEPENDS qjsc ${CMAKE_CURRENT_SOURCE_DIR}/tests/function_source.js
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compile function_source.js to a C file with bytecode embedded"
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tests/function_source.js
|
||||
)
|
||||
add_executable(function_source
|
||||
${CMAKE_CURRENT_BINARY_DIR}/function_source.c
|
||||
gen/function_source.c
|
||||
quickjs-libc.c
|
||||
)
|
||||
target_include_directories(function_source PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -256,32 +236,16 @@ target_link_libraries(function_source ${qjs_libs})
|
|||
#
|
||||
|
||||
if(BUILD_EXAMPLES AND NOT WIN32)
|
||||
add_custom_command(
|
||||
OUTPUT hello.c
|
||||
COMMAND qjsc -e -o hello.c ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello.js
|
||||
DEPENDS qjsc
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compile hello.js to a C file with bytecode embedded"
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello.js
|
||||
)
|
||||
add_executable(hello
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hello.c
|
||||
gen/hello.c
|
||||
quickjs-libc.c
|
||||
)
|
||||
target_include_directories(hello PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_compile_definitions(hello PRIVATE ${qjs_defines})
|
||||
target_link_libraries(hello ${qjs_libs})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT hello_module.c
|
||||
COMMAND qjsc -e -o hello_module.c -m ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello_module.js
|
||||
DEPENDS qjsc
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compile hello_module.js to a C file with bytecode embedded"
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/examples/hello_module.js
|
||||
)
|
||||
add_executable(hello_module
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hello_module.c
|
||||
gen/hello_module.c
|
||||
quickjs-libc.c
|
||||
)
|
||||
target_include_directories(hello_module PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -320,17 +284,9 @@ if(BUILD_EXAMPLES AND NOT WIN32)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT test_fib.c
|
||||
COMMAND qjsc -e -o test_fib.c -M ${CMAKE_CURRENT_SOURCE_DIR}/examples/fib.so,fib -m ${CMAKE_CURRENT_SOURCE_DIR}/examples/test_fib.js
|
||||
DEPENDS qjsc
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Compile test_fib.js to a C file with bytecode embedded"
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/examples/test_fib.js
|
||||
)
|
||||
add_executable(test_fib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_fib.c
|
||||
examples/fib.c
|
||||
gen/test_fib.c
|
||||
quickjs-libc.c
|
||||
)
|
||||
target_include_directories(test_fib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
|
15
Makefile
15
Makefile
|
@ -28,6 +28,7 @@ BUILD_DIR=build
|
|||
BUILD_TYPE?=Release
|
||||
|
||||
QJS=$(BUILD_DIR)/qjs
|
||||
QJSC=$(BUILD_DIR)/qjsc
|
||||
RUN262=$(BUILD_DIR)/run-test262
|
||||
|
||||
JOBS?=$(shell getconf _NPROCESSORS_ONLN)
|
||||
|
@ -49,12 +50,22 @@ $(BUILD_DIR):
|
|||
$(QJS): $(BUILD_DIR)
|
||||
cmake --build $(BUILD_DIR) -j $(JOBS)
|
||||
|
||||
install: $(QJS)
|
||||
$(QJSC): $(BUILD_DIR)
|
||||
cmake --build $(BUILD_DIR) --target qjsc -j $(JOBS)
|
||||
|
||||
install: $(QJS) $(QJSC)
|
||||
cmake --build $(BUILD_DIR) --target install
|
||||
|
||||
clean:
|
||||
cmake --build $(BUILD_DIR) --target clean
|
||||
|
||||
codegen: $(QJSC)
|
||||
$(QJSC) -o gen/repl.c -m repl.js
|
||||
$(QJSC) -e -o gen/function_source.c tests/function_source.js
|
||||
$(QJSC) -e -o gen/hello.c examples/hello.js
|
||||
$(QJSC) -e -o gen/hello_module.c -m examples/hello_module.js
|
||||
$(QJSC) -e -o gen/test_fib.c -M examples/fib.so,fib -m examples/test_fib.js
|
||||
|
||||
debug:
|
||||
BUILD_TYPE=Debug $(MAKE)
|
||||
|
||||
|
@ -92,4 +103,4 @@ unicode_gen: $(BUILD_DIR)
|
|||
libunicode-table.h: unicode_gen
|
||||
$(BUILD_DIR)/unicode_gen unicode $@
|
||||
|
||||
.PHONY: all debug install clean distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS)
|
||||
.PHONY: all debug install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
|
||||
|
|
BIN
gen/function_source.c
Normal file
BIN
gen/function_source.c
Normal file
Binary file not shown.
BIN
gen/hello.c
Normal file
BIN
gen/hello.c
Normal file
Binary file not shown.
BIN
gen/hello_module.c
Normal file
BIN
gen/hello_module.c
Normal file
Binary file not shown.
BIN
gen/repl.c
Normal file
BIN
gen/repl.c
Normal file
Binary file not shown.
BIN
gen/test_fib.c
Normal file
BIN
gen/test_fib.c
Normal file
Binary file not shown.
Loading…
Reference in a new issue