Skip to content

Commit

Permalink
docs: add cmake example
Browse files Browse the repository at this point in the history
  • Loading branch information
headblockhead committed Dec 7, 2024
1 parent 85ecc1d commit 5d32600
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@ cmake_minimum_required(VERSION 3.12)

project(squirrel)

# Override this in your build of the library! Otherwise, it will default to 1 key.
# target_compile_definitions(squirrel PUBLIC SQUIRREL_KEYCOUNT=your_keycount)
# Override this using the above line in your build of the library! Otherwise, it
# will default to 1 key.
add_compile_definitions(SQUIRREL_KEYCOUNT=1)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Og)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Og)
else()
add_compile_options(-Os)
add_compile_options(-Os)
endif()

# Generate a static library archive.
add_library(squirrel STATIC
src/squirrel.c
src/squirrel_quantum.c
src/squirrel_keyboard.c
src/squirrel_key.c
src/squirrel_consumer.c
src/squirrel_init.c
src/squirrel_keymap.c
src/squirrel_split.c
)
add_library(
squirrel STATIC
src/squirrel.c
src/squirrel_quantum.c
src/squirrel_keyboard.c
src/squirrel_key.c
src/squirrel_consumer.c
src/squirrel_init.c
src/squirrel_keymap.c
src/squirrel_split.c)

target_include_directories(squirrel PUBLIC include)
set_target_properties(squirrel PROPERTIES PUBLIC_HEADER include/squirrel.h)

if (BUILD_TESTING)
add_subdirectory(tests)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()

0 comments on commit 5d32600

Please sign in to comment.