mirror of
https://github.com/eclipse/upm.git
synced 2025-03-14 20:47:30 +03:00
cxx_warnings: Misc changes to enable Werror
* CMake option to enable -Werror as default * Change to make sure all cxx examples have correct target name * Added PUBLIC CXX compiler flags to ads1x15 and ozw targets to work around compiler warnings * Renamed cmake variable for compiler warnings Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
601d25cebc
commit
9be920dbcd
@ -14,7 +14,7 @@ option (IPK "Generate IPK using CPack" OFF)
|
||||
option (RPM "Generate RPM using CPack" OFF)
|
||||
option (NPM "Generate NPM/GYP tarballs" OFF)
|
||||
option (BUILDTESTS "Generate check-ups for upm" OFF)
|
||||
option (WERROR "Make all warnings into errors." OFF)
|
||||
option (WERROR "Make all warnings into errors." ON)
|
||||
|
||||
# Warn if building in source root
|
||||
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
|
@ -1,3 +1,7 @@
|
||||
# Selectively disable certain warnings for the examples
|
||||
# nrf examples flag -Wtautological-compare
|
||||
set (CXX_DISABLED_WARNINGS -Wno-tautological-compare)
|
||||
|
||||
# Extract module name from non-standard example name
|
||||
macro(get_module_name example_name module_name)
|
||||
string(LENGTH ${example_name} length)
|
||||
@ -32,6 +36,15 @@ macro(add_custom_example example_bin example_src example_module_list)
|
||||
if (found_all_modules)
|
||||
add_executable (${example_bin} ${example_src})
|
||||
target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
# Disable warnings from CXX_DISABLED_WARNINGS
|
||||
foreach(flag ${CXX_DISABLED_WARNINGS})
|
||||
compiler_flag_supported(CXX is_supported ${flag})
|
||||
if (is_supported)
|
||||
target_compile_options(${example_bin} PRIVATE "${flag}")
|
||||
endif(is_supported)
|
||||
endforeach(flag ${CXX_DISABLED_WARNINGS})
|
||||
|
||||
foreach (module ${example_module_list})
|
||||
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}")
|
||||
include_directories (${module_dir})
|
||||
@ -55,11 +68,6 @@ macro(add_example example_name)
|
||||
get_module_name(${example_name} module_name)
|
||||
set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}")
|
||||
|
||||
# nrf examples can flag a warning, make sure this isn't an error, currently
|
||||
# this is done for all examples
|
||||
set_source_files_properties(${example_src}
|
||||
PROPERTIES COMPILE_FLAGS -Wno-tautological-compare)
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}"
|
||||
AND EXISTS ${module_dir}
|
||||
AND IS_DIRECTORY ${module_dir})
|
||||
@ -316,42 +324,42 @@ add_example (sht1x)
|
||||
|
||||
# These are special cases where you specify example binary, source file and module(s)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src)
|
||||
add_custom_example (groveled-multi-example groveled-multi.cxx grove)
|
||||
add_custom_example (lcm1602-i2c-example lcm1602-i2c.cxx lcd)
|
||||
add_custom_example (lcm1602-parallel-example lcm1602-parallel.cxx lcd)
|
||||
add_custom_example (jhd1313m1-lcd-example jhd1313m1-lcd.cxx lcd)
|
||||
add_custom_example (es08a-example es08a.cxx servo)
|
||||
add_custom_example (ssd1306-oled-example ssd1306-oled.cxx lcd)
|
||||
add_custom_example (ssd1308-oled-example ssd1308-oled.cxx lcd)
|
||||
add_custom_example (ssd1327-oled-example ssd1327-oled.cxx lcd)
|
||||
add_custom_example (sainsmartks-example sainsmartks.cxx lcd)
|
||||
add_custom_example (eboled-example eboled.cxx lcd)
|
||||
add_custom_example (mpu60x0-example mpu60x0.cxx mpu9150)
|
||||
add_custom_example (ak8975-example ak8975.cxx mpu9150)
|
||||
add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
|
||||
add_custom_example (groveledbar-example groveledbar.cxx my9221)
|
||||
add_custom_example (grovecircularled-example grovecircularled.cxx my9221)
|
||||
add_custom_example (temperature-sensor-example temperature-sensor.cxx "si7005;bmpx8x;bmp280")
|
||||
add_custom_example (humidity-sensor-example humidity-sensor.cxx "si7005;bmp280")
|
||||
add_custom_example (pressure-sensor-example pressure-sensor.cxx "bmpx8x;bmp280")
|
||||
add_custom_example (co2-sensor-example co2-sensor.cxx "t6713")
|
||||
add_custom_example (adc-example adc-sensor.cxx "ads1x15")
|
||||
add_custom_example (light-sensor-example light-sensor.cxx "si1132;max44009")
|
||||
add_custom_example (light-controller-example light-controller.cxx "lp8860;ds1808lc;hlg150h")
|
||||
add_custom_example (bme280-example bme280.cxx bmp280)
|
||||
add_custom_example (bma250e-example bma250e.cxx bmx055)
|
||||
add_custom_example (bmg160-example bmg160.cxx bmx055)
|
||||
add_custom_example (bmm150-example bmm150.cxx bmx055)
|
||||
add_custom_example (bmc150-example bmc150.cxx bmx055)
|
||||
add_custom_example (bmi055-example bmi055.cxx bmx055)
|
||||
add_custom_example (groveled-multi-example-cxx groveled-multi.cxx grove)
|
||||
add_custom_example (lcm1602-i2c-example-cxx lcm1602-i2c.cxx lcd)
|
||||
add_custom_example (lcm1602-parallel-example-cxx lcm1602-parallel.cxx lcd)
|
||||
add_custom_example (jhd1313m1-lcd-example-cxx jhd1313m1-lcd.cxx lcd)
|
||||
add_custom_example (es08a-example-cxx es08a.cxx servo)
|
||||
add_custom_example (ssd1306-oled-example-cxx ssd1306-oled.cxx lcd)
|
||||
add_custom_example (ssd1308-oled-example-cxx ssd1308-oled.cxx lcd)
|
||||
add_custom_example (ssd1327-oled-example-cxx ssd1327-oled.cxx lcd)
|
||||
add_custom_example (sainsmartks-example-cxx sainsmartks.cxx lcd)
|
||||
add_custom_example (eboled-example-cxx eboled.cxx lcd)
|
||||
add_custom_example (mpu60x0-example-cxx mpu60x0.cxx mpu9150)
|
||||
add_custom_example (ak8975-example-cxx ak8975.cxx mpu9150)
|
||||
add_custom_example (mpu9250-example-cxx mpu9250.cxx mpu9150)
|
||||
add_custom_example (groveledbar-example-cxx groveledbar.cxx my9221)
|
||||
add_custom_example (grovecircularled-example-cxx grovecircularled.cxx my9221)
|
||||
add_custom_example (temperature-sensor-example-cxx temperature-sensor.cxx "si7005;bmpx8x;bmp280")
|
||||
add_custom_example (humidity-sensor-example-cxx humidity-sensor.cxx "si7005;bmp280")
|
||||
add_custom_example (pressure-sensor-example-cxx pressure-sensor.cxx "bmpx8x;bmp280")
|
||||
add_custom_example (co2-sensor-example-cxx co2-sensor.cxx "t6713")
|
||||
add_custom_example (adc-example-cxx adc-sensor.cxx "ads1x15")
|
||||
add_custom_example (light-sensor-example-cxx light-sensor.cxx "si1132;max44009")
|
||||
add_custom_example (light-controller-example-cxx light-controller.cxx "lp8860;ds1808lc;hlg150h")
|
||||
add_custom_example (bme280-example-cxx bme280.cxx bmp280)
|
||||
add_custom_example (bma250e-example-cxx bma250e.cxx bmx055)
|
||||
add_custom_example (bmg160-example-cxx bmg160.cxx bmx055)
|
||||
add_custom_example (bmm150-example-cxx bmm150.cxx bmx055)
|
||||
add_custom_example (bmc150-example-cxx bmc150.cxx bmx055)
|
||||
add_custom_example (bmi055-example-cxx bmi055.cxx bmx055)
|
||||
if (OPENZWAVE_FOUND)
|
||||
include_directories(${OPENZWAVE_INCLUDE_DIRS})
|
||||
|
||||
add_custom_example (ozwdump-example ozwdump.cxx ozw)
|
||||
add_custom_example (aeotecss6-example aeotecss6.cxx ozw)
|
||||
add_custom_example (aeotecsdg2-example aeotecsdg2.cxx ozw)
|
||||
add_custom_example (aeotecdw2e-example aeotecdw2e.cxx ozw)
|
||||
add_custom_example (aeotecdsb09104-example aeotecdsb09104.cxx ozw)
|
||||
add_custom_example (tzemt400-example tzemt400.cxx ozw)
|
||||
add_custom_example (ozwdump-example-cxx ozwdump.cxx ozw)
|
||||
add_custom_example (aeotecss6-example-cxx aeotecss6.cxx ozw)
|
||||
add_custom_example (aeotecsdg2-example-cxx aeotecsdg2.cxx ozw)
|
||||
add_custom_example (aeotecdw2e-example-cxx aeotecdw2e.cxx ozw)
|
||||
add_custom_example (aeotecdsb09104-example-cxx aeotecdsb09104.cxx ozw)
|
||||
add_custom_example (tzemt400-example-cxx tzemt400.cxx ozw)
|
||||
endif()
|
||||
add_custom_example (nmea_gps_i2c_example-cxx nmea_gps_i2c.cxx nmea_gps)
|
||||
|
@ -1,3 +1,8 @@
|
||||
# Selectively disable certain CXX warnings for SWIG wrappers
|
||||
# SWIG wrappers emit -Wdelete-non-virtual-dtor and -Wunused-function warnings
|
||||
set (SWIG_CXX_DISABLE_WARNINGS -Wno-delete-non-virtual-dtor
|
||||
-Wno-unused-function)
|
||||
|
||||
macro (file_to_list readfile outlist)
|
||||
FILE(READ "${readfile}" contents)
|
||||
STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}")
|
||||
@ -55,9 +60,6 @@ macro (upm_target_link_libraries target_name)
|
||||
endforeach(_library ${ARGN})
|
||||
endmacro (upm_target_link_libraries target_name)
|
||||
|
||||
# Selectively do not emit warnings from the SWIG-generated wrappers
|
||||
set (disabled_flags -Wno-delete-non-virtual-dtor -Wno-unused-function)
|
||||
|
||||
# Create a single swig target for python
|
||||
macro(_upm_swig_python)
|
||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
@ -89,13 +91,13 @@ macro(_upm_swig_python)
|
||||
"${PYTHON_INCLUDE_DIRS}")
|
||||
|
||||
# Turn off flags for wrapper
|
||||
foreach(flag ${disabled_flags})
|
||||
foreach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
compiler_flag_supported(CXX is_supported ${flag})
|
||||
if (is_supported)
|
||||
target_compile_options(${python_wrapper_target}
|
||||
PRIVATE "${flag}")
|
||||
endif(is_supported)
|
||||
endforeach(flag ${disabled_flags})
|
||||
endforeach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
|
||||
# Add C++ comments to ALL python modules (requires doc build)
|
||||
if (BUILDDOC)
|
||||
@ -180,13 +182,13 @@ macro(upm_swig_node)
|
||||
)
|
||||
|
||||
# Turn off flags for wrapper
|
||||
foreach(flag ${disabled_flags})
|
||||
foreach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
compiler_flag_supported(CXX is_supported ${flag})
|
||||
if (is_supported)
|
||||
target_compile_options(${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
|
||||
PRIVATE "${flag}")
|
||||
endif(is_supported)
|
||||
endforeach(flag ${disabled_flags})
|
||||
endforeach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
|
||||
set_target_properties (jsupm_${libname} PROPERTIES
|
||||
COMPILE_FLAGS "-DBUILDING_NODE_EXTENSION -DSWIG_V8_VERSION=${V8_VERSION_HEX}"
|
||||
@ -242,13 +244,13 @@ macro(upm_swig_java)
|
||||
)
|
||||
|
||||
# Turn off flags for wrapper
|
||||
foreach(flag ${disabled_flags})
|
||||
foreach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
compiler_flag_supported(CXX is_supported ${flag})
|
||||
if (is_supported)
|
||||
target_compile_options(${SWIG_MODULE_javaupm_${libname}_REAL_NAME}
|
||||
PRIVATE "${flag}")
|
||||
endif(is_supported)
|
||||
endforeach(flag ${disabled_flags})
|
||||
endforeach(flag ${SWIG_CXX_DISABLE_WARNINGS})
|
||||
|
||||
install (TARGETS javaupm_${libname} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
|
||||
# Java jar files always need to go under lib/java, regardless of
|
||||
|
@ -2,4 +2,8 @@ set (libname "ads1x15")
|
||||
set (libdescription "Analog to digital converter")
|
||||
set (module_src ${libname}.cxx ads1115.cxx ads1015.cxx)
|
||||
set (module_hpp ${libname}.hpp ads1115.hpp ads1015.hpp)
|
||||
upm_module_init()
|
||||
upm_module_init()
|
||||
compiler_flag_supported(CXX is_supported -Wno-overloaded-virtual)
|
||||
if (is_supported)
|
||||
target_compile_options(${libname} PUBLIC -Wno-overloaded-virtual)
|
||||
endif(is_supported)
|
||||
|
@ -130,6 +130,7 @@ void *do_draw(void *arg)
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LoL::LoL() {
|
||||
|
@ -12,6 +12,6 @@ if (OPENZWAVE_FOUND)
|
||||
# openzwave/aes/aes.h has unknown pragmas, disable warning -Wunknown-pragmas
|
||||
compiler_flag_supported(CXX is_supported -Wno-unknown-pragmas)
|
||||
if (is_supported)
|
||||
target_compile_options(${libname} PRIVATE -Wno-unknown-pragmas)
|
||||
target_compile_options(${libname} PUBLIC -Wno-unknown-pragmas)
|
||||
endif (is_supported)
|
||||
endif ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user