Skip to content

Commit deee5f7

Browse files
Add debug builds to CI (#36)
* Build debug, correctly handle CMAKE_BUILD_TYPE * Update README to reflect new flag for release builds * Bump CMAKE min version to 3.5 to address deprecation warnings * Mark val as [[maybe_unused]] to remove warnings when compiling in release mode * Improve wording re: release and debug builds * Update README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 5c510f3 commit deee5f7

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

.github/workflows/cmake-multi-platform.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
matrix:
2222
os: [ubuntu-latest, macos-latest]
23-
build_type: [Release]
23+
build_type: [Release, Debug]
2424

2525
steps:
2626
- uses: actions/checkout@v4

CMakeLists.txt

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 3.5)
22

33
project(autolab-cli)
44

@@ -11,15 +11,20 @@ set(variant "" CACHE STRING "build variant")
1111
# command line options
1212
option(release "build release version (no debug output)" OFF)
1313

14-
if(NOT release)
15-
# build debug
16-
set(CMAKE_BUILD_TYPE Debug)
14+
# Existing CMAKE_BUILD_TYPE takes priority if directly defined
15+
if(NOT CMAKE_BUILD_TYPE)
16+
if(release)
17+
set(CMAKE_BUILD_TYPE Release)
18+
else()
19+
set(CMAKE_BUILD_TYPE Debug)
20+
endif()
21+
endif()
22+
23+
if(CMAKE_BUILD_TYPE MATCHES Debug)
1724
set(PRINT_DEBUG TRUE)
18-
else(NOT release)
19-
# build release
20-
set(CMAKE_BUILD_TYPE Release)
25+
else()
2126
set(PRINT_DEBUG FALSE)
22-
endif(NOT release)
27+
endif()
2328

2429
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
2530
message(STATUS "Build variant: ${variant}")

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ This will move our autocompletion script out of a local folder and into the bash
7070

7171
#### Release vs Debug
7272

73-
There are two kinds of builds available: release and non-release. Release builds do not contain debug output (output that use Logger::debug).
73+
There are two kinds of builds available: release and debug. Release builds do not contain debug output (output that use `Logger::debug`).
7474

75-
The default is non-release builds. To build a release version, when inside the 'build' directory, run `cmake -Drelease=ON ..` (note the periods at the end), then run `make`.
75+
The default is debug builds. To build a release version, when inside the 'build' directory, run `cmake -DCMAKE_BUILD_TYPE=Release ..` (note the periods at the end), then run `make`.
76+
Alternatively (but less preferable), you can use the flag `-Drelease=ON`.
7677

7778
#### Build Variant
7879

lib/logger/logger.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace Logger {
7373
};
7474
struct debug_logger {
7575
template<class T>
76-
debug_logger &operator<<(T val) {
76+
debug_logger &operator<<([[maybe_unused]] T val) {
7777
#ifdef PRINT_DEBUG
7878
std::cout << val;
7979
#endif

0 commit comments

Comments
 (0)