Split CMake project into several files

This commit is contained in:
Tom Willemse 2020-11-11 21:07:19 -08:00
parent f6cdbabe1c
commit 0960080128
5 changed files with 23 additions and 15 deletions

View file

@ -5,18 +5,4 @@ include(UseJava)
project(Lox NONE) project(Lox NONE)
add_custom_command(OUTPUT com/craftinginterpreters/lox/Expr.java add_subdirectory(com/craftinginterpreters)
COMMAND java -jar GenerateAst.jar com/craftinginterpreters/lox
DEPENDS GenerateAst)
add_jar(Lox
com/craftinginterpreters/lox/Lox.java
com/craftinginterpreters/lox/TokenType.java
com/craftinginterpreters/lox/Token.java
com/craftinginterpreters/lox/Expr.java
com/craftinginterpreters/lox/AstPrinter.java
ENTRY_POINT com/craftinginterpreters/lox/Lox)
add_jar(GenerateAst
com/craftinginterpreters/tool/GenerateAst.java
ENTRY_POINT com/craftinginterpreters/tool/GenerateAst)

View file

@ -0,0 +1,2 @@
add_subdirectory(tool)
add_subdirectory(lox)

View file

@ -0,0 +1 @@
Expr.java

View file

@ -0,0 +1,16 @@
get_target_property(GENERATE_AST_JAR GenerateAst JAR_FILE)
set(EXPR_JAVA_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/Expr.java CACHE INTERNAL "")
add_custom_command(OUTPUT ${EXPR_JAVA_FILENAME}
COMMAND java -jar ${GENERATE_AST_JAR} ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS GenerateAst)
add_jar(Lox
Lox.java
TokenType.java
Token.java
Scanner.java
${EXPR_JAVA_FILENAME}
AstPrinter.java
ENTRY_POINT com/craftinginterpreters/lox/Lox)

View file

@ -0,0 +1,3 @@
add_jar(GenerateAst
GenerateAst.java
ENTRY_POINT com/craftinginterpreters/tool/GenerateAst)