mirror of
				https://github.com/eclipse/upm.git
				synced 2025-11-04 17:14:54 +03:00 
			
		
		
		
	examples: Handle additional example dependencies
Dependencies added via 'TARGETS' in add_example are 'in addition to' the
dependency provided by the example filename.
    * Small change to examples/CMakeLists.txt to handle additional
      dependencies
    * Prefix 'interfaces-' onto the interfaces examples
Signed-off-by: Noel Eck <noel.eck@intel.com>
			
			
This commit is contained in:
		@@ -9,8 +9,8 @@
 | 
			
		||||
#       <library>-[additional].c(xx)
 | 
			
		||||
#       library: Name of UPM library required by example
 | 
			
		||||
#       -additional: Any other string used to identify the example
 | 
			
		||||
#   TARGETS - If TARGETS is set, ignore the <library>-[additional] syntax and
 | 
			
		||||
#       use only the provided TARGETS as target name dependencies
 | 
			
		||||
#   TARGETS - Additional dependency target/s required to BUILD/RUN this example.  If TARGETS is
 | 
			
		||||
#       set, these are in addition to the dependency library provided by the example filename.
 | 
			
		||||
#   SUFFIX - Provide a means to differentiate between C/C++ dependency targets and
 | 
			
		||||
#       example names.  Leave empty for CXX examples. Use '-c' for c targets.
 | 
			
		||||
#           SUFFIX  Example file  Dependency target  Example binary
 | 
			
		||||
@@ -59,12 +59,13 @@ function (add_example example_src)
 | 
			
		||||
    string (REPLACE "-" ";" split_name ${example_name})
 | 
			
		||||
    list (GET split_name 0 library_name)
 | 
			
		||||
 | 
			
		||||
    # If TARGETS is not provided, parse dependency target name from example_src
 | 
			
		||||
    if (NOT add_example_TARGETS)
 | 
			
		||||
        # For sensorfoo, lib_target_names = sensorfoo-c
 | 
			
		||||
        set (lib_target_names "${library_name}${add_example_SUFFIX}")
 | 
			
		||||
    else ()
 | 
			
		||||
        set (lib_target_names "${add_example_TARGETS}")
 | 
			
		||||
    # Parse dependency target name from example_src filename (add on suffix)
 | 
			
		||||
    # For sensorfoo, lib_target_names = sensorfoo-c
 | 
			
		||||
    set (lib_target_names "${library_name}${add_example_SUFFIX}")
 | 
			
		||||
 | 
			
		||||
    # If TARGETS is provided, add additional dependency targets
 | 
			
		||||
    if (add_example_TARGETS)
 | 
			
		||||
        list (APPEND lib_target_names "${add_example_TARGETS}")
 | 
			
		||||
    endif ()
 | 
			
		||||
 | 
			
		||||
    # Unfortunately, c++ and c library targets are not named the same. If
 | 
			
		||||
 
 | 
			
		||||
@@ -4,15 +4,15 @@ file (GLOB example_src_list RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cxx")
 | 
			
		||||
# - Handle special cases here --------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# Test humidity interface for 2 sensor libraries
 | 
			
		||||
add_example(humidity-sensor.cxx TARGETS si7005 bmp280)
 | 
			
		||||
add_example(interfaces-humiditysensor.cxx TARGETS si7005 bmp280)
 | 
			
		||||
# Test pressure interface for 2 sensor libraries
 | 
			
		||||
add_example(pressure-sensor.cxx TARGETS bmp280 bmpx8x)
 | 
			
		||||
add_example(interfaces-pressuresensor.cxx TARGETS bmp280 bmpx8x)
 | 
			
		||||
# Test temperature interface for 3 sensor libraries
 | 
			
		||||
add_example(temperature-sensor.cxx TARGETS bmp280 bmpx8x si7005)
 | 
			
		||||
add_example(interfaces-temperaturesensor.cxx TARGETS bmp280 bmpx8x si7005)
 | 
			
		||||
# Test light interface for 2 sensor libraries
 | 
			
		||||
add_example(light-sensor.cxx TARGETS si1132 max44009)
 | 
			
		||||
add_example(interfaces-lightsensor.cxx TARGETS si1132 max44009)
 | 
			
		||||
# Test light controller interface for 3 sensor libraries
 | 
			
		||||
add_example(light-controller.cxx TARGETS lp8860 ds1808lc hlg150h)
 | 
			
		||||
add_example(interfaces-lightcontroller.cxx TARGETS lp8860 ds1808lc hlg150h)
 | 
			
		||||
 | 
			
		||||
# - Create an executable for all other src files in this directory -------------
 | 
			
		||||
foreach (_example_src ${example_src_list})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user