Revert "Disable optimizations"
This reverts commit 8c8d6dcd90383429ba16800ddcc29369e2b7c35a.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56f2b22..ddf99e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,6 +219,20 @@
${ONNX_PROTO_LIBRARY} ${ONNX_LIBRARY} ${PROTOBUF_LIBRARY})
endif()
+if(ENABLE_TESTCOVERAGE)
+ message(STATUS "Compiling with test coverage support enabled. This will result in additional files being written to your source directory!")
+ find_program( GCOV_PATH gcov )
+ if(NOT GCOV_PATH)
+ message(FATAL_ERROR "gcov not found! Aborting...")
+ endif() # NOT GCOV_PATH
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
+ set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} --coverage")
+ set(GTEST_LIBRARIES "${GTEST_LIBRARIES} --coverage")
+ link_libraries(gcov)
+endif()
+
if(USE_MKLDNN)
include(cmake/MklDnn.cmake)
# CPU architecture (e.g., C5) can't run on another architecture (e.g., g3).
@@ -295,23 +309,6 @@
list(APPEND mxnet_LINKER_LIBS asan)
endif()
-if(ENABLE_TESTCOVERAGE)
- message(STATUS "Compiling with test coverage support enabled. This will result in additional files being written to your source directory!")
- find_program( GCOV_PATH gcov )
- if(NOT GCOV_PATH)
- message(FATAL_ERROR "gcov not found! Aborting...")
- endif() # NOT GCOV_PATH
-
- # According to https://stackoverflow.com/questions/15909788/how-does-gcc-behave-if-passed-conflicting-compiler-flags,
- # compilers will ignore earlier set flags (like -O) if they are re-set at a later point.
- # Thus, this code should be at the very end of the logic
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -O0")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0")
- set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} --coverage")
- set(GTEST_LIBRARIES "${GTEST_LIBRARIES} --coverage")
- link_libraries(gcov)
-endif()
-
list(APPEND mxnet_LINKER_LIBS ${mshadow_LINKER_LIBS})
foreach(var ${C_CXX_INCLUDE_DIRECTORIES})
diff --git a/Makefile b/Makefile
index 602417a..69b25da 100644
--- a/Makefile
+++ b/Makefile
@@ -92,6 +92,11 @@
CFLAGS += -I$(TPARTYDIR)/mshadow/ -I$(TPARTYDIR)/dmlc-core/include -fPIC -I$(NNVM_PATH)/include -I$(DLPACK_PATH)/include -I$(TPARTYDIR)/tvm/include -Iinclude $(MSHADOW_CFLAGS)
LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
+ifeq ($(ENABLE_TESTCOVERAGE), 1)
+ CFLAGS += --coverage
+ LDFLAGS += --coverage
+endif
+
ifeq ($(USE_TENSORRT), 1)
CFLAGS += -I$(ROOTDIR) -I$(TPARTYDIR) -DONNX_NAMESPACE=$(ONNX_NAMESPACE) -DMXNET_USE_TENSORRT=1
LDFLAGS += -lprotobuf -pthread -lonnx -lonnx_proto -lnvonnxparser -lnvonnxparser_runtime -lnvinfer -lnvinfer_plugin
@@ -476,14 +481,6 @@
CFLAGS += -DMXNET_USE_LIBJPEG_TURBO=0
endif
-ifeq ($(ENABLE_TESTCOVERAGE), 1)
- # According to https://stackoverflow.com/questions/15909788/how-does-gcc-behave-if-passed-conflicting-compiler-flags,
- # compilers will ignore earlier set flags (like -O) if they are re-set at a later point.
- # Thus, this code should be at the very end of the Makefile init logic
- CFLAGS += --coverage -O0
- LDFLAGS += --coverage
-endif
-
# For quick compile test, used smaller subset
ALLX_DEP= $(ALL_DEP)