diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt index b004ff45..f43c0df4 100644 --- a/examples/c++/CMakeLists.txt +++ b/examples/c++/CMakeLists.txt @@ -1,448 +1,246 @@ +# Extract module name from non-standard example name +macro(get_module_name example_name module_name) + string(LENGTH ${example_name} length) + string(FIND ${example_name} "-" index) + if (${index} GREATER 1) + string(SUBSTRING ${example_name} 0 ${index} substr) + set(${module_name} ${substr}) + elseif (${example_name} MATCHES "^grove") + set (${module_name} "grove") + elseif ((${example_name} MATCHES "^mq" AND ${length} EQUAL 3) OR ${example_name} STREQUAL "tp401") + set (${module_name} "gas") + else() + set(${module_name} ${example_name}) + endif() +endmacro() + + +# Set source file, include and linker settings for an example +# If example cannot be built, example_bin is cleared +macro(add_custom_example example_bin example_src example_module_list) + set(found_all_modules TRUE) + foreach (module ${example_module_list}) + if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/${module}") + set(found_all_modules FALSE) + endif() + if (MODULE_LIST) + list(FIND MODULE_LIST ${module} index) + if (${index} EQUAL -1) + set(found_all_modules FALSE) + endif() + endif() + endforeach() + if (found_all_modules) + add_executable (${example_bin} ${example_src}) + target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT}) + foreach (module ${example_module_list}) + set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}") + include_directories (${module_dir}) + if (${module} STREQUAL "lcd") + set(module "i2clcd") + endif() + target_link_libraries (${example_bin} ${module}) + endforeach() + else() + MESSAGE(INFO " Ignored ${example_bin}") + set (example_bin "") + endif() +endmacro() + + +# Add specified example by name +# Note special case for grove based examples +macro(add_example example_name) + set(example_src "${example_name}.cxx") + set(example_bin "${example_name}-example") + get_module_name(${example_name} module_name) + set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}") + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}" + AND EXISTS ${module_dir} + AND IS_DIRECTORY ${module_dir}) + add_custom_example(${example_bin} ${example_src} ${module_name}) + if ((NOT ${example_bin} STREQUAL "") AND (${module_name} STREQUAL "grove")) + set(grove_module_path "${PROJECT_SOURCE_DIR}/src/${example_name}") + if (EXISTS ${grove_module_path}) + include_directories(${grove_module_path}) + target_link_libraries (${example_bin} ${example_name}) + endif() + endif() + else() + MESSAGE(INFO " Ignored ${example_bin}") + endif() +endmacro() + + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples) -add_executable (hmc5883l-example hmc5883l.cxx) -add_executable (groveled-example groveled.cxx) -add_executable (groveled-multi-example groveled-multi.cxx) -add_executable (groverelay-example groverelay.cxx) -add_executable (grovelight-example grovelight.cxx) -add_executable (grovetemp-example grovetemp.cxx) -add_executable (grovebutton-example grovebutton.cxx) -add_executable (groverotary-example groverotary.cxx) -add_executable (groveslide-example groveslide.cxx) -add_executable (lcm1602-i2c-example lcm1602-i2c.cxx) -add_executable (lcm1602-parallel-example lcm1602-parallel.cxx) -add_executable (jhd1313m1-lcd-example jhd1313m1-lcd.cxx) -add_executable (buzzer-sound-example buzzer-sound.cxx) -add_executable (my9221-ledbar-example my9221-ledbar.cxx) -add_executable (my9221-updown-example my9221-updown.cxx) -add_executable (nrf24l01-transmitter-example nrf24l01-transmitter.cxx) -add_executable (nrf24l01-receiver-example nrf24l01-receiver.cxx) -add_executable (nrf24l01-broadcast-example nrf24l01-broadcast.cxx) -add_executable (es08a-example es08a.cxx) -add_executable (hcsr04-example hcsr04.cxx) -add_executable (ssd1306-oled-example ssd1306-oled.cxx) -add_executable (ssd1308-oled-example ssd1308-oled.cxx) -add_executable (ssd1327-oled-example ssd1327-oled.cxx) -add_executable (max44000-example max44000.cxx) -add_executable (mma7455-example mma7455.cxx) -add_executable (st7735-example st7735.cxx) -add_executable (max31855-example max31855.cxx) -add_executable (bmpx8x-example bmpx8x.cxx) -add_executable (stepmotor-example stepmotor.cxx) -add_executable (pulsensor-example pulsensor.cxx) -add_executable (mic-example mic.cxx) -add_executable (mpu9150-example mpu9150.cxx) -add_executable (maxds3231m-example maxds3231m.cxx) -add_executable (max31723-example max31723.cxx) -add_executable (max5487-example max5487.cxx) -add_executable (nrf8001-broadcast-example nrf8001-broadcast.cxx) -add_executable (nrf8001-helloworld-example nrf8001-helloworld.cxx) -add_executable (lpd8806-example lpd8806.cxx) -add_executable (mlx90614-example mlx90614.cxx) -add_executable (ecs1030-example ecs1030.cxx) -add_executable (mq2-example mq2.cxx) -add_executable (mq3-example mq3.cxx) -add_executable (mq4-example mq4.cxx) -add_executable (mq5-example mq5.cxx) -add_executable (mq6-example mq6.cxx) -add_executable (mq7-example mq7.cxx) -add_executable (mq8-example mq8.cxx) -add_executable (mq9-example mq9.cxx) -add_executable (tp401-example tp401.cxx) -add_executable (tcs3414cs-example tcs3414cs.cxx) -add_executable (th02-example th02.cxx) -add_executable (ttp223-example ttp223.cxx) -add_executable (lsm303-example lsm303.cxx) -add_executable (joystick12-example joystick12-example.cxx) -add_executable (lol-example lol-example.cxx) -add_executable (tsl2561-example tsl2561.cxx) -add_executable (htu21d-example htu21d.cxx) -add_executable (mpl3115a2-example mpl3115a2.cxx) -add_executable (ldt0028-example ldt0028.cxx) -add_executable (am2315-example am2315.cxx) -add_executable (itg3200-example itg3200.cxx) -add_executable (enc03r-example enc03r.cxx) -add_executable (adc121c021-example adc121c021.cxx) -add_executable (ds1307-example ds1307.cxx) -add_executable (a110x-example a110x.cxx) -add_executable (gp2y0a-example gp2y0a.cxx) -add_executable (grovemoisture-example grovemoisture.cxx) -add_executable (groveehr-example groveehr.cxx) -add_executable (ta12200-example ta12200.cxx) -add_executable (grovelinefinder-example grovelinefinder.cxx) -add_executable (grovevdiv-example grovevdiv.cxx) -add_executable (grovewater-example grovewater.cxx) -add_executable (guvas12d-example guvas12d.cxx) -add_executable (mpr121-example mpr121.cxx) -add_executable (ublox6-example ublox6.cxx) -add_executable (yg1006-example yg1006.cxx) -add_executable (wt5001-example wt5001.cxx) -add_executable (ppd42ns-example ppd42ns.cxx) -add_executable (mq303a-example mq303a.cxx) -add_executable (grovespeaker-example grovespeaker.cxx) -add_executable (rfr359f-example rfr359f.cxx) -add_executable (biss0001-example biss0001.cxx) -add_executable (rotaryencoder-example rotaryencoder.cxx) -add_executable (adxl345-example adxl345.cxx) -add_executable (rpr220-example rpr220.cxx) -add_executable (rpr220-intr-example rpr220-intr.cxx) -add_executable (mma7660-example mma7660.cxx) -add_executable (cjq4435-example cjq4435.cxx) -add_executable (adxl335-example adxl335.cxx) -add_executable (hmtrp-example hmtrp.cxx) -add_executable (nunchuck-example nunchuck.cxx) -add_executable (otp538u-example otp538u.cxx) -add_executable (grovecollision-example grovecollision.cxx) -add_executable (groveelectromagnet-example groveelectromagnet.cxx) -add_executable (groveemg-example groveemg.cxx) -add_executable (groveo2-example groveo2.cxx) -add_executable (grovegsr-example grovegsr.cxx) -add_executable (ina132-example ina132.cxx) -add_executable (l298-example l298.cxx) -add_executable (l298-stepper-example l298-stepper.cxx) -add_executable (at42qt1070-example at42qt1070.cxx) -add_executable (grovemd-example grovemd.cxx) -add_executable (grovemd-stepper-example grovemd-stepper.cxx) -add_executable (pca9685-example pca9685.cxx) -add_executable (groveeldriver-example groveeldriver.cxx) -add_executable (adafruitss-example adafruitss.cxx) -add_executable (adafruitms1438-example adafruitms1438.cxx) -add_executable (adafruitms1438-stepper-example adafruitms1438-stepper.cxx) -add_executable (hx711-example hx711.cxx) -add_executable (flex-example flex.cxx) -add_executable (a110x-intr-example a110x-intr.cxx) -add_executable (mhz16-example mhz16.cxx) -add_executable (apds9002-example apds9002.cxx) -add_executable (waterlevel-example waterlevel.cxx) -add_executable (tm1637-example tm1637.cxx) -add_executable (zfm20-example zfm20.cxx) -add_executable (zfm20-register-example zfm20-register.cxx) -add_executable (uln200xa-example uln200xa.cxx) -add_executable (grovewfs-example grovewfs.cxx) -add_executable (isd1820-example isd1820.cxx) -add_executable (sx6119-example sx6119.cxx) -add_executable (si114x-example si114x.cxx) -add_executable (maxsonarez-example maxsonarez.cxx) -add_executable (hm11-example hm11.cxx) -add_executable (ht9170-example ht9170.cxx) -add_executable (h3lis331dl-example h3lis331dl.cxx) -add_executable (ad8232-example ad8232.cxx) -add_executable (grovescam-example grovescam.cxx) -add_executable (m24lr64e-example m24lr64e.cxx) -add_executable (grovecircularled-example grovecircularled.cxx) -add_executable (rgbringcoder-example rgbringcoder.cxx) -add_executable (hp20x-example hp20x.cxx) -add_executable (pn532-example pn532.cxx) -add_executable (pn532-writeurl-example pn532-writeurl.cxx) -add_executable (sainsmartks-example sainsmartks.cxx) -add_executable (mpu60x0-example mpu60x0.cxx) -add_executable (ak8975-example ak8975.cxx) -add_executable (lsm9ds0-example lsm9ds0.cxx) -add_executable (eboled-example eboled.cxx) -add_executable (mpu9250-example mpu9250.cxx) -add_executable (loudness-example loudness.cxx) -add_executable (mg811-example mg811.cxx) -add_executable (wheelencoder-example wheelencoder.cxx) -add_executable (sm130-example sm130.cxx) -add_executable (grovegprs-example grovegprs.cxx) -add_executable (lm35-example lm35.cxx) -add_executable (micsv89-example micsv89.cxx) -add_executable (xbee-example xbee.cxx) -add_executable (urm37-example urm37.cxx) -add_executable (urm37-uart-example urm37-uart.cxx) -add_executable (adxrs610-example adxrs610.cxx) -add_executable (bma220-example bma220.cxx) -add_executable (dfrph-example dfrph.cxx) -add_executable (mcp9808-example mcp9808.cxx) -add_executable (groveultrasonic-example groveultrasonic.cxx) -add_executable (sx1276-lora-example sx1276-lora.cxx) -add_executable (sx1276-fsk-example sx1276-fsk.cxx) -# availability of libopenzwave is tested in src/ozw/CMakeLists.txt -if (OPENZWAVE_FOUND) - add_executable (ozw-example ozw.cxx) -endif () +# If your sample source file matches the name of the module it tests, add it here +# Exceptions are as follows: +# string after first '-' is ignored (e.g. nrf24l01-transmitter maps to nrf24l01) +# mq? will use module gas +# grove* will use module grove +add_example (hmc5883l) +add_example (groveled) +add_example (groverelay) +add_example (grovelight) +add_example (grovetemp) +add_example (grovebutton) +add_example (groverotary) +add_example (groveslide) +add_example (buzzer-sound) +add_example (my9221-ledbar) +add_example (my9221-updown) +add_example (nrf24l01-transmitter) +add_example (nrf24l01-receiver) +add_example (nrf24l01-broadcast) +add_example (hcsr04) +add_example (max44000) +add_example (mma7455) +add_example (st7735) +add_example (max31855) +add_example (bmpx8x) +add_example (stepmotor) +add_example (pulsensor) +add_example (mic) +add_example (mpu9150) +add_example (maxds3231m) +add_example (max31723) +add_example (max5487) +add_example (nrf8001-broadcast) +add_example (nrf8001-helloworld) +add_example (lpd8806) +add_example (mlx90614) +add_example (ecs1030) +add_example (mq2) +add_example (mq3) +add_example (mq4) +add_example (mq5) +add_example (mq6) +add_example (mq7) +add_example (mq8) +add_example (mq9) +add_example (tp401) +add_example (tcs3414cs) +add_example (th02) +add_example (ttp223) +add_example (lsm303) +add_example (joystick12) +add_example (lol) +add_example (tsl2561) +add_example (htu21d) +add_example (mpl3115a2) +add_example (ldt0028) +add_example (am2315) +add_example (itg3200) +add_example (enc03r) +add_example (adc121c021) +add_example (ds1307) +add_example (a110x) +add_example (gp2y0a) +add_example (grovemoisture) +add_example (groveehr) +add_example (ta12200) +add_example (grovelinefinder) +add_example (grovevdiv) +add_example (grovewater) +add_example (guvas12d) +add_example (mpr121) +add_example (ublox6) +add_example (yg1006) +add_example (wt5001) +add_example (ppd42ns) +add_example (mq303a) +add_example (grovespeaker) +add_example (rfr359f) +add_example (biss0001) +add_example (rotaryencoder) +add_example (adxl345) +add_example (rpr220) +add_example (rpr220-intr) +add_example (mma7660) +add_example (cjq4435) +add_example (adxl335) +add_example (hmtrp) +add_example (nunchuck) +add_example (otp538u) +add_example (grovecollision) +add_example (groveelectromagnet) +add_example (groveemg) +add_example (groveo2) +add_example (grovegsr) +add_example (ina132) +add_example (l298) +add_example (l298-stepper) +add_example (at42qt1070) +add_example (grovemd) +add_example (grovemd-stepper) +add_example (pca9685) +add_example (groveeldriver) +add_example (adafruitss) +add_example (adafruitms1438) +add_example (adafruitms1438-stepper) +add_example (hx711) +add_example (flex) +add_example (a110x-intr) +add_example (mhz16) +add_example (apds9002) +add_example (waterlevel) +add_example (tm1637) +add_example (zfm20) +add_example (zfm20-register) +add_example (uln200xa) +add_example (grovewfs) +add_example (isd1820) +add_example (sx6119) +add_example (si114x) +add_example (maxsonarez) +add_example (hm11) +add_example (ht9170) +add_example (h3lis331dl) +add_example (ad8232) +add_example (grovescam) +add_example (m24lr64e) +add_example (grovecircularled) +add_example (rgbringcoder) +add_example (hp20x) +add_example (pn532) +add_example (pn532-writeurl) +add_example (lsm9ds0) +add_example (loudness) +add_example (mg811) +add_example (wheelencoder) +add_example (sm130) +add_example (grovegprs) +add_example (lm35) +add_example (micsv89) +add_example (xbee) +add_example (urm37) +add_example (urm37-uart) +add_example (adxrs610) +add_example (bma220) +add_example (dfrph) +add_example (mcp9808) -include_directories (${PROJECT_SOURCE_DIR}/src/hmc5883l) -include_directories (${PROJECT_SOURCE_DIR}/src/grove) -include_directories (${PROJECT_SOURCE_DIR}/src/lcd) -include_directories (${PROJECT_SOURCE_DIR}/src/buzzer) -include_directories (${PROJECT_SOURCE_DIR}/src/my9221) -include_directories (${PROJECT_SOURCE_DIR}/src/nrf24l01) -include_directories (${PROJECT_SOURCE_DIR}/src/servo) -include_directories (${PROJECT_SOURCE_DIR}/src/hcsr04) -include_directories (${PROJECT_SOURCE_DIR}/src/max44000) -include_directories (${PROJECT_SOURCE_DIR}/src/mma7455) -include_directories (${PROJECT_SOURCE_DIR}/src/st7735) -include_directories (${PROJECT_SOURCE_DIR}/src/max31855) -include_directories (${PROJECT_SOURCE_DIR}/src/bmpx8x) -include_directories (${PROJECT_SOURCE_DIR}/src/stepmotor) -include_directories (${PROJECT_SOURCE_DIR}/src/pulsensor) -include_directories (${PROJECT_SOURCE_DIR}/src/mic) -include_directories (${PROJECT_SOURCE_DIR}/src/mpu9150) -include_directories (${PROJECT_SOURCE_DIR}/src/maxds3231m) -include_directories (${PROJECT_SOURCE_DIR}/src/max31723) -include_directories (${PROJECT_SOURCE_DIR}/src/max5487) -include_directories (${PROJECT_SOURCE_DIR}/src/nrf8001) -include_directories (${PROJECT_SOURCE_DIR}/src/lpd8806) -include_directories (${PROJECT_SOURCE_DIR}/src/mlx90614) -include_directories (${PROJECT_SOURCE_DIR}/src/ecs1030) -include_directories (${PROJECT_SOURCE_DIR}/src/gas) -include_directories (${PROJECT_SOURCE_DIR}/src/tcs3414cs) -include_directories (${PROJECT_SOURCE_DIR}/src/th02) -include_directories (${PROJECT_SOURCE_DIR}/src/ttp223) -include_directories (${PROJECT_SOURCE_DIR}/src/lsm303) -include_directories (${PROJECT_SOURCE_DIR}/src/joystick12) -include_directories (${PROJECT_SOURCE_DIR}/src/lol) -include_directories (${PROJECT_SOURCE_DIR}/src/tsl2561) -include_directories (${PROJECT_SOURCE_DIR}/src/htu21d) -include_directories (${PROJECT_SOURCE_DIR}/src/mpl3115a2) -include_directories (${PROJECT_SOURCE_DIR}/src/ldt0028) -include_directories (${PROJECT_SOURCE_DIR}/src/am2315) -include_directories (${PROJECT_SOURCE_DIR}/src/itg3200) -include_directories (${PROJECT_SOURCE_DIR}/src/enc03r) -include_directories (${PROJECT_SOURCE_DIR}/src/adc121c021) -include_directories (${PROJECT_SOURCE_DIR}/src/ds1307) -include_directories (${PROJECT_SOURCE_DIR}/src/a110x) -include_directories (${PROJECT_SOURCE_DIR}/src/gp2y0a) -include_directories (${PROJECT_SOURCE_DIR}/src/grovemoisture) -include_directories (${PROJECT_SOURCE_DIR}/src/groveehr) -include_directories (${PROJECT_SOURCE_DIR}/src/ta12200) -include_directories (${PROJECT_SOURCE_DIR}/src/grovelinefinder) -include_directories (${PROJECT_SOURCE_DIR}/src/grovevdiv) -include_directories (${PROJECT_SOURCE_DIR}/src/grovewater) -include_directories (${PROJECT_SOURCE_DIR}/src/guvas12d) -include_directories (${PROJECT_SOURCE_DIR}/src/mpr121) -include_directories (${PROJECT_SOURCE_DIR}/src/ublox6) -include_directories (${PROJECT_SOURCE_DIR}/src/yg1006) -include_directories (${PROJECT_SOURCE_DIR}/src/wt5001) -include_directories (${PROJECT_SOURCE_DIR}/src/ppd42ns) -include_directories (${PROJECT_SOURCE_DIR}/src/mq303a) -include_directories (${PROJECT_SOURCE_DIR}/src/grovespeaker) -include_directories (${PROJECT_SOURCE_DIR}/src/rfr359f) -include_directories (${PROJECT_SOURCE_DIR}/src/biss0001) -include_directories (${PROJECT_SOURCE_DIR}/src/rotaryencoder) -include_directories (${PROJECT_SOURCE_DIR}/src/adxl345) -include_directories (${PROJECT_SOURCE_DIR}/src/rpr220) -include_directories (${PROJECT_SOURCE_DIR}/src/mma7660) -include_directories (${PROJECT_SOURCE_DIR}/src/cjq4435) -include_directories (${PROJECT_SOURCE_DIR}/src/adxl335) -include_directories (${PROJECT_SOURCE_DIR}/src/hmtrp) -include_directories (${PROJECT_SOURCE_DIR}/src/nunchuck) -include_directories (${PROJECT_SOURCE_DIR}/src/otp538u) -include_directories (${PROJECT_SOURCE_DIR}/src/grovecollision) -include_directories (${PROJECT_SOURCE_DIR}/src/groveelectromagnet) -include_directories (${PROJECT_SOURCE_DIR}/src/groveemg) -include_directories (${PROJECT_SOURCE_DIR}/src/groveo2) -include_directories (${PROJECT_SOURCE_DIR}/src/grovegsr) -include_directories (${PROJECT_SOURCE_DIR}/src/ina132) -include_directories (${PROJECT_SOURCE_DIR}/src/l298) -include_directories (${PROJECT_SOURCE_DIR}/src/at42qt1070) -include_directories (${PROJECT_SOURCE_DIR}/src/grovemd) -include_directories (${PROJECT_SOURCE_DIR}/src/pca9685) -include_directories (${PROJECT_SOURCE_DIR}/src/groveeldriver) -include_directories (${PROJECT_SOURCE_DIR}/src/adafruitss) -include_directories (${PROJECT_SOURCE_DIR}/src/adafruitms1438) -include_directories (${PROJECT_SOURCE_DIR}/src/hx711) -include_directories (${PROJECT_SOURCE_DIR}/src/flex) -include_directories (${PROJECT_SOURCE_DIR}/src/mhz16) -include_directories (${PROJECT_SOURCE_DIR}/src/apds9002) -include_directories (${PROJECT_SOURCE_DIR}/src/waterlevel) -include_directories (${PROJECT_SOURCE_DIR}/src/tm1637) -include_directories (${PROJECT_SOURCE_DIR}/src/zfm20) -include_directories (${PROJECT_SOURCE_DIR}/src/uln200xa) -include_directories (${PROJECT_SOURCE_DIR}/src/grovewfs) -include_directories (${PROJECT_SOURCE_DIR}/src/isd1820) -include_directories (${PROJECT_SOURCE_DIR}/src/sx6119) -include_directories (${PROJECT_SOURCE_DIR}/src/si114x) -include_directories (${PROJECT_SOURCE_DIR}/src/maxsonarez) -include_directories (${PROJECT_SOURCE_DIR}/src/hm11) -include_directories (${PROJECT_SOURCE_DIR}/src/ht9170) -include_directories (${PROJECT_SOURCE_DIR}/src/h3lis331dl) -include_directories (${PROJECT_SOURCE_DIR}/src/ad8232) -include_directories (${PROJECT_SOURCE_DIR}/src/grovescam) -include_directories (${PROJECT_SOURCE_DIR}/src/m24lr64e) -include_directories (${PROJECT_SOURCE_DIR}/src/grovecircularled) -include_directories (${PROJECT_SOURCE_DIR}/src/rgbringcoder) -include_directories (${PROJECT_SOURCE_DIR}/src/hp20x) -include_directories (${PROJECT_SOURCE_DIR}/src/pn532) -include_directories (${PROJECT_SOURCE_DIR}/src/lsm9ds0) -include_directories (${PROJECT_SOURCE_DIR}/src/loudness) -include_directories (${PROJECT_SOURCE_DIR}/src/mg811) -include_directories (${PROJECT_SOURCE_DIR}/src/wheelencoder) -include_directories (${PROJECT_SOURCE_DIR}/src/sm130) -include_directories (${PROJECT_SOURCE_DIR}/src/grovegprs) -include_directories (${PROJECT_SOURCE_DIR}/src/lm35) -include_directories (${PROJECT_SOURCE_DIR}/src/micsv89) -include_directories (${PROJECT_SOURCE_DIR}/src/xbee) -include_directories (${PROJECT_SOURCE_DIR}/src/urm37) -include_directories (${PROJECT_SOURCE_DIR}/src/adxrs610) -include_directories (${PROJECT_SOURCE_DIR}/src/bma220) -include_directories (${PROJECT_SOURCE_DIR}/src/dfrph) -include_directories (${PROJECT_SOURCE_DIR}/src/mcp9808) -include_directories (${PROJECT_SOURCE_DIR}/src/groveultrasonic) -include_directories (${PROJECT_SOURCE_DIR}/src/sx1276) -if (OPENZWAVE_FOUND) - include_directories(${PROJECT_SOURCE_DIR}/src/ozw) - include_directories(${OPENZWAVE_INCLUDE_DIRS}) -endif () +# 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 (temperature-sensor temperature-sensor.cxx "si7005;bmp180") +add_custom_example (humidity-sensor-example humidity-sensor.cxx "si7005") +add_custom_example (pressure-sensor-example pressure-sensor.cxx "bmp180") +add_custom_example (cO2-sensor-example cO2-sensor.cxx "t6713") +add_custom_example (adc-example adc-sensor.cxx ads1015) +add_custom_example (light-sensor-example light-sensor.cxx "si1132;max44009") +add_custom_example (light-controller-example light-controller.cxx "lp8860;ds1808lc;hlg150h") -target_link_libraries (hmc5883l-example hmc5883l ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveled-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveled-multi-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groverelay-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovelight-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovetemp-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovebutton-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groverotary-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveslide-example grove ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lcm1602-i2c-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lcm1602-parallel-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (jhd1313m1-lcd-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (buzzer-sound-example buzzer ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (my9221-ledbar-example my9221 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (my9221-updown-example my9221 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nrf24l01-transmitter-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nrf24l01-receiver-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nrf24l01-broadcast-example nrf24l01 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (es08a-example servo ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hcsr04-example hcsr04 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ssd1306-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ssd1308-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ssd1327-oled-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (max44000-example max44000 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mma7455-example mma7455 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (st7735-example st7735 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (max31855-example max31855 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (bmpx8x-example bmpx8x ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (stepmotor-example stepmotor ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (pulsensor-example pulsensor ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mic-example mic ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mpu9150-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (maxds3231m-example maxds3231m ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (max31723-example max31723 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (max5487-example max5487 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nrf8001-broadcast-example nrf8001 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nrf8001-helloworld-example nrf8001 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lpd8806-example lpd8806 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mlx90614-example mlx90614 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ecs1030-example ecs1030 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq2-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq3-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq4-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq5-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq6-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq7-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq8-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq9-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (tp401-example gas ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (tcs3414cs-example tcs3414cs ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (th02-example th02 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ttp223-example ttp223 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lsm303-example lsm303 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (joystick12-example joystick12 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lol-example lol ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (tsl2561-example tsl2561 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (htu21d-example htu21d ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mpl3115a2-example mpl3115a2 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ldt0028-example ldt0028 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (am2315-example am2315 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (itg3200-example itg3200 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (enc03r-example enc03r ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adc121c021-example adc121c021 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ds1307-example ds1307 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (a110x-example a110x ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (gp2y0a-example gp2y0a ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovemoisture-example grovemoisture ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveehr-example groveehr ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ta12200-example ta12200 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovelinefinder-example grovelinefinder ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovevdiv-example grovevdiv ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovewater-example grovewater ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (guvas12d-example guvas12d ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mpr121-example mpr121 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ublox6-example ublox6 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (yg1006-example yg1006 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (wt5001-example wt5001 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ppd42ns-example ppd42ns ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mq303a-example mq303a ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovespeaker-example grovespeaker ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (rfr359f-example rfr359f ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (biss0001-example biss0001 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (rotaryencoder-example rotaryencoder ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adxl345-example adxl345 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (rpr220-example rpr220 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (rpr220-intr-example rpr220 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mma7660-example mma7660 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (cjq4435-example cjq4435 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adxl335-example adxl335 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hmtrp-example hmtrp ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (nunchuck-example nunchuck ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (otp538u-example otp538u ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovecollision-example grovecollision ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveelectromagnet-example groveelectromagnet ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveemg-example groveemg ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveo2-example groveo2 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovegsr-example grovegsr ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ina132-example ina132 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (l298-example l298 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (l298-stepper-example l298 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (at42qt1070-example at42qt1070 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovemd-example grovemd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovemd-stepper-example grovemd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (pca9685-example pca9685 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveeldriver-example groveeldriver ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adafruitss-example adafruitss ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adafruitms1438-example adafruitms1438 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adafruitms1438-stepper-example adafruitms1438 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hx711-example hx711 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (flex-example flex ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (a110x-intr-example a110x ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mhz16-example mhz16 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (apds9002-example apds9002 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (waterlevel-example waterlevel ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (tm1637-example tm1637 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (zfm20-example zfm20 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (zfm20-register-example zfm20 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (uln200xa-example uln200xa ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovewfs-example grovewfs ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (isd1820-example isd1820 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (sx6119-example sx6119 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (si114x-example si114x ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (maxsonarez-example maxsonarez ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hm11-example hm11 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ht9170-example ht9170 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (h3lis331dl-example h3lis331dl ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ad8232-example ad8232 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovescam-example grovescam ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (m24lr64e-example m24lr64e ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovecircularled-example grovecircularled ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (rgbringcoder-example rgbringcoder ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (hp20x-example hp20x ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (pn532-example pn532 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (pn532-writeurl-example pn532 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (sainsmartks-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mpu60x0-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (ak8975-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lsm9ds0-example lsm9ds0 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (eboled-example i2clcd ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mpu9250-example mpu9150 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (loudness-example loudness ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mg811-example mg811 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (wheelencoder-example wheelencoder ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (sm130-example sm130 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (grovegprs-example grovegprs ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (lm35-example lm35 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (micsv89-example micsv89 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (xbee-example xbee ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (urm37-example urm37 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (urm37-uart-example urm37 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (adxrs610-example adxrs610 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (bma220-example bma220 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (dfrph-example dfrph ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (mcp9808-example mcp9808 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (groveultrasonic-example groveultrasonic ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (sx1276-lora-example sx1276 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (sx1276-fsk-example sx1276 ${CMAKE_THREAD_LIBS_INIT}) -if (OPENZWAVE_FOUND) - target_link_libraries (ozw-example ozw ${CMAKE_THREAD_LIBS_INIT}) -endif () diff --git a/examples/c++/joystick12-example.cxx b/examples/c++/joystick12.cxx similarity index 100% rename from examples/c++/joystick12-example.cxx rename to examples/c++/joystick12.cxx diff --git a/examples/c++/lol-example.cxx b/examples/c++/lol.cxx similarity index 100% rename from examples/c++/lol-example.cxx rename to examples/c++/lol.cxx diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 092b6ecc..508ab612 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -202,7 +202,12 @@ macro(upm_module_init) endif() endmacro(upm_module_init) -subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) +if (MODULE_LIST) + set(SUBDIRS ${MODULE_LIST}) + set(SUBDIRS ${SUBDIRS} upm) +else() + subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) +endif() foreach(subdir ${SUBDIRS}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt) add_subdirectory(${subdir})