Skip to content

Commit 0cbb86e

Browse files
committed
Stop clobbering CFLAGS
FN_DEBUG: lost packets per frame (lppf) Signed-off-by: Benn Snyder <[email protected]>
1 parent 8cca127 commit 0cbb86e

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

CMakeLists.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,18 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
100100
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
101101
SET(DOC_OUTPUT_PATH ${CMAKE_BINARY_DIR}/doc)
102102

103-
# let CFLAGS env override this
104-
if(CMAKE_C_FLAGS STREQUAL "")
105-
set(CMAKE_C_FLAGS "-O2")
106-
endif()
107-
SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1")
108-
SET(CMAKE_C_FLAGS_RELEASE "-O2")
109-
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
110-
111-
add_definitions(-Wall)
103+
if (MSVC)
104+
set(C_FLAGS_WARNING "-W4")
105+
else ()
106+
set(C_FLAGS_WARNING "-Wall")
107+
endif (MSVC)
108+
109+
# These defaults can be overriden by environment CFLAGS
110+
set(CMAKE_C_FLAGS "-O2 ${C_FLAGS_WARNING} ${CMAKE_C_FLAGS}")
111+
# Configurations
112+
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DDEBUG=1")
113+
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS}")
114+
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -g")
112115

113116
# Pretty much everyone is going to need the main includes
114117
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)

examples/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Packages needed for examples
33
######################################################################################
44

5-
set(CMAKE_C_FLAGS "-Wall")
6-
75
if (WIN32)
86
set_source_files_properties(glview.c PROPERTIES LANGUAGE CXX)
97
set_source_files_properties(regview.c PROPERTIES LANGUAGE CXX)

src/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
66

7-
set(CMAKE_C_FLAGS "-Wall")
8-
97
include_directories(${LIBUSB_1_INCLUDE_DIRS})
108
LIST(APPEND SRC core.c tilt.c cameras.c flags.c usb_libusb10.c registration.c keep_alive.c)
119
IF(WIN32)

src/cameras.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ static int stream_process(freenect_context *ctx, packet_stream *strm, uint8_t *p
129129
// handle lost packets
130130
if (strm->seq != hdr->seq) {
131131
uint8_t lost = hdr->seq - strm->seq;
132+
strm->lost_pkts += lost;
132133
FN_LOG(l_info, "[Stream %02x] Lost %d packets\n", strm->flag, lost);
134+
135+
FN_DEBUG("[Stream %02x] Lost %d total packets in %d frames (%f lppf)\n",
136+
strm->flag, strm->lost_pkts, strm->valid_frames, (float)strm->lost_pkts / strm->valid_frames);
137+
133138
if (lost > 5 || strm->variable_length) {
134139
FN_LOG(l_notice, "[Stream %02x] Lost too many packets, resyncing...\n", strm->flag);
135140
strm->synced = 0;
@@ -219,6 +224,7 @@ static int stream_process(freenect_context *ctx, packet_stream *strm, uint8_t *p
219224
strm->timestamp = strm->last_timestamp;
220225
strm->valid_frames++;
221226
}
227+
222228
return got_frame_size;
223229
}
224230

src/freenect_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ typedef struct {
159159
int frame_size;
160160
int last_pkt_size;
161161
int valid_pkts;
162+
uint lost_pkts;
162163
int valid_frames;
163164
int variable_length;
164165
uint32_t last_timestamp;

wrappers/cpp/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ INSTALL(FILES libfreenect.hpp
33

44
IF(BUILD_EXAMPLES)
55

6-
set(CMAKE_C_FLAGS "-Wall")
7-
86
if (WIN32)
97
set(THREADS_USE_PTHREADS_WIN32 true)
108
find_package(Threads REQUIRED)

0 commit comments

Comments
 (0)