From 40101b71a46c6a7255d9212405b77ec6b52329f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 4 Dec 2024 19:26:04 +0100 Subject: [PATCH] Change project to CMake --- .gitignore | 1 + AdventOfCode2024/AdventOfCode2024.cpp | 10 +- AdventOfCode2024/AdventOfCode2024.h | 18 ++ AdventOfCode2024/AdventOfCode2024.sln | 41 ---- AdventOfCode2024/AdventOfCode2024.vcxproj | 178 ----------------- .../AdventOfCode2024.vcxproj.filters | 144 -------------- AdventOfCode2024/CMakeLists.txt | 21 ++ AdventOfCode2024/CMakePresets.json | 61 ++++++ AdventOfCode2024/UnitTests/UnitTests.vcxproj | 187 ------------------ .../UnitTests/UnitTests.vcxproj.filters | 48 ----- AdventOfCode2024/UnitTests/pch.cpp | 5 - AdventOfCode2024/UnitTests/pch.h | 12 -- 12 files changed, 106 insertions(+), 620 deletions(-) create mode 100644 AdventOfCode2024/AdventOfCode2024.h delete mode 100644 AdventOfCode2024/AdventOfCode2024.sln delete mode 100644 AdventOfCode2024/AdventOfCode2024.vcxproj delete mode 100644 AdventOfCode2024/AdventOfCode2024.vcxproj.filters create mode 100644 AdventOfCode2024/CMakeLists.txt create mode 100644 AdventOfCode2024/CMakePresets.json delete mode 100644 AdventOfCode2024/UnitTests/UnitTests.vcxproj delete mode 100644 AdventOfCode2024/UnitTests/UnitTests.vcxproj.filters delete mode 100644 AdventOfCode2024/UnitTests/pch.cpp delete mode 100644 AdventOfCode2024/UnitTests/pch.h diff --git a/.gitignore b/.gitignore index cad4563..5d8ffd9 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,5 @@ # VS and Output .vs Debug/ +out/ *.vcxproj.user \ No newline at end of file diff --git a/AdventOfCode2024/AdventOfCode2024.cpp b/AdventOfCode2024/AdventOfCode2024.cpp index 010d4a1..d9b0ae0 100644 --- a/AdventOfCode2024/AdventOfCode2024.cpp +++ b/AdventOfCode2024/AdventOfCode2024.cpp @@ -1,6 +1,6 @@ -// Solutions to the Advent Of Code 2024. -// Copyright (C) 2024 Stefan Müller -// +// Solutions to the Advent Of Code 2024. +// Copyright (C) 2024 Stefan Müller +// // This program is free software: you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation, either version 3 of the License, or (at your option) any later @@ -13,11 +13,11 @@ // You should have received a copy of the GNU General Public License along with // this program. If not, see . -#include "Program.h" +#include "AdventOfCode2024.h" int main() { Program program; program.run(); return 0; -} \ No newline at end of file +} diff --git a/AdventOfCode2024/AdventOfCode2024.h b/AdventOfCode2024/AdventOfCode2024.h new file mode 100644 index 0000000..5fa518c --- /dev/null +++ b/AdventOfCode2024/AdventOfCode2024.h @@ -0,0 +1,18 @@ +// Solutions to the Advent Of Code 2024. +// Copyright (C) 2024 Stefan Müller +// +// This program is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation, either version 3 of the License, or (at your option) any later +// version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// this program. If not, see . + +#pragma once + +#include "Program.h" diff --git a/AdventOfCode2024/AdventOfCode2024.sln b/AdventOfCode2024/AdventOfCode2024.sln deleted file mode 100644 index ff8d565..0000000 --- a/AdventOfCode2024/AdventOfCode2024.sln +++ /dev/null @@ -1,41 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.7.34221.43 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AdventOfCode2024", "AdventOfCode2024.vcxproj", "{0DEDB176-15A1-48C2-B710-5F17538C5DEC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Debug|x64.ActiveCfg = Debug|x64 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Debug|x64.Build.0 = Debug|x64 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Debug|x86.ActiveCfg = Debug|Win32 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Debug|x86.Build.0 = Debug|Win32 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Release|x64.ActiveCfg = Release|x64 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Release|x64.Build.0 = Release|x64 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Release|x86.ActiveCfg = Release|Win32 - {0DEDB176-15A1-48C2-B710-5F17538C5DEC}.Release|x86.Build.0 = Release|Win32 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Debug|x64.ActiveCfg = Debug|x64 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Debug|x64.Build.0 = Debug|x64 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Debug|x86.ActiveCfg = Debug|Win32 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Debug|x86.Build.0 = Debug|Win32 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Release|x64.ActiveCfg = Release|x64 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Release|x64.Build.0 = Release|x64 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Release|x86.ActiveCfg = Release|Win32 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {09BCF972-2454-4BE3-9637-D49111238A7F} - EndGlobalSection -EndGlobal diff --git a/AdventOfCode2024/AdventOfCode2024.vcxproj b/AdventOfCode2024/AdventOfCode2024.vcxproj deleted file mode 100644 index 46d2eb9..0000000 --- a/AdventOfCode2024/AdventOfCode2024.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {0dedb176-15a1-48c2-b710-5f17538c5dec} - AdventOfCode2024 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/AdventOfCode2024/AdventOfCode2024.vcxproj.filters b/AdventOfCode2024/AdventOfCode2024.vcxproj.filters deleted file mode 100644 index 12b5bc2..0000000 --- a/AdventOfCode2024/AdventOfCode2024.vcxproj.filters +++ /dev/null @@ -1,144 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/AdventOfCode2024/CMakeLists.txt b/AdventOfCode2024/CMakeLists.txt new file mode 100644 index 0000000..0ab10db --- /dev/null +++ b/AdventOfCode2024/CMakeLists.txt @@ -0,0 +1,21 @@ +# CMakeList.txt : CMake project for AdventOfCode2024, include source and define +# project specific logic here. +# +cmake_minimum_required (VERSION 3.8) + +# Enable Hot Reload for MSVC compilers if supported. +if (POLICY CMP0141) + cmake_policy(SET CMP0141 NEW) + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$,$>,$<$:EditAndContinue>,$<$:ProgramDatabase>>") +endif() + +project ("AdventOfCode2024") + +# Add source to this project's executable. +add_executable (AdventOfCode2024 "AdventOfCode2024.cpp" "AdventOfCode2024.h") + +if (CMAKE_VERSION VERSION_GREATER 3.12) + set_property(TARGET AdventOfCode2024 PROPERTY CXX_STANDARD 20) +endif() + +# TODO: Add tests and install targets if needed. diff --git a/AdventOfCode2024/CMakePresets.json b/AdventOfCode2024/CMakePresets.json new file mode 100644 index 0000000..abf4065 --- /dev/null +++ b/AdventOfCode2024/CMakePresets.json @@ -0,0 +1,61 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "windows-base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "x64-debug", + "displayName": "x64 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "inherits": "x64-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "x86-debug", + "displayName": "x86 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x86", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x86-release", + "displayName": "x86 Release", + "inherits": "x86-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} diff --git a/AdventOfCode2024/UnitTests/UnitTests.vcxproj b/AdventOfCode2024/UnitTests/UnitTests.vcxproj deleted file mode 100644 index c5dd3f5..0000000 --- a/AdventOfCode2024/UnitTests/UnitTests.vcxproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {15C7DA0D-C4D8-420B-AC10-D213AD22B9FA} - Win32Proj - UnitTests - 10.0 - NativeUnitTestProject - - - - DynamicLibrary - true - v143 - Unicode - false - - - DynamicLibrary - false - v143 - true - Unicode - false - - - DynamicLibrary - true - v143 - Unicode - false - - - DynamicLibrary - false - v143 - true - Unicode - false - - - - - - - - - - - - - - - - - - - - - true - ..;$(IncludePath) - - - true - - - false - - - false - - - - Use - Level3 - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - _DEBUG;%(PreprocessorDefinitions) - true - pch.h - stdcpp17 - - - Windows - $(VCInstallDir)UnitTest\lib;$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) - Solver.obj;SolverEngine.obj;HistorianHysteria.obj;RedNosedReports.obj;%(AdditionalDependencies) - - - - - Use - Level3 - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - pch.h - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - Use - Level3 - true - true - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;%(PreprocessorDefinitions) - true - pch.h - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - Use - Level3 - true - true - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - NDEBUG;%(PreprocessorDefinitions) - true - pch.h - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - {0dedb176-15a1-48c2-b710-5f17538c5dec} - - - - - - \ No newline at end of file diff --git a/AdventOfCode2024/UnitTests/UnitTests.vcxproj.filters b/AdventOfCode2024/UnitTests/UnitTests.vcxproj.filters deleted file mode 100644 index dc63046..0000000 --- a/AdventOfCode2024/UnitTests/UnitTests.vcxproj.filters +++ /dev/null @@ -1,48 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/AdventOfCode2024/UnitTests/pch.cpp b/AdventOfCode2024/UnitTests/pch.cpp deleted file mode 100644 index 64b7eef..0000000 --- a/AdventOfCode2024/UnitTests/pch.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/AdventOfCode2024/UnitTests/pch.h b/AdventOfCode2024/UnitTests/pch.h deleted file mode 100644 index 9d715b0..0000000 --- a/AdventOfCode2024/UnitTests/pch.h +++ /dev/null @@ -1,12 +0,0 @@ -// pch.h: This is a precompiled header file. -// Files listed below are compiled only once, improving build performance for future builds. -// This also affects IntelliSense performance, including code completion and many code browsing features. -// However, files listed here are ALL re-compiled if any one of them is updated between builds. -// Do not add files here that you will be updating frequently as this negates the performance advantage. - -#ifndef PCH_H -#define PCH_H - -// add headers that you want to pre-compile here - -#endif //PCH_H