add array.h/cpp

This commit is contained in:
2025-02-27 16:18:38 +08:00
parent f44aaa81b2
commit d0fd9eb4f0
7 changed files with 410 additions and 0 deletions

View File

@@ -1,9 +1,42 @@
cmake_minimum_required(VERSION 3.11) # FetchContent
project(keycode)
include(FetchContent)
include("cmake/Check-from_chars.cmake")
set (LIBS fmt)
if (NOT DEFINED OPTCON_LOCAL_BUILD)
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 123913715afeb8a437e6388b4473fcc4753e1c9a # 11.1.4
)
FetchContent_MakeAvailable(fmt)
endif()
if (NOT FROM_CHARS_WORKS)
FetchContent_Declare(
fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float
GIT_TAG 77cc847c842c49e7e3477c1e95da2b6540166d66 # 8.0.0
)
FetchContent_MakeAvailable(fast_float)
list(APPEND LIBS fast_float)
add_definitions(-DUSE_FAST_FLOAT)
endif()
add_library(keycode STATIC
src/array.cpp
src/keycode.c
)
target_link_libraries(keycode ${LIBS})
target_include_directories(keycode
PUBLIC src
)