Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake opt-ins for E57_MAX_DEBUG, E57_VERBOSE and E57_MAX_VERBOSE #80

Merged
merged 3 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ if( BUILD_SHARED_LIBS )
set( E57_BUILD_SHARED ON )
endif()

#########################################################################################

# Various levels of cross checking and verification in the code.
# The extra code does not change the file contents.
# Recommend that E57_DEBUG remain defined even for production versions.

option( E57_DEBUG "Compile library with minimal debug checking" ON )
option( E57_MAX_DEBUG "Compile library with maximum debug checking" OFF )

# Various levels of printing to the console of what is going on in the code.
# Optional

option( E57_VERBOSE "Compile library with verbose logging" OFF )
option( E57_MAX_VERBOSE "Compile library with maximum verbose logging" OFF )

# Enable writing packets that are correct but will stress the reader.

option( E57_WRITE_CRAZY_PACKET_MODE "Compile library to enable reader-stressing packets" OFF )

#########################################################################################

set( revision_id "${PROJECT_NAME}-${PROJECT_VERSION}-${${PROJECT_NAME}_BUILD_TAG}" )
message( STATUS "[E57] Revison ID: ${revision_id}" )

Expand Down Expand Up @@ -115,6 +136,26 @@ target_compile_definitions( E57Format
REVISION_ID="${revision_id}"
)

if ( E57_DEBUG )
target_compile_definitions( E57Format PRIVATE E57_DEBUG )
endif()

if ( E57_MAX_DEBUG )
target_compile_definitions( E57Format PRIVATE E57_MAX_DEBUG )
endif()

if ( E57_VERBOSE )
target_compile_definitions( E57Format PRIVATE E57_VERBOSE )
endif()

if ( E57_MAX_VERBOSE )
target_compile_definitions( E57Format PRIVATE E57_MAX_VERBOSE )
endif()

if ( E57_WRITE_CRAZY_PACKET_MODE )
target_compile_definitions( E57Format PRIVATE E57_WRITE_CRAZY_PACKET_MODE )
endif()

if ( WIN32 )
option( USING_STATIC_XERCES "Turn on if you are linking with Xerces as a static lib" OFF )
if ( USING_STATIC_XERCES )
Expand Down
15 changes: 0 additions & 15 deletions src/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@
#define E57_INTERNAL_IMPLEMENTATION_ENABLE 1
#include "E57Format.h"

// Uncomment the lines below to enable various levels of cross checking and
// verification in the code. The extra code does not change the file contents.
// Recommend that E57_DEBUG remain defined even for production versions.
#define E57_DEBUG 1
//#define E57_MAX_DEBUG 1

// Uncomment the lines below to enable various levels of printing to the console
// of what is going on in the code.
//#define E57_VERBOSE 1
//#define E57_MAX_VERBOSE 1

// Uncomment the line below to enable writing packets that are correct but will
// stress the reader.
//#define E57_WRITE_CRAZY_PACKET_MODE 1

#ifdef _MSC_VER
// Disable MSVC warning: warning C4224: nonstandard extension used : formal
// parameter 'locale' was previously defined as a type
Expand Down