diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-04-12 13:04:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-12 13:04:10 -0400 |
commit | 561f7a6e6c24b05383b6db86b48125ee80a8355f (patch) | |
tree | 6acbfd27652c2b83686df93c21918a877a0451e8 /CMakeLists.txt | |
parent | c9e35a8f3aa2047701e87a50f12b4bed23d5e7db (diff) | |
parent | 3ae113c7d6f1b6f46d8960b284837a44fbeb2e77 (diff) |
Merge pull request #50 from bdunahu/bdunahu
Move storage to a separate git repository.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9daac12..cb614b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,36 @@ cmake_minimum_required(VERSION 3.5) -set(CMAKE_CXX_COMPILER "g++") project(risc_vector) +find_package(Git QUIET) +if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --remote --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() +endif() + +if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ram/CMakeLists.txt") + message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.") +endif() + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_compile_options(-Wall -lstdc++ -g -O0) add_compile_options(-Wextra -Wpedantic) +set(RAM ram) + # cpp standard set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# header files -include_directories( - ${PROJECT_SOURCE_DIR}/inc -) +# don't build RAM's tests +set(RAM_TESTS OF CACHE BOOL "" FORCE) -# add gui +# add submodules +add_subdirectory(${RAM}) add_subdirectory(gui) # gather source files @@ -28,7 +42,8 @@ qt_standard_project_setup() # binary executable add_library(${PROJECT_NAME}_lib ${SRCS}) -target_link_libraries(${PROJECT_NAME}_lib) +target_include_directories(${PROJECT_NAME}_lib PRIVATE ${PROJECT_SOURCE_DIR}/inc) +target_link_libraries(${PROJECT_NAME}_lib ${RAM}_lib) find_package(Catch2 REQUIRED) @@ -36,10 +51,11 @@ find_package(Catch2 REQUIRED) file(GLOB_RECURSE TESTS "tests/*.cc") # test executable -add_executable(tests ${SRCS} ${TESTS}) -target_link_libraries(tests PRIVATE Catch2::Catch2WithMain PRIVATE) +add_executable(test_rv ${SRCS} ${TESTS}) +target_include_directories(test_rv PRIVATE ${PROJECT_SOURCE_DIR}/inc) +target_link_libraries(test_rv PRIVATE Catch2::Catch2WithMain PRIVATE ${RAM}_lib) # test discovery include(CTest) include(Catch) -catch_discover_tests(tests) +catch_discover_tests(test_rv) |