diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..8cc6964 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,16 @@ +# https://clang.llvm.org/extra/clang-tidy/checks/list.html +Checks: '-*, + bugprone-*, + cert-*, + misc-*, + concurrency-*, + performance-*, + portability-*, + readability-*, + clang-analyzer-*, + ' +# CheckOptions: + +WarningsAsErrors: '*' +HeaderFilterRegex: '.' +FormatStyle: 'file' diff --git a/.cmake/get_cpm.cmake b/.cmake/get_cpm.cmake new file mode 100644 index 0000000..e18d37b --- /dev/null +++ b/.cmake/get_cpm.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors + +set(CPM_DOWNLOAD_VERSION 0.40.8) +set(CPM_HASH_SUM "78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791") + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) + +file(DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} +) + +include(${CPM_DOWNLOAD_LOCATION}) diff --git a/.gitignore b/.gitignore index 7d93d3a..e90110b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,13 @@ +# +# Project +# + +.build/ + +# # ---> C +# + # Prerequisites *.d @@ -52,7 +61,10 @@ Module.symvers Mkfile.old dkms.conf +# # ---> C++ +# + # Prerequisites *.d @@ -86,7 +98,10 @@ dkms.conf *.out *.app +# # ---> CMake +# + CMakeLists.txt.user CMakeCache.txt CMakeFiles @@ -99,4 +114,3 @@ compile_commands.json CTestTestfile.cmake _deps CMakeUserPresets.json - diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2baa168 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 3.12) + +project("C Rogue Game" VERSION "1.0.0" LANGUAGES "C" + DESCRIPTION "A rogue-like game written in C99") + +include(.cmake/get_cpm.cmake) +CPMAddPackage("gh:robertefry/RockHopperStandards@1.3.6") + +set(BINARY_NAME "c_rogue") +add_executable(${BINARY_NAME} "") +target_compile_features(${BINARY_NAME} PUBLIC c_std_99) + +target_rockhopper_standards(${BINARY_NAME}) + +target_link_libraries(${BINARY_NAME} PUBLIC "ncurses") + +file(GLOB_RECURSE BINARY_HEADERS "include/*.h") +file(GLOB_RECURSE BINARY_SOURCES "src/*.c" "src/*.h") +target_sources(${BINARY_NAME} PUBLIC ${BINARY_HEADERS} PRIVATE ${BINARY_SOURCES}) + +message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..8e91d14 --- /dev/null +++ b/src/main.c @@ -0,0 +1,7 @@ + +#include + +int main(void) +{ + printf("Hello, World!\n"); +}