CMakeLists: Added json platform options and build
Signed-off-by: Houman Brinjcargorabi <houman.brinjcargorabi@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c7570ff7c2
commit
ca0d740ee0
@@ -71,6 +71,7 @@ option (BUILDSWIGJAVA "Build Java API." OFF)
|
||||
option (USBPLAT "Detection USB platform." OFF)
|
||||
option (FIRMATA "Add Firmata support to mraa." OFF)
|
||||
option (ONEWIRE "Add Onewire support to mraa." ON)
|
||||
option (JSONPLAT "Add Platform loading via a json file." ON)
|
||||
option (IMRAA "Add Imraa support to mraa." OFF)
|
||||
option (FTDI4222 "Build with FTDI FT4222 subplatform support." OFF)
|
||||
option (IPK "Generate IPK using CPack" OFF)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# JSON-C_LIBRARIES - library directories
|
||||
|
||||
find_package (PkgConfig)
|
||||
pkg_check_modules (PC_JSON-C QUIET json-c)
|
||||
pkg_search_module (PC_JSON-C QUIET json-c json)
|
||||
|
||||
find_path (JSON-C_INCLUDE_DIR json.h HINTS ${PC_JSON-C_INCLUDEDIR}
|
||||
${PC_JSON-C_INCLUDE_DIRS} PATH_SUFFIXES json-c json)
|
||||
|
||||
@@ -92,8 +92,19 @@ set (mraa_LIB_MOCK_SRCS_NOAUTO
|
||||
${PROJECT_SOURCE_DIR}/src/mock/mock_board_i2c.c
|
||||
)
|
||||
|
||||
if (JSONPLAT)
|
||||
find_package (JSON-C QUIET)
|
||||
if (${JSON-C_FOUND})
|
||||
set (mraa_LIB_SRCS_NOAUTO
|
||||
${mraa_LIB_SRCS_NOAUTO}
|
||||
${PROJECT_SOURCE_DIR}/src/json/jsonplatform.c
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set (mraa_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
|
||||
if (X86PLAT)
|
||||
add_subdirectory(x86)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DX86PLAT=1")
|
||||
@@ -136,11 +147,24 @@ if (USBPLAT)
|
||||
add_subdirectory(usb)
|
||||
endif ()
|
||||
|
||||
if (IMRAA)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIMRAA=1")
|
||||
find_package (JSON-C REQUIRED)
|
||||
include_directories (${JSON-C_INCLUDE_DIR})
|
||||
set (mraa_LIBS ${mraa_LIBS} ${JSON-C_LIBRARIES})
|
||||
if (JSONPLAT OR IMRAA)
|
||||
find_package (JSON-C QUIET)
|
||||
if (NOT ${JSON-C_FOUND})
|
||||
if (IMRAA)
|
||||
message (FATAL_ERROR "Enabled IMRAA but JSON-C library not found")
|
||||
elseif (JSONPLAT)
|
||||
message (WARNING "Enabled JSONPLAT but JSON-C library not found: Ignoring JSONPLAT")
|
||||
endif ()
|
||||
else ()
|
||||
if (JSONPLAT)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DJSONPLAT=1")
|
||||
endif ()
|
||||
if (IMRAA)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DIMRAA=1")
|
||||
endif ()
|
||||
include_directories (${JSON-C_INCLUDE_DIR})
|
||||
set (mraa_LIBS ${mraa_LIBS} ${JSON-C_LIBRARIES})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set (mraa_LIB_SRCS
|
||||
|
||||
Reference in New Issue
Block a user