File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 run : brew install cmake sdl2
2929
3030 - name : Configure
31- run : cmake -B build
31+ run : cmake -B build -DBUILD_ROBOT_TESTS=ON
3232
3333 - name : Build
3434 run : cmake --build build
Original file line number Diff line number Diff line change 4343
4444 - name : Configure with vcpkg
4545 run : |
46- cmake -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake"
46+ cmake -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake" -DBUILD_ROBOT_TESTS=ON
4747
4848 - name : Build
4949 run : cmake --build build --config Release
Original file line number Diff line number Diff line change @@ -9,13 +9,19 @@ set(CMAKE_CXX_EXTENSIONS OFF)
99# Library name
1010set (LIB_NAME RobotCPP)
1111
12- # Add GoogleTest
13- add_subdirectory (externals/googletest )
14- enable_testing ()
12+ # Option to build tests (OFF by default)
13+ option (BUILD_ROBOT_TESTS "Build the RobotCPP tests" OFF )
1514
16- # Find SDL2 for tests
17- set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/sdl2/" )
18- find_package (SDL2 REQUIRED )
15+ # Only find dependencies and add GoogleTest if tests are enabled
16+ if (BUILD_ROBOT_TESTS)
17+ # Add GoogleTest
18+ add_subdirectory (externals/googletest )
19+ enable_testing ()
20+
21+ # Find SDL2 for tests
22+ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake/sdl2/" )
23+ find_package (SDL2 REQUIRED )
24+ endif ()
1925
2026# Compiler-specific options
2127if (MSVC )
@@ -64,5 +70,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
6470set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} /bin)
6571set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} /bin)
6672
67- # Add the tests directory
68- add_subdirectory (tests )
73+ # Add the tests directory only if tests are enabled
74+ if (BUILD_ROBOT_TESTS)
75+ add_subdirectory (tests )
76+ endif ()
You can’t perform that action at this time.
0 commit comments