You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.0 KiB
CMake
69 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.25)
|
|
project(GlucoseMonitor C)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
add_executable(glucose_monitor src/main.c libs/log.c/src/log.c)
|
|
|
|
# Find the pkg-config package
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
# Use pkg-config to find cJSON
|
|
pkg_check_modules(CJSON REQUIRED libcjson)
|
|
|
|
# Use pkg-config to find curl
|
|
pkg_check_modules(LIBCURL REQUIRED libcurl)
|
|
|
|
# Use pkg-config to find inih
|
|
pkg_check_modules(INIH REQUIRED inih)
|
|
|
|
# Link against the cJSON library
|
|
target_link_libraries(glucose_monitor PRIVATE ${LIBCURL_LIBRARIES} ${CJSON_LIBRARIES} ${INIH_LIBRARIES})
|
|
|
|
# Include cJSON's include directories
|
|
target_include_directories(
|
|
glucose_monitor
|
|
PRIVATE
|
|
libs/log.c/src
|
|
${LIBCURL_LIBRARIES}
|
|
${CJSON_INCLUDE_DIRS}
|
|
${INIH_INCLUDE_DIRS}
|
|
)
|
|
|
|
if(ENABLE_SSD1305_DISPLAY)
|
|
target_compile_definitions(glucose_monitor PRIVATE ENABLE_SSD1305_DISPLAY)
|
|
|
|
target_sources(
|
|
glucose_monitor
|
|
PRIVATE
|
|
libs/waveshare-ssd1305/OLED/ssd1305.c
|
|
libs/waveshare-ssd1305/Config/DEV_Config.h
|
|
)
|
|
|
|
include_directories(
|
|
libs/waveshare-ssd1305/OLED/
|
|
libs/waveshare-ssd1305/Config/
|
|
)
|
|
|
|
set(SSD1305_WAVESHARE_LIB_SRC libs/waveshare-ssd1305/OLED/ssd1305.c)
|
|
add_library(SSD1305_WAVESHARE_LIB STATIC ${SSD1305_WAVESHARE_LIB_SRC})
|
|
target_compile_definitions(SSD1305_WAVESHARE_LIB PRIVATE USE_DEV_LIB)
|
|
target_compile_definitions(SSD1305_WAVESHARE_LIB PRIVATE USE_SPI)
|
|
|
|
set(CONFIG_WAVESHARE_LIB_SRC libs/waveshare-ssd1305/Config/DEV_Config.c)
|
|
add_library(CONFIG_WAVESHARE_LIB STATIC ${CONFIG_WAVESHARE_LIB_SRC})
|
|
target_compile_definitions(CONFIG_WAVESHARE_LIB PRIVATE USE_DEV_LIB)
|
|
target_compile_definitions(CONFIG_WAVESHARE_LIB PRIVATE USE_SPI)
|
|
|
|
target_link_libraries(glucose_monitor PRIVATE m SSD1305_WAVESHARE_LIB CONFIG_WAVESHARE_LIB)
|
|
|
|
find_library(LGPIO_LIBRARY lgpio)
|
|
if(LGPIO_LIBRARY)
|
|
message(STATUS "Found lgpio library at: ${LGPIO_LIBRARY}")
|
|
target_link_libraries(glucose_monitor PRIVATE lgpio)
|
|
link_directories(${LGPIO_INCLUDE_DIR})
|
|
else()
|
|
message(ERROR "lgpio library not found")
|
|
endif()
|
|
endif()
|