Skip to content

Commit

Permalink
cmake: make header install for IIO/firmata optional
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Le Foll <[email protected]>
  • Loading branch information
arfoll committed Mar 20, 2016
1 parent abfd7fa commit 2e37475
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ option (BUILDSWIGNODE "Build swig node modules." ON)
option (BUILDSWIGJAVA "Build Java API." OFF)
option (USBPLAT "Detection USB platform." OFF)
option (FIRMATA "Add Firmata support to mraa." OFF)
option (IIO "Add IIO framework API." ON)
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
option (IPK "Generate IPK using CPack" OFF)
option (RPM "Generate RPM using CPack" OFF)
Expand Down
38 changes: 36 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ set (mraa_LIB_SRCS_NOAUTO
${PROJECT_SOURCE_DIR}/src/iio/iio.c
)

if (IIO)
set (mraa_LIB_SRCS_NOAUTO ${mraa_LIB_SRCS_NOAUTO} ${PROJECT_SOURCE_DIR}/src/iio/iio.c)
endif ()

set (mraa_LIB_X86_SRCS_NOAUTO
${PROJECT_SOURCE_DIR}/src/x86/x86.c
${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_d.c
Expand Down Expand Up @@ -122,8 +126,38 @@ set (mraa_LIB_GLOB_HEADERS
${PROJECT_SOURCE_DIR}/api/mraa.hpp
)

add_library (mraa ${mraa_LIB_SRCS})
set (mraa_LIB_HEADERS
${PROJECT_SOURCE_DIR}/api/mraa/aio.h
${PROJECT_SOURCE_DIR}/api/mraa/aio.hpp
${PROJECT_SOURCE_DIR}/api/mraa/gpio.h
${PROJECT_SOURCE_DIR}/api/mraa/gpio.hpp
${PROJECT_SOURCE_DIR}/api/mraa/pwm.h
${PROJECT_SOURCE_DIR}/api/mraa/pwm.hpp
${PROJECT_SOURCE_DIR}/api/mraa/spi.h
${PROJECT_SOURCE_DIR}/api/mraa/spi.hpp
${PROJECT_SOURCE_DIR}/api/mraa/uart.h
${PROJECT_SOURCE_DIR}/api/mraa/uart.hpp
${PROJECT_SOURCE_DIR}/api/mraa/common.h
${PROJECT_SOURCE_DIR}/api/mraa/common.hpp
${PROJECT_SOURCE_DIR}/api/mraa/types.h
${PROJECT_SOURCE_DIR}/api/mraa/types.hpp
)

if (IIO)
set (mraa_LIB_HEADERS ${mraa_LIB_HEADERS}
${PROJECT_SOURCE_DIR}/api/mraa/iio.h
${PROJECT_SOURCE_DIR}/api/mraa/iio.hpp
${PROJECT_SOURCE_DIR}/api/mraa/iio_kernel_headers.h
)
endif ()

if (FIRMATA)
set (mraa_LIB_HEADERS ${mraa_LIB_HEADERS}
${PROJECT_SOURCE_DIR}/api/mraa/firmata.h
)
endif()

add_library (mraa ${mraa_LIB_SRCS})

target_link_libraries (mraa ${mraa_LIBS})

Expand All @@ -134,7 +168,7 @@ set_target_properties(
VERSION ${mraa_VERSION_STRING}
)
install (FILES ${mraa_LIB_GLOB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/mraa/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mraa)
install (FILES ${mraa_LIB_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mraa)

macro (mraa_CREATE_INSTALL_PKGCONFIG generated_file install_location)
configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
Expand Down

0 comments on commit 2e37475

Please sign in to comment.