Update compile.sh (using cmake)
This commit is contained in:
parent
bdc480a7c9
commit
d4b1a69bec
|
@ -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)
|
||||||
|
|
19
compile.sh
19
compile.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue