Compare commits
2
Commits
a885746fdd
...
6f54286724
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f54286724 | ||
|
|
fe5fcd7b96 |
@@ -8,6 +8,7 @@ add_compile_options(-Wall -Wextra -Werror=implicit-function-declaration)
|
|||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_compile_options(-fsanitize=address,undefined -g)
|
add_compile_options(-fsanitize=address,undefined -g)
|
||||||
add_link_options(-fsanitize=address,undefined)
|
add_link_options(-fsanitize=address,undefined)
|
||||||
|
set(FZL_TESTS TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
@@ -29,6 +30,7 @@ set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ${PREV_SUPPRESS_DEV} CACHE INTERNAL "")
|
|||||||
# --------------
|
# --------------
|
||||||
|
|
||||||
# Compiler
|
# Compiler
|
||||||
|
if (NOT FZL_SKIP_C)
|
||||||
add_executable(fzc
|
add_executable(fzc
|
||||||
src/compiler/utils/fzl_const_pool.c
|
src/compiler/utils/fzl_const_pool.c
|
||||||
src/compiler/utils/fzl_symtable.c
|
src/compiler/utils/fzl_symtable.c
|
||||||
@@ -93,8 +95,10 @@ add_executable(fzc
|
|||||||
src/compiler/fzl_walker.c
|
src/compiler/fzl_walker.c
|
||||||
src/compiler/fzl_writer.c
|
src/compiler/fzl_writer.c
|
||||||
src/compiler/main.c)
|
src/compiler/main.c)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Virtual machine
|
# Virtual machine
|
||||||
|
if (NOT FZL_SKIP_VM)
|
||||||
add_executable(fz
|
add_executable(fz
|
||||||
src/vm/handlers/group_and_or.c
|
src/vm/handlers/group_and_or.c
|
||||||
src/vm/handlers/group_cmp.c
|
src/vm/handlers/group_cmp.c
|
||||||
@@ -115,11 +119,25 @@ add_executable(fz
|
|||||||
src/vm/main.c)
|
src/vm/main.c)
|
||||||
|
|
||||||
target_link_libraries(fz PRIVATE ffi_static dl)
|
target_link_libraries(fz PRIVATE ffi_static dl)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#
|
||||||
|
# ========== Installtion ===========
|
||||||
|
#
|
||||||
|
|
||||||
|
if (NOT FZL_SKIP_C)
|
||||||
|
install (TARGETS fzc RUNTIME DESTINATION bin)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT FZL_SKIP_VM)
|
||||||
|
install (TARGETS fz RUNTIME DESTINATION bin)
|
||||||
|
endif ()
|
||||||
|
|
||||||
#
|
#
|
||||||
# ========== Tests ==========
|
# ========== Tests ==========
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if (FZL_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
file(GLOB TEST_PROGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "tests/programs/*.fzs")
|
file(GLOB TEST_PROGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "tests/programs/*.fzs")
|
||||||
@@ -144,4 +162,5 @@ foreach (TEST_FILE IN LISTS TEST_PROGS)
|
|||||||
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
|
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|||||||
@@ -7,34 +7,37 @@ MAX_ITER ?= 2000000
|
|||||||
|
|
||||||
current_time = python3 -c "import time; print(time.time())"
|
current_time = python3 -c "import time; print(time.time())"
|
||||||
|
|
||||||
build:
|
build-debug:
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
build-release:
|
build:
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release $(COMPARING)
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release $(COMPARING)
|
||||||
cmake --build build $(COMPARING)
|
cmake --build build $(COMPARING)
|
||||||
|
|
||||||
debug-c: build
|
install: build-release
|
||||||
|
cmake --install build
|
||||||
|
|
||||||
|
debug-c: build-debug
|
||||||
gdb --args ./build/fzc -v ${FILE}
|
gdb --args ./build/fzc -v ${FILE}
|
||||||
|
|
||||||
debug-vm: build
|
debug-vm: build-debug
|
||||||
gdb --args ./build/fz ${FILE}
|
gdb --args ./build/fz ${FILE}
|
||||||
|
|
||||||
|
test-debug: build-debug
|
||||||
|
ctest --output-on-failure --test-dir build
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
ctest --output-on-failure --test-dir build
|
ctest --output-on-failure --test-dir build
|
||||||
|
|
||||||
test-release: build-release
|
|
||||||
ctest --output-on-failure --test-dir build
|
|
||||||
|
|
||||||
bench: COMPARING=&>/dev/null
|
bench: COMPARING=&>/dev/null
|
||||||
bench: build-release
|
bench: build
|
||||||
@./build/fzc -o build/benchmark.fzb $(BENCH_FILE)
|
@./build/fzc -o build/benchmark.fzb $(BENCH_FILE)
|
||||||
@python3 scripts/benchmark.py --runs $(RUNS) --warmup $(WARMUP) \
|
@python3 scripts/benchmark.py --runs $(RUNS) --warmup $(WARMUP) \
|
||||||
--max-iter $(MAX_ITER) --vm ./build/fz --program build/benchmark.fzb
|
--max-iter $(MAX_ITER) --vm ./build/fz --program build/benchmark.fzb
|
||||||
|
|
||||||
compare: COMPARING=&>/dev/null
|
compare: COMPARING=&>/dev/null
|
||||||
compare: build-release
|
compare: build
|
||||||
@echo "=== Million sums benchmark ==="
|
@echo "=== Million sums benchmark ==="
|
||||||
|
|
||||||
@./build/fzc -o build/bench.fzb $(BENCH_FILE) 1>/dev/null 2>/dev/null
|
@./build/fzc -o build/bench.fzb $(BENCH_FILE) 1>/dev/null 2>/dev/null
|
||||||
|
|||||||
+2
-6
@@ -27,12 +27,8 @@
|
|||||||
## Инструкции по сборке
|
## Инструкции по сборке
|
||||||
|
|
||||||
1. Склонировать проект: `git clone https://git.samsonium.dev/samsonium/fz-lang.git`
|
1. Склонировать проект: `git clone https://git.samsonium.dev/samsonium/fz-lang.git`
|
||||||
2. Собрать проект: `make build-release`
|
2. Собрать проект: `make build`
|
||||||
|
3. Установить проект: `sudo make install`
|
||||||
После этого в корне появится директория **"build"**. В ней будут лежать два скомпилированных бинарных файла:
|
|
||||||
|
|
||||||
- `fzc` - компилятор
|
|
||||||
- `fz` - виртуальная машина
|
|
||||||
|
|
||||||
Оба бинарных файла предоставляют справку по использованию при запуске с флагом `--help` (или `-h`).
|
Оба бинарных файла предоставляют справку по использованию при запуске с флагом `--help` (или `-h`).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user