Main+Meta: Allow compilation of each step without source changes
This commit is contained in:
+37
-16
@@ -2,7 +2,7 @@
|
|||||||
# User config between these lines
|
# User config between these lines
|
||||||
|
|
||||||
# Set project name
|
# Set project name
|
||||||
set(PROJECT "blaze")
|
set(PROJECT "stepA_mal")
|
||||||
|
|
||||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
set(BLAZE_STANDALONE TRUE)
|
set(BLAZE_STANDALONE TRUE)
|
||||||
@@ -64,11 +64,26 @@ add_subdirectory("vendor/ruc")
|
|||||||
|
|
||||||
# Define source files
|
# Define source files
|
||||||
file(GLOB_RECURSE PROJECT_SOURCES "src/*.cpp")
|
file(GLOB_RECURSE PROJECT_SOURCES "src/*.cpp")
|
||||||
|
file(GLOB_RECURSE EXCLUDED_SOURCES "src/step*.cpp")
|
||||||
|
list(REMOVE_ITEM PROJECT_SOURCES ${EXCLUDED_SOURCES})
|
||||||
|
|
||||||
add_executable(${PROJECT} ${PROJECT_SOURCES})
|
function(add_step TARGET_NAME MAIN_PATH)
|
||||||
target_include_directories(${PROJECT} PRIVATE
|
add_executable(${TARGET_NAME} ${PROJECT_SOURCES} ${MAIN_PATH})
|
||||||
"src")
|
target_include_directories(${TARGET_NAME} PRIVATE "src")
|
||||||
target_link_libraries(${PROJECT} readline ruc)
|
target_link_libraries(${TARGET_NAME} readline ruc)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
add_step(step0_repl "src/step0_repl.cpp")
|
||||||
|
add_step(step1_read_print "src/step1_read_print.cpp")
|
||||||
|
add_step(step2_eval "src/step2_eval.cpp")
|
||||||
|
add_step(step3_env "src/step3_env.cpp")
|
||||||
|
add_step(step4_if_fn_do "src/step4_if_fn_do.cpp")
|
||||||
|
add_step(step5_tco "src/step5_tco.cpp")
|
||||||
|
add_step(step6_file "src/step6_file.cpp")
|
||||||
|
add_step(step7_quote "src/step7_quote.cpp")
|
||||||
|
add_step(step8_macros "src/step8_macros.cpp")
|
||||||
|
add_step(step9_try "src/step9_try.cpp")
|
||||||
|
add_step(stepA_mal "src/stepA_mal.cpp")
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
# Execute target
|
# Execute target
|
||||||
@@ -81,45 +96,51 @@ add_custom_target(run
|
|||||||
# Test targets
|
# Test targets
|
||||||
|
|
||||||
add_custom_target(test0
|
add_custom_target(test0
|
||||||
COMMAND env STEP=step0_repl MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step0_repl.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step0_repl.mal -- ./${PROJECT})
|
||||||
add_dependencies(test0 ${PROJECT})
|
add_dependencies(test0 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test1
|
add_custom_target(test1
|
||||||
COMMAND env STEP=step1_read_print MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step1_read_print.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step1_read_print.mal -- ./${PROJECT})
|
||||||
add_dependencies(test1 ${PROJECT})
|
add_dependencies(test1 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test2
|
add_custom_target(test2
|
||||||
COMMAND env STEP=step_eval MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step2_eval.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step2_eval.mal -- ./${PROJECT})
|
||||||
add_dependencies(test2 ${PROJECT})
|
add_dependencies(test2 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test3
|
add_custom_target(test3
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step3_env.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step3_env.mal -- ./${PROJECT})
|
||||||
add_dependencies(test3 ${PROJECT})
|
add_dependencies(test3 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test4
|
add_custom_target(test4
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step4_if_fn_do.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step4_if_fn_do.mal -- ./${PROJECT})
|
||||||
add_dependencies(test4 ${PROJECT})
|
add_dependencies(test4 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test5
|
add_custom_target(test5
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step5_tco.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step5_tco.mal -- ./${PROJECT})
|
||||||
add_dependencies(test5 ${PROJECT})
|
add_dependencies(test5 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test6
|
add_custom_target(test6
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step6_file.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step6_file.mal -- ./${PROJECT})
|
||||||
add_dependencies(test6 ${PROJECT})
|
add_dependencies(test6 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test7
|
add_custom_target(test7
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step7_quote.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step7_quote.mal -- ./${PROJECT})
|
||||||
add_dependencies(test7 ${PROJECT})
|
add_dependencies(test7 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test8
|
add_custom_target(test8
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step8_macros.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step8_macros.mal -- ./${PROJECT})
|
||||||
add_dependencies(test8 ${PROJECT})
|
add_dependencies(test8 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(test9
|
add_custom_target(test9
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/step9_try.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/step9_try.mal -- ./${PROJECT})
|
||||||
add_dependencies(test9 ${PROJECT})
|
add_dependencies(test9 ${PROJECT})
|
||||||
|
|
||||||
add_custom_target(testA
|
add_custom_target(testA
|
||||||
COMMAND env STEP=step_env MAL_IMPL=js ../vendor/mal/runtest.py --deferrable --optional ../vendor/mal/tests/stepA_mal.mal -- ./${PROJECT})
|
COMMAND ../vendor/mal/runtest.py --deferrable --optional ../tests/stepA_mal.mal -- ./${PROJECT})
|
||||||
add_dependencies(testA ${PROJECT})
|
add_dependencies(testA ${PROJECT})
|
||||||
|
|
||||||
|
add_custom_target(perf
|
||||||
|
COMMAND ./${PROJECT} ../tests/perf1.mal
|
||||||
|
COMMAND ./${PROJECT} ../tests/perf2.mal
|
||||||
|
COMMAND ./${PROJECT} ../tests/perf3.mal)
|
||||||
|
add_dependencies(perf ${PROJECT})
|
||||||
|
|||||||
+3
-2
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "forward.h"
|
#include "forward.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
auto read(std::string_view data) -> std::string_view
|
auto read(std::string_view data) -> std::string_view
|
||||||
{
|
{
|
||||||
return data;
|
return data;
|
||||||
@@ -57,5 +56,7 @@ auto eval(ValuePtr, EnvironmentPtr) -> ValuePtr
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
|
||||||
} // namespace blaze
|
} // namespace blaze
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
|
|
||||||
auto read(std::string_view input) -> ValuePtr
|
auto read(std::string_view input) -> ValuePtr
|
||||||
@@ -108,4 +107,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -17,7 +17,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
||||||
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
@@ -112,4 +111,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -17,7 +17,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
||||||
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
@@ -112,4 +111,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
||||||
|
|
||||||
static auto cleanup(int signal) -> void;
|
static auto cleanup(int signal) -> void;
|
||||||
@@ -129,4 +128,8 @@ static auto print(blaze::ValuePtr exp) -> std::string
|
|||||||
|
|
||||||
return printer.print(exp, true);
|
return printer.print(exp, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -23,7 +23,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
static blaze::EnvironmentPtr s_outer_env = blaze::Environment::create();
|
||||||
|
|
||||||
static auto cleanup(int signal) -> void;
|
static auto cleanup(int signal) -> void;
|
||||||
@@ -135,4 +134,8 @@ static auto print(blaze::ValuePtr exp) -> std::string
|
|||||||
|
|
||||||
return printer.print(exp, true);
|
return printer.print(exp, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -24,7 +24,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
|
|
||||||
static EnvironmentPtr s_outer_env = Environment::create();
|
static EnvironmentPtr s_outer_env = Environment::create();
|
||||||
@@ -156,4 +155,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -24,7 +24,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
|
|
||||||
static EnvironmentPtr s_outer_env = Environment::create();
|
static EnvironmentPtr s_outer_env = Environment::create();
|
||||||
@@ -156,4 +155,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
|
|
||||||
static EnvironmentPtr s_outer_env = Environment::create();
|
static EnvironmentPtr s_outer_env = Environment::create();
|
||||||
@@ -163,4 +162,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
+5
-2
@@ -24,7 +24,6 @@
|
|||||||
#include "readline.h"
|
#include "readline.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
namespace blaze {
|
namespace blaze {
|
||||||
|
|
||||||
static EnvironmentPtr s_outer_env = Environment::create();
|
static EnvironmentPtr s_outer_env = Environment::create();
|
||||||
@@ -166,4 +165,8 @@ auto main(int argc, char* argv[]) -> int
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// Added to keep the linker happy at step A
|
||||||
|
namespace blaze {
|
||||||
|
ValuePtr readline(const std::string&) { return nullptr; }
|
||||||
|
} // namespace blaze
|
||||||
|
|||||||
Reference in New Issue
Block a user