From ae5dd6c930ccef19ad313aa903f0528aa803ee80 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Apr 2022 11:59:06 +0200 Subject: [PATCH] Add CMake config --- .gitignore | 62 ++++---------------- CMakeLists.txt | 27 +++++++++ array.c => dragonstd/array.c | 0 array.h => dragonstd/array.h | 6 +- {bits => dragonstd/bits}/callback.h | 0 {bits => dragonstd/bits}/compare.c | 0 {bits => dragonstd/bits}/compare.h | 0 {bits => dragonstd/bits}/wrappers.h | 0 flag.c => dragonstd/flag.c | 0 flag.h => dragonstd/flag.h | 0 list.c => dragonstd/list.c | 0 list.h => dragonstd/list.h | 4 +- map.c => dragonstd/map.c | 0 map.h => dragonstd/map.h | 0 queue.c => dragonstd/queue.c | 0 queue.h => dragonstd/queue.h | 0 refcount.c => dragonstd/refcount.c | 0 refcount.h => dragonstd/refcount.h | 0 {test => dragonstd/test}/.gitignore | 1 + {test => dragonstd/test}/Makefile | 0 {test => dragonstd/test}/test_array.c | 0 {test => dragonstd/test}/test_flag.c | 0 {test => dragonstd/test}/test_list.c | 0 {test => dragonstd/test}/test_queue.c | 0 {test => dragonstd/test}/test_refcount_map.c | 0 {test => dragonstd/test}/test_tree.c | 0 tree.c => dragonstd/tree.c | 0 tree.h => dragonstd/tree.h | 4 +- 28 files changed, 46 insertions(+), 58 deletions(-) create mode 100644 CMakeLists.txt rename array.c => dragonstd/array.c (100%) rename array.h => dragonstd/array.h (97%) rename {bits => dragonstd/bits}/callback.h (100%) rename {bits => dragonstd/bits}/compare.c (100%) rename {bits => dragonstd/bits}/compare.h (100%) rename {bits => dragonstd/bits}/wrappers.h (100%) rename flag.c => dragonstd/flag.c (100%) rename flag.h => dragonstd/flag.h (100%) rename list.c => dragonstd/list.c (100%) rename list.h => dragonstd/list.h (96%) rename map.c => dragonstd/map.c (100%) rename map.h => dragonstd/map.h (100%) rename queue.c => dragonstd/queue.c (100%) rename queue.h => dragonstd/queue.h (100%) rename refcount.c => dragonstd/refcount.c (100%) rename refcount.h => dragonstd/refcount.h (100%) rename {test => dragonstd/test}/.gitignore (88%) rename {test => dragonstd/test}/Makefile (100%) rename {test => dragonstd/test}/test_array.c (100%) rename {test => dragonstd/test}/test_flag.c (100%) rename {test => dragonstd/test}/test_list.c (100%) rename {test => dragonstd/test}/test_queue.c (100%) rename {test => dragonstd/test}/test_refcount_map.c (100%) rename {test => dragonstd/test}/test_tree.c (100%) rename tree.c => dragonstd/tree.c (100%) rename tree.h => dragonstd/tree.h (96%) diff --git a/.gitignore b/.gitignore index c6127b3..5a5f2d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,52 +1,12 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps *.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cb66e46 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.14) +project(Dragonstd) + +add_compile_options( + -Wall + -Wextra + -Werror +) + +add_library(dragonstd + dragonstd/array.c + dragonstd/flag.c + dragonstd/map.c + dragonstd/list.c + dragonstd/queue.c + dragonstd/refcount.c + dragonstd/tree.c + dragonstd/bits/compare.c +) + +target_link_libraries(dragonstd + pthread +) + +target_include_directories(dragonstd + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" +) diff --git a/array.c b/dragonstd/array.c similarity index 100% rename from array.c rename to dragonstd/array.c diff --git a/array.h b/dragonstd/array.h similarity index 97% rename from array.h rename to dragonstd/array.h index 1c5178d..eb10058 100644 --- a/array.h +++ b/dragonstd/array.h @@ -10,9 +10,9 @@ #ifndef _DRAGONSTD_ARRAY_H_ // include guard #define _DRAGONSTD_ARRAY_H_ -#include // for size_t -#include // for ssize_t -#include "bits/compare.h" // for cmp_ref (not used in file) +#include // for size_t +#include // for ssize_t +#include "bits/compare.h" // for cmp_ref (not used in file) typedef struct { /* public */ diff --git a/bits/callback.h b/dragonstd/bits/callback.h similarity index 100% rename from bits/callback.h rename to dragonstd/bits/callback.h diff --git a/bits/compare.c b/dragonstd/bits/compare.c similarity index 100% rename from bits/compare.c rename to dragonstd/bits/compare.c diff --git a/bits/compare.h b/dragonstd/bits/compare.h similarity index 100% rename from bits/compare.h rename to dragonstd/bits/compare.h diff --git a/bits/wrappers.h b/dragonstd/bits/wrappers.h similarity index 100% rename from bits/wrappers.h rename to dragonstd/bits/wrappers.h diff --git a/flag.c b/dragonstd/flag.c similarity index 100% rename from flag.c rename to dragonstd/flag.c diff --git a/flag.h b/dragonstd/flag.h similarity index 100% rename from flag.h rename to dragonstd/flag.h diff --git a/list.c b/dragonstd/list.c similarity index 100% rename from list.c rename to dragonstd/list.c diff --git a/list.h b/dragonstd/list.h similarity index 96% rename from list.h rename to dragonstd/list.h index 9e03023..d14c441 100644 --- a/list.h +++ b/dragonstd/list.h @@ -8,8 +8,8 @@ #ifndef _DRAGONSTD_LIST_H_ // include guard #define _DRAGONSTD_LIST_H_ -#include // for bool -#include "bits/compare.h" // for cmp_ref (not used in file) +#include // for bool +#include "bits/compare.h" // for cmp_ref (not used in file) #define LIST_ITERATE(list, node) for (ListNode *node = (list)->fst; node != NULL; node = node->nxt) diff --git a/map.c b/dragonstd/map.c similarity index 100% rename from map.c rename to dragonstd/map.c diff --git a/map.h b/dragonstd/map.h similarity index 100% rename from map.h rename to dragonstd/map.h diff --git a/queue.c b/dragonstd/queue.c similarity index 100% rename from queue.c rename to dragonstd/queue.c diff --git a/queue.h b/dragonstd/queue.h similarity index 100% rename from queue.h rename to dragonstd/queue.h diff --git a/refcount.c b/dragonstd/refcount.c similarity index 100% rename from refcount.c rename to dragonstd/refcount.c diff --git a/refcount.h b/dragonstd/refcount.h similarity index 100% rename from refcount.h rename to dragonstd/refcount.h diff --git a/test/.gitignore b/dragonstd/test/.gitignore similarity index 88% rename from test/.gitignore rename to dragonstd/test/.gitignore index e006b50..4ddaf26 100644 --- a/test/.gitignore +++ b/dragonstd/test/.gitignore @@ -5,3 +5,4 @@ test_queue test_map test_flag test_refcount_map +!Makefile diff --git a/test/Makefile b/dragonstd/test/Makefile similarity index 100% rename from test/Makefile rename to dragonstd/test/Makefile diff --git a/test/test_array.c b/dragonstd/test/test_array.c similarity index 100% rename from test/test_array.c rename to dragonstd/test/test_array.c diff --git a/test/test_flag.c b/dragonstd/test/test_flag.c similarity index 100% rename from test/test_flag.c rename to dragonstd/test/test_flag.c diff --git a/test/test_list.c b/dragonstd/test/test_list.c similarity index 100% rename from test/test_list.c rename to dragonstd/test/test_list.c diff --git a/test/test_queue.c b/dragonstd/test/test_queue.c similarity index 100% rename from test/test_queue.c rename to dragonstd/test/test_queue.c diff --git a/test/test_refcount_map.c b/dragonstd/test/test_refcount_map.c similarity index 100% rename from test/test_refcount_map.c rename to dragonstd/test/test_refcount_map.c diff --git a/test/test_tree.c b/dragonstd/test/test_tree.c similarity index 100% rename from test/test_tree.c rename to dragonstd/test/test_tree.c diff --git a/tree.c b/dragonstd/tree.c similarity index 100% rename from tree.c rename to dragonstd/tree.c diff --git a/tree.h b/dragonstd/tree.h similarity index 96% rename from tree.h rename to dragonstd/tree.h index 730f5dc..064906d 100644 --- a/tree.h +++ b/dragonstd/tree.h @@ -14,8 +14,8 @@ #ifndef _DRAGONSTD_TREE_H_ // include guard #define _DRAGONSTD_TREE_H_ -#include // for bool -#include "bits/compare.h" // for cmp_ref (not used in file) +#include // for bool +#include "bits/compare.h" // for cmp_ref (not used in file) typedef struct TreeNode { /* public */ -- 2.44.0