<commit_before>set (mraa_LIB_INCLUDE_DIRS
  ${PROJECT_SOURCE_DIR}/api
  ${PROJECT_SOURCE_DIR}/api/mraa
  ${PROJECT_SOURCE_DIR}/include
)

if (FIRMATA)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFIRMATA=1")
  add_subdirectory (firmata)
endif ()

if (ONEWIRE)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DONEWIRE=1")
  add_subdirectory (uart_ow)
endif ()

include_directories(
  ${mraa_LIB_INCLUDE_DIRS}
)

set (mraa_LIB_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/mraa.c
  ${PROJECT_SOURCE_DIR}/src/gpio/gpio.c
  ${PROJECT_SOURCE_DIR}/src/i2c/i2c.c
  ${PROJECT_SOURCE_DIR}/src/pwm/pwm.c
  ${PROJECT_SOURCE_DIR}/src/spi/spi.c
  ${PROJECT_SOURCE_DIR}/src/aio/aio.c
  ${PROJECT_SOURCE_DIR}/src/uart/uart.c
  ${mraa_LIB_SRCS_NOAUTO}
)

if (NOT PERIPHERALMAN)
  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
  ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c
  ${PROJECT_SOURCE_DIR}/src/x86/up.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_joule_expansion.c
)

message (STATUS "INFO - Adding support for platform ${MRAAPLATFORMFORCE}")

#keywords in if statements are case sensitive
if (NOT ${MRAAPLATFORMFORCE} STREQUAL "ALL")
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dx${MRAAPLATFORMFORCE} -DMRAA_PLATFORM_FORCE=${MRAAPLATFORMFORCE}")
  if (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN2")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN1")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_d.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_DE3815")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_EDISON_FAB_C")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_MINNOWBOARD_MAX")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_NUC5")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_SOFIA_3GR")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_CHERRYHILLS")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_UP")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/up.c)
  elseif( ${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_JOULE_EXPANSION")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_joule_expansion.c)
  else ()
    message (FATAL_ERROR "Unknown x86 platform enabled!")
  endif ()
else ()
    message (STATUS "INFO - Adding support for all platforms")
endif ()

set (mraa_LIB_ARM_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/arm/arm.c
  ${PROJECT_SOURCE_DIR}/src/arm/96boards.c
  ${PROJECT_SOURCE_DIR}/src/arm/raspberry_pi.c
  ${PROJECT_SOURCE_DIR}/src/arm/beaglebone.c
  ${PROJECT_SOURCE_DIR}/src/arm/phyboard.c
  ${PROJECT_SOURCE_DIR}/src/arm/banana.c
  ${PROJECT_SOURCE_DIR}/src/arm/de_nano_soc.c
)

set (mraa_LIB_MOCK_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/mock/mock.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_gpio.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_aio.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_i2c.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_spi.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_uart.c
)

set (mraa_LIB_PERIPHERALMAN_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman.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")
endif()

if (ARMPLAT)
  add_subdirectory(arm)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DARMPLAT=1")
endif()

if (MOCKPLAT)
  add_subdirectory(mock)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMOCKPLAT=1")
  if (MSYS)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMSYS=1")
  endif ()
endif()

if (PERIPHERALMAN)
  add_subdirectory(peripheralman)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPERIPHERALMAN=1")
  set (mraa_LIBS ${mraa_LIBS} -l/home/brendan/git/mraa/libperipheralman.so)
endif()

if (USBPLAT)
  message (STATUS "INFO - Adding USB platforms")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSBPLAT=1")
  if (FTDID2xx)
    find_package (Ftd2xx)
    if (${LIBFTD2XX_FOUND})
      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTDID2XX=1")<commit_msg>src/CMakeLists.txt: Use AndroidThings find_package<commit_after>set (mraa_LIB_INCLUDE_DIRS
  ${PROJECT_SOURCE_DIR}/api
  ${PROJECT_SOURCE_DIR}/api/mraa
  ${PROJECT_SOURCE_DIR}/include
)

if (FIRMATA)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFIRMATA=1")
  add_subdirectory (firmata)
endif ()

if (ONEWIRE)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DONEWIRE=1")
  add_subdirectory (uart_ow)
endif ()

include_directories(
  ${mraa_LIB_INCLUDE_DIRS}
)

set (mraa_LIB_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/mraa.c
  ${PROJECT_SOURCE_DIR}/src/gpio/gpio.c
  ${PROJECT_SOURCE_DIR}/src/i2c/i2c.c
  ${PROJECT_SOURCE_DIR}/src/pwm/pwm.c
  ${PROJECT_SOURCE_DIR}/src/spi/spi.c
  ${PROJECT_SOURCE_DIR}/src/aio/aio.c
  ${PROJECT_SOURCE_DIR}/src/uart/uart.c
  ${mraa_LIB_SRCS_NOAUTO}
)

if (NOT PERIPHERALMAN)
  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
  ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c
  ${PROJECT_SOURCE_DIR}/src/x86/up.c
  ${PROJECT_SOURCE_DIR}/src/x86/intel_joule_expansion.c
)

message (STATUS "INFO - Adding support for platform ${MRAAPLATFORMFORCE}")

#keywords in if statements are case sensitive
if (NOT ${MRAAPLATFORMFORCE} STREQUAL "ALL")
  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dx${MRAAPLATFORMFORCE} -DMRAA_PLATFORM_FORCE=${MRAAPLATFORMFORCE}")
  if (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN2")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_g.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_GALILEO_GEN1")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_galileo_rev_d.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_DE3815")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_de3815.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_EDISON_FAB_C")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_edison_fab_c.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_MINNOWBOARD_MAX")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_minnow_byt_compatible.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_NUC5")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_nuc5.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_SOFIA_3GR")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_sofia_3gr.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_CHERRYHILLS")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_cherryhills.c)
  elseif (${MRAAPLATFORMFORCE} STREQUAL "MRAA_UP")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/up.c)
  elseif( ${MRAAPLATFORMFORCE} STREQUAL "MRAA_INTEL_JOULE_EXPANSION")
    set (mraa_LIB_X86_SRCS_NOAUTO ${PROJECT_SOURCE_DIR}/src/x86/x86.c ${PROJECT_SOURCE_DIR}/src/x86/intel_joule_expansion.c)
  else ()
    message (FATAL_ERROR "Unknown x86 platform enabled!")
  endif ()
