add C++ compile flags and enable useful warnings

master
Andre Puschmann 8 years ago
parent ff7400f140
commit bcecdf292b

@ -200,10 +200,12 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-write-strings -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE -g") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-write-strings -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
find_package(SSE) find_package(SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -DDEBUG_MODE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -DDEBUG_MODE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -std=c++03")
if(HAVE_AVX) if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE) elseif(HAVE_SSE)
@ -211,14 +213,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif(HAVE_AVX) endif(HAVE_AVX)
else(${CMAKE_BUILD_TYPE} STREQUAL "Debug") else(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++03")
find_package(SSE) find_package(SSE)
if (HAVE_AVX2) if (HAVE_AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx2 -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx2 -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -mavx2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
else (HAVE_AVX2) else (HAVE_AVX2)
if(HAVE_AVX) if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -mavx -Ofast -funroll-loops -DLV_HAVE_AVX -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE) elseif(HAVE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -msse4.1 -Ofast -funroll-loops -DLV_HAVE_SSE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mfpmath=sse -msse4.1 -Ofast -funroll-loops -DLV_HAVE_SSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
endif(HAVE_AVX) endif(HAVE_AVX)
endif (HAVE_AVX2) endif (HAVE_AVX2)
@ -288,6 +294,19 @@ include_directories(${PROJECT_SOURCE_DIR}/lib/include)
# Includes needed by all code previously resided in srsUE # Includes needed by all code previously resided in srsUE
include_directories(${PROJECT_SOURCE_DIR}/lib/include/srslte) include_directories(${PROJECT_SOURCE_DIR}/lib/include/srslte)
########################################################################
# Add headers to cmake project (useful for IDEs)
########################################################################
set(HEADERS_ALL "")
file(GLOB headers *)
foreach(_header ${headers})
if(IS_DIRECTORY ${_header})
file(GLOB_RECURSE tmp "${_header}/*.h")
list(APPEND HEADERS_ALL ${tmp})
endif(IS_DIRECTORY ${_header})
endforeach()
add_custom_target(add_srslte_headers SOURCES ${HEADERS_ALL})
######################################################################## ########################################################################
# Add the subdirectories # Add the subdirectories
######################################################################## ########################################################################

@ -26,19 +26,6 @@ INSTALL(DIRECTORY include/
FILES_MATCHING PATTERN "*.h" FILES_MATCHING PATTERN "*.h"
) )
########################################################################
# Add headers to cmake project (useful for IDEs)
########################################################################
set(HEADERS_ALL "")
file(GLOB headers *)
FOREACH (_header ${headers})
if(IS_DIRECTORY ${_header})
file(GLOB_RECURSE tmp "${_header}/*.h")
list(APPEND HEADERS_ALL ${tmp})
endif(IS_DIRECTORY ${_header})
ENDFOREACH()
add_custom_target (add_srslte_headers SOURCES ${HEADERS_ALL})
######################################################################## ########################################################################
# Find Dependencies # Find Dependencies
######################################################################## ########################################################################

@ -1,4 +1,4 @@
include_directories(hdr) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-unused-but-set-variable -Wno-unused-variable -Wno-return-type -Wno-sign-compare -Wno-reorder -Wno-parantheses")
add_library(srslte_asn1 SHARED add_library(srslte_asn1 SHARED
liblte_common.cc liblte_common.cc
liblte_rrc.cc liblte_rrc.cc

@ -16,7 +16,7 @@
# the LICENSE file in the top-level directory of this distribution # the LICENSE file in the top-level directory of this distribution
# and at http://www.gnu.org/licenses/. # and at http://www.gnu.org/licenses/.
# #
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
add_executable(mac_test mac_test.cc) add_executable(mac_test mac_test.cc)
target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})

Loading…
Cancel
Save