diff --git a/.gitignore b/.gitignore index dc1d2fe..5467a52 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ banana_test *.a *.asm *.so +build \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a27fde6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/googletest"] + path = lib/googletest + url = https://github.com/google/googletest diff --git a/CMakeLists.txt b/CMakeLists.txt index af51c87..b96df99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,12 +16,6 @@ target_link_libraries(banana -lffi banana_lib) add_executable(assembler src/assembler.cpp) target_link_libraries(assembler -lffi banana_lib) +add_subdirectory(lib/googletest) add_executable(banana_test src/banana_test.cpp) -target_link_libraries(banana_test -lffi banana_lib) - -# gtest -include(FetchContent) -FetchContent_Declare(googletest URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip) -FetchContent_MakeAvailable(googletest) -target_link_libraries(banana_test gtest_main) -add_test(BananaTest banana_test) +target_link_libraries(banana_test -lffi banana_lib gtest_main) diff --git a/lib/googletest b/lib/googletest new file mode 160000 index 0000000..8a6feab --- /dev/null +++ b/lib/googletest @@ -0,0 +1 @@ +Subproject commit 8a6feabf04bec8fb125e0df0ad1195c42350725f diff --git a/src/banana_test.cpp b/src/banana_test.cpp index 43a7a8f..8e162e5 100644 --- a/src/banana_test.cpp +++ b/src/banana_test.cpp @@ -1,10 +1,10 @@ #include #include +#include #include "lib/ast.h" #include "lib/scanner.h" #include "lib/parser.h" #include "lib/vm.h" -#include "gtest/gtest.h" namespace { std::string exe(const std::string& code, const std::vector& shared_libraries = std::vector()) {