Initial commit
This commit is contained in:
56
.gitignore
vendored
Normal file
56
.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Directories
|
||||
build/
|
||||
build-*/
|
||||
cmake-build-*/
|
||||
.cache/
|
||||
out/
|
||||
out/Debug/
|
||||
out/Release/
|
||||
|
||||
# Cmake files
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
CTestTestfile.cmake
|
||||
Testing/
|
||||
compile_commands.json
|
||||
../compile_commands.json
|
||||
build/compile_commands.json
|
||||
|
||||
# Make / Ninja
|
||||
Makefile
|
||||
*.ninja
|
||||
*.ninja_deps
|
||||
*.ninja_log
|
||||
rules.ninja
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.obj
|
||||
*.lo
|
||||
*.la
|
||||
|
||||
# Binaries
|
||||
*.out
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
*.a
|
||||
|
||||
# Debug / Sanitizer
|
||||
*.dSYM/
|
||||
*.gcno
|
||||
*.gcda
|
||||
*.gcov
|
||||
|
||||
# Editors
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Git
|
||||
COMMIT_MESSAGE
|
||||
39
CMakeLists.txt
Normal file
39
CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(calculator VERSION 1.0 LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# Export compile_commands.json (para clangd)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
)
|
||||
|
||||
|
||||
include_directories(include)
|
||||
|
||||
add_library(arraylist_lib
|
||||
src/arraylist.c
|
||||
)
|
||||
|
||||
add_executable(arraylist_main src/main.c)
|
||||
|
||||
target_link_libraries(arraylist_main arraylist_lib)
|
||||
|
||||
function(enable_sanitizers target)
|
||||
target_compile_options(${target} PRIVATE -fsanitize=address -fno-omit-frame-pointer)
|
||||
target_link_options(${target} PRIVATE -fsanitize=address)
|
||||
endfunction()
|
||||
|
||||
|
||||
# ------------------------
|
||||
# Testing
|
||||
# ------------------------
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
|
||||
0
include/arraylist.h
Normal file
0
include/arraylist.h
Normal file
0
src/arraylist.c
Normal file
0
src/arraylist.c
Normal file
0
src/main.c
Normal file
0
src/main.c
Normal file
15
test/CMakeLists.txt
Normal file
15
test/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
find_package(cmocka REQUIRED)
|
||||
|
||||
add_executable(test_arraylist test_arraylist.c)
|
||||
|
||||
target_link_libraries(test_arraylist
|
||||
arena_lib
|
||||
cmocka::cmocka
|
||||
)
|
||||
|
||||
enable_sanitizers(test_arraylist)
|
||||
|
||||
target_compile_options(test_arraylist PRIVATE -fsanitize=address -fno-omit-frame-pointer)
|
||||
target_link_options(test_arraylist PRIVATE -fsanitize=address)
|
||||
|
||||
add_test(NAME arraylist_tests COMMAND arraylists_arena)
|
||||
0
test/test_arraylist.c
Normal file
0
test/test_arraylist.c
Normal file
Reference in New Issue
Block a user