From 09600801287ee5f219c4389688f81ec3b5ab5404 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 11 Nov 2020 21:07:19 -0800 Subject: [PATCH] Split CMake project into several files --- src/CMakeLists.txt | 16 +--------------- src/com/craftinginterpreters/CMakeLists.txt | 2 ++ src/com/craftinginterpreters/lox/.gitignore | 1 + src/com/craftinginterpreters/lox/CMakeLists.txt | 16 ++++++++++++++++ src/com/craftinginterpreters/tool/CMakeLists.txt | 3 +++ 5 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 src/com/craftinginterpreters/CMakeLists.txt create mode 100644 src/com/craftinginterpreters/lox/.gitignore create mode 100644 src/com/craftinginterpreters/lox/CMakeLists.txt create mode 100644 src/com/craftinginterpreters/tool/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5f8a66..6082e0a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,18 +5,4 @@ include(UseJava) project(Lox NONE) -add_custom_command(OUTPUT com/craftinginterpreters/lox/Expr.java - 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) +add_subdirectory(com/craftinginterpreters) diff --git a/src/com/craftinginterpreters/CMakeLists.txt b/src/com/craftinginterpreters/CMakeLists.txt new file mode 100644 index 0000000..959eedd --- /dev/null +++ b/src/com/craftinginterpreters/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(tool) +add_subdirectory(lox) diff --git a/src/com/craftinginterpreters/lox/.gitignore b/src/com/craftinginterpreters/lox/.gitignore new file mode 100644 index 0000000..0260b11 --- /dev/null +++ b/src/com/craftinginterpreters/lox/.gitignore @@ -0,0 +1 @@ +Expr.java diff --git a/src/com/craftinginterpreters/lox/CMakeLists.txt b/src/com/craftinginterpreters/lox/CMakeLists.txt new file mode 100644 index 0000000..d2807e6 --- /dev/null +++ b/src/com/craftinginterpreters/lox/CMakeLists.txt @@ -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) diff --git a/src/com/craftinginterpreters/tool/CMakeLists.txt b/src/com/craftinginterpreters/tool/CMakeLists.txt new file mode 100644 index 0000000..b98d2eb --- /dev/null +++ b/src/com/craftinginterpreters/tool/CMakeLists.txt @@ -0,0 +1,3 @@ +add_jar(GenerateAst + GenerateAst.java + ENTRY_POINT com/craftinginterpreters/tool/GenerateAst)