Skip to content

Commit 937604a

Browse files
filipecosta90DvirDukhan
andauthored
Added PROFILE option to makefile. Added option to skip building unit tests (#523)
* [add] Added PROFILE option to makefile. Added option to skip building unit tests * [fix] Fixes per PR review * Update opt/Makefile Co-authored-by: DvirDukhan <dvir@redislabs.com> Co-authored-by: DvirDukhan <dvir@redislabs.com>
1 parent 15c6bf1 commit 937604a

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ ENDIF()
2424
#----------------------------------------------------------------------------------------------
2525

2626
SET(CMAKE_CC_COMMON_FLAGS "-fPIC")
27+
IF (USE_PROFILE)
28+
SET(CMAKE_CC_COMMON_FLAGS "${CMAKE_CC_COMMON_FLAGS} -g -ggdb -fno-omit-frame-pointer")
29+
ENDIF()
2730

2831
IF (USE_COVERAGE)
2932
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")

opt/Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ make fetch # download and prepare dependant artifacts
3333
make build # compile and link
3434
DEBUG=1 # build for debugging
3535
COV=1 # build for coverage analysis (implies DEBUG=1)
36+
PROFILE=1 # enable profiling compile flags (and debug symbols) for release type.
37+
# You can consider this as build type release with debug symbols and -fno-omit-frame-pointer
3638
VARIANT=name # build variant `name`
3739
WHY=1 # explain CMake decisions (into /tmp/cmake.why)
3840
make clean # remove build artifacts
@@ -63,10 +65,11 @@ make docker # build docker image
6365
make docker-gpu-test # run GPU tests
6466

6567
fetch and build options:
66-
WITH_TF=0 # SKip TensofFlow
67-
WITH_TFLITE=0 # SKip TensofFlowLite
68-
WITH_PT=0 # Skip PyTorch
69-
WITH_ORT=0 # SKip ONNXRuntime
68+
WITH_TF=0 # SKip TensofFlow
69+
WITH_TFLITE=0 # SKip TensofFlowLite
70+
WITH_PT=0 # Skip PyTorch
71+
WITH_ORT=0 # SKip ONNXRuntime
72+
WITH_UNIT_TESTS=0 # SKip unit tests
7073

7174
device selection options (fetch, build, and test):
7275
CPU=1 # build for CPU
@@ -115,10 +118,17 @@ else
115118
USE_COVERAGE=off
116119
endif
117120

121+
ifeq ($(PROFILE),1)
122+
USE_PROFILE=on
123+
else
124+
USE_PROFILE=off
125+
endif
126+
118127
CMAKE_FLAGS += \
119128
-DDEPS_PATH=$(abspath $(DEPS_DIR)) \
120129
-DINSTALL_PATH=$(abspath $(INSTALL_DIR)) \
121130
-DUSE_COVERAGE=$(USE_COVERAGE) \
131+
-DUSE_PROFILE=$(USE_PROFILE) \
122132
-DREDISAI_GIT_SHA=\"$(GIT_SHA)\" \
123133
-DDEVICE=$(DEVICE)
124134

@@ -138,6 +148,10 @@ ifeq ($(WITH_ORT),0)
138148
CMAKE_FLAGS += -DBUILD_ORT=off
139149
endif
140150

151+
ifeq ($(WITH_UNIT_TESTS),0)
152+
CMAKE_FLAGS += -DPACKAGE_UNIT_TESTS=off
153+
endif
154+
141155
include $(MK)/defs
142156

143157
#----------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)