Skip to content

Commit

Permalink
Set up the build system for the demo app.
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-kirienko committed Aug 13, 2023
1 parent ff53049 commit 5569ee5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
30 changes: 29 additions & 1 deletion demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,32 @@

cmake_minimum_required(VERSION 3.20)

# TODO clang tidy etc
project(udpard_demo C)

# Set up static analysis.
set(NO_STATIC_ANALYSIS OFF CACHE BOOL "disable udpard static analysis")
if (NOT NO_STATIC_ANALYSIS)
# clang-tidy (separate config files per directory)
find_program(clang_tidy NAMES clang-tidy)
if (NOT clang_tidy)
message(FATAL_ERROR "Could not locate clang-tidy")
endif ()
message(STATUS "Using clang-tidy: ${clang_tidy}")
endif ()

# Define the LibUDPard static library build target. No special options are needed to use the library, it's very simple.
add_library(udpard_demo STATIC ${CMAKE_CURRENT_SOURCE_DIR}/../libudpard/udpard.c)
target_include_directories(udpard_demo INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../libudpard)

# Define the demo application build target and link it with the library.
add_executable(demo main.c)
target_link_libraries(demo PRIVATE udpard_demo)
set_target_properties(
demo
PROPERTIES
COMPILE_FLAGS "-Wall -Wextra -Werror -pedantic -Wdouble-promotion -Wswitch-enum -Wfloat-equal \
-Wundef -Wconversion -Wtype-limits -Wsign-conversion -Wcast-align -Wmissing-declarations"
C_STANDARD 11
C_EXTENSIONS OFF
C_CLANG_TIDY "${clang_tidy}"
)
3 changes: 3 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LibUDPard demo application

here be 🐉

0 comments on commit 5569ee5

Please sign in to comment.