Update compile.sh (using cmake)

This commit is contained in:
Santiago Lo Coco 2022-04-19 13:16:20 -03:00
parent bdc480a7c9
commit d4b1a69bec
2 changed files with 14 additions and 13 deletions

View File

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
# Nombre del proyecto, y lenguaje usado (C, en este caso): # Nombre del proyecto, y lenguaje usado (C, en este caso):
project(Compiler C) project(BFBCompiler C)
# Compilar el parser con Bison: # Compilar el parser con Bison:
add_custom_command( add_custom_command(
@ -46,7 +46,7 @@ else ()
endif () endif ()
# Especificar punto de entrada del proyecto y códigos fuente (extensión *.c): # Especificar punto de entrada del proyecto y códigos fuente (extensión *.c):
add_executable(Compiler add_executable(BFBCompiler
src/main.c src/main.c
src/backend/code-generation/generator.c src/backend/code-generation/generator.c
src/backend/domain-specific/calculator.c src/backend/domain-specific/calculator.c
@ -57,4 +57,4 @@ add_executable(Compiler
src/frontend/syntactic-analysis/bison-parser.c) src/frontend/syntactic-analysis/bison-parser.c)
# Linkear el proyecto y sus librerías: # Linkear el proyecto y sus librerías:
target_link_libraries(Compiler) target_link_libraries(BFBCompiler)

View File

@ -1,12 +1,13 @@
#!/bin/sh #!/bin/sh
rm -f src/frontend/lexical-analysis/flex-scanner.c src/frontend/syntactic-analysis/bison-parser.c src/frontend/syntactic-analysis/bison-parser.h if [ ! -d "bin" ]; then
rm -rf bin cmake -S . -B bin
cmake -S . -B bin fi
cd bin
make cmake --build bin --clean-first
if [ -f "../$1" ]; then
cat "../$1" | ./Compiler if [ -f "$1" ]; then
else cat "$1" | ./bin/BFBCompiler
echo "$1" | ./Compiler else
echo "$1" | ./bin/BFBCompiler
fi fi