diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6654b8d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5d8119c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.20) +project(cieter C) + +set(CMAKE_C_STANDARD 17) + +find_package(LibArchive REQUIRED) + +include_directories(include) + +file(GLOB SRCS src/*.c) + +if(CMAKE_BUILD_TYPE STREQUAL Release) + add_compile_options(-O3 -flto) +endif() + +add_executable(cieter ${SRCS}) +target_link_libraries(cieter LibArchive::LibArchive) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9f8d4f0 --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +# =====CONFIG===== +BUILD_DIR := ./build +SRC_DIR := ./src +INCLUDE_DIR := ./include +TEST_DIR := test +CORES != nproc + + +# =====RECIPES===== +all: build + +.PHONY: cmake +cmake: $(BUILD_DIR)/Debug/Makefile +$(BUILD_DIR)/Debug/Makefile: CMakeLists.txt + @ cmake -B'$(BUILD_DIR)/Debug' -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 . + @ ln -sf '$(BUILD_DIR)/Debug/compile_commands.json' compile_commands.json + +.PHONY: cmake-test +cmake-test: $(BUILD_DIR)/Test/Makefile +$(BUILD_DIR)/Test/Makefile: CMakeLists.txt + @ cmake -B'$(BUILD_DIR)/Test' -DCMAKE_BUILD_TYPE=Test . + +.PHONY: build +build: cmake + @ make -C '$(BUILD_DIR)/Debug' + +.PHONY: build-test +build-test: cmake-test + @ make -C '$(BUILD_DIR)/Test' + +.PHONY: cmake-release +cmake-release: $(BUILD_DIR)/Release/Makefile +$(BUILD_DIR)/Release/Makefile: CMakeLists.txt + @ cmake -B'$(BUILD_DIR)/Release' -DCMAKE_BUILD_TYPE=Release . + +.PHONY: prod +prod: cmake-release + @ make -C '$(BUILD_DIR)/Release' + +.PHONY: test +test: build-test + @ $(MAKE) -C '$(BUILD_DIR)/Test' test ARGS=-j$(CORES) CTEST_OUTPUT_ON_FAILURE=1 + +.PHONY: clean +clean: + @ rm -rf '$(BUILD_DIR)' compile_commands.json + +# .PHONY: lint +# lint: +# @ clang-format --Werror -n $(SRCS) + +# .PHONY: format +# format: +# @ clang-format -i $(SRCS) diff --git a/include/dynarray.h b/include/dynarray.h index e552ec4..f8db530 100644 --- a/include/dynarray.h +++ b/include/dynarray.h @@ -1,5 +1,5 @@ -#ifndef VIETER_DYNARRAY -#define VIETER_DYNARRAY +#ifndef CIETER_DYNARRAY +#define CIETER_DYNARRAY #include #include diff --git a/include/package.h b/include/package.h index 09e91bd..3858a0f 100644 --- a/include/package.h +++ b/include/package.h @@ -1,5 +1,5 @@ -#ifndef VIETER_PACKAGE -#define VIETER_PACKAGE +#ifndef CIETER_PACKAGE +#define CIETER_PACKAGE #include #include diff --git a/include/package_info.h b/include/package_info.h index d71386e..200dd4a 100644 --- a/include/package_info.h +++ b/include/package_info.h @@ -1,5 +1,5 @@ -#ifndef VIETER_PACKAGE_INFO -#define VIETER_PACKAGE_INFO +#ifndef CIETER_PACKAGE_INFO +#define CIETER_PACKAGE_INFO #define FREE_STRING(sp) if (sp != NULL) free(sp) diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..af14ed5 --- /dev/null +++ b/src/main.c @@ -0,0 +1,3 @@ +int main() { + +}