This commit is contained in:
Evan Burkey 2021-09-02 15:04:19 -07:00
parent 2ec11ae8a5
commit e134e22224
10 changed files with 159 additions and 34 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@ input/
advent
compile_commands.json
.cache
cmake-build-debug
cmake-build-release
build

2
.idea/advent.iml generated Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

4
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/advent.iml" filepath="$PROJECT_DIR$/.idea/advent.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

112
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
<generated>
<config projectName="advent" targetName="advent" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="true">
<configurations>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
<configuration PROFILE_NAME="Release" ENABLED="true" CONFIG_NAME="Release" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="b07dea61-9ce6-4bea-9c31-27e5f3826c53" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.idea/advent.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/GNUmakefile" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MacroExpansionManager">
<option name="directoryName" value="1938zyxz" />
</component>
<component name="ProjectId" id="1xbNX7kuANn0Me5819c09SEpHhP" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cf.first.check.clang-format" value="false" />
<property name="cidr.known.project.marker" value="true" />
<property name="cmake.loaded.for.project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
</component>
<component name="RunManager">
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
</method>
</configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="advent" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="advent" TARGET_NAME="advent" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="advent" RUN_TARGET_NAME="advent">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="GradleAppRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.cpp.gradle.execution.GradleNativeBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="b07dea61-9ce6-4bea-9c31-27e5f3826c53" name="Changes" comment="" />
<created>1630619869539</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1630619869539</updated>
<workItem from="1630619872068" duration="346000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component>
</project>

17
CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.10)
project(advent C)
file(GLOB SRC src/*.c)
file(GLOB SRC2015 src/2015/*.c)
file(GLOB SRC2016 src/2016/*.c)
file(GLOB SRC2017 src/2017/*.c)
file(GLOB SRC2018 src/2018/*.c)
file(GLOB SRC2019 src/2019/*.c)
file(GLOB SRC2020 src/2020/*.c)
file(COPY input DESTINATION ${CMAKE_BINARY_DIR})
add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC2019} ${SRC2020})
target_link_libraries(advent PRIVATE bsd)
target_include_directories(advent PRIVATE include)

View File

@ -1,16 +0,0 @@
CFLAGS= -std=c99 -Wall -pedantic -Iinclude -g
LDFLAGS= -lbsd
OUT= -o advent
SRC= src/*.c \
src/2015/*.c \
src/2016/*.c \
src/2017/*.c \
src/2018/*.c \
src/2019/*.c \
src/2020/*.c
all:
cc ${CFLAGS} ${OUT} ${LDFLAGS} ${SRC}
clean:
rm advent

View File

@ -1,16 +0,0 @@
CFLAGS= -std=c99 -Wall -pedantic -Iinclude -g
LDFLAGS= ''
OUT= -o advent
SRC= src/*.c \
src/2015/*.c \
src/2016/*.c \
src/2017/*.c \
src/2018/*.c \
src/2019/*.c \
src/2020/*.c
all:
cc ${CFLAGS} ${OUT} ${LDFLAGS} ${SRC}
clean:
rm advent

View File

@ -4,9 +4,14 @@ Advent Of Code solutions using C99.
## Building
This project relies on several BSD extensions to the stdlib. BSDs should be able to build the project out of the box. If on a BSD, `make` is enough to build the project.
This project relies on several BSD extensions to the stdlib. BSDs should be able to build the project out of the box. Linux users will need `libbsd` installed. The package is called `libbsd-dev` on Debian-based systems.
Linux users will need `libbsd` installed and use GNU Make with the supplied GNUmakefile, which should be automatically used with a simple `make`.
Build the project using Cmake:
mkdir build
cd build
cmake ..
make
## Inputs