else ()
    message (STATUS "INFO - Adding support for all platforms")
endif ()

set (mraa_LIB_ARM_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/arm/arm.c
  ${PROJECT_SOURCE_DIR}/src/arm/96boards.c
  ${PROJECT_SOURCE_DIR}/src/arm/raspberry_pi.c
  ${PROJECT_SOURCE_DIR}/src/arm/beaglebone.c
  ${PROJECT_SOURCE_DIR}/src/arm/phyboard.c
  ${PROJECT_SOURCE_DIR}/src/arm/banana.c
  ${PROJECT_SOURCE_DIR}/src/arm/de_nano_soc.c
)

set (mraa_LIB_MOCK_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/mock/mock.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_gpio.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_aio.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_i2c.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_spi.c
  ${PROJECT_SOURCE_DIR}/src/mock/mock_board_uart.c
)

set (mraa_LIB_PERIPHERALMAN_SRCS_NOAUTO
  ${PROJECT_SOURCE_DIR}/src/peripheralman/peripheralman.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")
endif()

if (ARMPLAT)
  add_subdirectory(arm)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DARMPLAT=1")
endif()

if (MOCKPLAT)
  add_subdirectory(mock)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMOCKPLAT=1")
  if (MSYS)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMSYS=1")
  endif ()
endif()

if (PERIPHERALMAN)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPERIPHERALMAN=1")
  # Use the find_package provided by Android Things.  Make sure this is
  # available in CMAKE_MODULE_PATH.
  find_package(AndroidThings REQUIRED)
  set (mraa_LIBS ${mraa_LIBS} ${ANDROIDTHINGS_LIBRARIES})
  add_subdirectory(peripheralman)
endif()

if (USBPLAT)
  message (STATUS "INFO - Adding USB platforms")
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSBPLAT=1")
  if (FTDID2xx)
    find_package (Ftd2xx)
    if (${LIBFTD2XX_FOUND})
      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTDID2XX=1")
{'fraction_non_alphanumeric': 0.13155108523028058, 'fraction_numerical': 0.026821951649902948, 'mean_word_length': 5.971094710947109, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5242892', 'n_tokens_mistral': 5400, 'n_tokens_neox': 5213, 'n_words': 564}