Private
Public Access
2
0

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:
Houman Brinjcargorabi
2016-06-14 19:04:12 +01:00
committed by Brendan Le Foll
parent c7570ff7c2
commit ca0d740ee0
3 changed files with 31 additions and 6 deletions

View File

@@ -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