Skip to content

Commit

Permalink
Merge from master (#231)
Browse files Browse the repository at this point in the history
* Use ndebug (#229)

Used NDEBUG flag to indicate of not debug mode (CMake adds this flag be default in release mode)
Default compilation is release mode

* Cmake: Minor (#230)

* fix a couple of warnings

* minor

Co-authored-by: yuvaljacoby <yuvaljacoby@users.noreply.github.com>
Co-authored-by: Ahmed Irfan <43099566+ahmed-irfan@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 26, 2020
1 parent e001a13 commit d51c883
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ endif()

if (NOT MSVC)
set(COMPILE_FLAGS -Wall -Wextra -Werror -MMD) #-Wno-deprecated
set(RELEASE_FLAGS -O3) #-Wno-deprecated
set(RELEASE_FLAGS ${COMPILE_FLAGS} -O3) #-Wno-deprecated
endif()

if (RUN_MEMORY_TEST)
Expand All @@ -104,20 +104,17 @@ endif()
add_definitions(-DRESOURCES_DIR="${RESOURCES_DIR}")

if (NOT MSVC)
set(DEBUG_FLAGS ${COMPILE_FLAGS} ${MEMORY_FLAGS} -g -DDEBUG_ON)
set(DEBUG_FLAGS ${COMPILE_FLAGS} ${MEMORY_FLAGS} -g)
set(CXXTEST_FLAGS ${DEBUG_FLAGS} -Wno-ignored-qualifiers)
else()
set(DEBUG_FLAGS ${COMPILE_FLAGS} ${MEMORY_FLAGS} /DDEBUG_ON)
set(DEBUG_FLAGS ${COMPILE_FLAGS} ${MEMORY_FLAGS})
add_definitions(-DNOMINMAX) # remove min max macros
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CXXTEST_FLAGS ${CXXTEST_FLAGS} -Wno-terminate)
endif()

if (NOT MSVC)
set(RELEASE_FLAGS ${COMPILE_FLAGS} -O3)
endif()


# Boost
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ To enable multiprocess build change the last command to:
```
cmake --build . -j PROC_NUM
```
To compile in debug mode (default is release)
```
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build .
```

The compiled binary will be in the *build* directory, named _Marabou_

To run tests we use [ctest](https://cmake.org/cmake/help/v3.15/manual/ctest.1.html).
Expand Down
7 changes: 3 additions & 4 deletions src/common/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

#include <cstdlib>

// #define DEBUG_ON

#ifdef DEBUG_ON
#ifndef NDEBUG
# define DEBUG(x) x
#else
# define DEBUG(x)
#endif

#ifdef DEBUG_ON
#ifndef NDEBUG
# define ASSERTM(x, y, ...) \
{ \
if ( !( x ) ) \
Expand All @@ -39,7 +38,7 @@
# define ASSERTM(x, y, ...)
#endif

#ifdef DEBUG_ON
#ifndef NDEBUG
# define ASSERT(x) \
{ \
if ( !( x ) ) \
Expand Down

0 comments on commit d51c883

Please sign in to comment.