From fc5493bd590523e84ba7fb29ee4f80d4e37b984d Mon Sep 17 00:00:00 2001 From: "KOKO\\Mimi" Date: Thu, 30 Jul 2026 00:46:22 +0900 Subject: [PATCH] =?UTF-8?q?feat(solver-bootstrap):=20step=201=20=E2=80=94?= =?UTF-8?q?=20cmake-project-scaffold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .harness/config.json | 11 +++++ CMakeLists.txt | 51 ++++++++++++++++++++++ CMakePresets.json | 79 +++++++++++++++++++++++++++++++++++ cmake/FesaDependencies.cmake | 3 ++ include/fesa/core/version.hpp | 9 ++++ src/fesa/cli/main.cpp | 14 +++++++ src/fesa/core/version.cpp | 9 ++++ tests/CMakeLists.txt | 10 +++++ 9 files changed, 187 insertions(+) create mode 100644 .harness/config.json create mode 100644 CMakeLists.txt create mode 100644 CMakePresets.json create mode 100644 cmake/FesaDependencies.cmake create mode 100644 include/fesa/core/version.hpp create mode 100644 src/fesa/cli/main.cpp create mode 100644 src/fesa/core/version.cpp create mode 100644 tests/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 413c791..f09ed83 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ __pycache__/ .pytest_cache/ *.py[cod] .harness/build/ +out/ .worktrees/ diff --git a/.harness/config.json b/.harness/config.json new file mode 100644 index 0000000..565d49a --- /dev/null +++ b/.harness/config.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "projectType": "cmake", + "cmake": { + "sourceDir": ".", + "binaryDir": "out/build/windows-debug", + "configurePreset": "windows-debug", + "buildPreset": "windows-debug", + "testPreset": "windows-debug" + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b584332 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.30) + +project(FESA VERSION 0.1.0 LANGUAGES CXX) + +if(NOT MSVC) + message(FATAL_ERROR "FESA requires the Microsoft Visual C++ compiler (MSVC v145).") +endif() + +if(NOT CMAKE_VS_PLATFORM_TOOLSET STREQUAL "v145") + message( + FATAL_ERROR + "FESA requires the v145 platform toolset; configured toolset is " + "'${CMAKE_VS_PLATFORM_TOOLSET}'." + ) +endif() + +if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "x64") + message(FATAL_ERROR "FESA requires the x64 generator platform.") +endif() + +if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) + message(FATAL_ERROR "FESA requires a 64-bit target.") +endif() + +include(cmake/FesaDependencies.cmake) + +add_library(fesa_core STATIC + src/fesa/core/version.cpp +) + +target_include_directories(fesa_core + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/include" +) + +target_compile_features(fesa_core PUBLIC cxx_std_20) +target_compile_options(fesa_core PRIVATE /W4 /permissive- /EHsc) + +add_executable(fesa + src/fesa/cli/main.cpp +) + +target_link_libraries(fesa PRIVATE fesa_core) +target_compile_features(fesa PRIVATE cxx_std_20) +target_compile_options(fesa PRIVATE /W4 /permissive- /EHsc) + +include(CTest) + +if(BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..dc84e96 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,79 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "windows-debug", + "displayName": "Windows Debug", + "generator": "Visual Studio 18 2026", + "architecture": { + "value": "x64", + "strategy": "set" + }, + "toolset": { + "value": "v145", + "strategy": "set" + }, + "binaryDir": "${sourceDir}/out/build/windows-debug", + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "OFF", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD_REQUIRED": "ON" + } + }, + { + "name": "windows-release", + "displayName": "Windows Release", + "generator": "Visual Studio 18 2026", + "architecture": { + "value": "x64", + "strategy": "set" + }, + "toolset": { + "value": "v145", + "strategy": "set" + }, + "binaryDir": "${sourceDir}/out/build/windows-release", + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "OFF", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD_REQUIRED": "ON" + } + } + ], + "buildPresets": [ + { + "name": "windows-debug", + "configurePreset": "windows-debug", + "configuration": "Debug" + }, + { + "name": "windows-release", + "configurePreset": "windows-release", + "configuration": "Release" + } + ], + "testPresets": [ + { + "name": "windows-debug", + "configurePreset": "windows-debug", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error" + } + }, + { + "name": "windows-release", + "configurePreset": "windows-release", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error" + } + } + ] +} diff --git a/cmake/FesaDependencies.cmake b/cmake/FesaDependencies.cmake new file mode 100644 index 0000000..3a9197d --- /dev/null +++ b/cmake/FesaDependencies.cmake @@ -0,0 +1,3 @@ +include_guard(GLOBAL) + +# Third-party package discovery is added by the dependency smoke-test step. diff --git a/include/fesa/core/version.hpp b/include/fesa/core/version.hpp new file mode 100644 index 0000000..8cd6f8b --- /dev/null +++ b/include/fesa/core/version.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace fesa { + +[[nodiscard]] std::string_view version() noexcept; + +} diff --git a/src/fesa/cli/main.cpp b/src/fesa/cli/main.cpp new file mode 100644 index 0000000..c506fe2 --- /dev/null +++ b/src/fesa/cli/main.cpp @@ -0,0 +1,14 @@ +#include + +#include +#include + +int main(int argc, char* argv[]) { + if (argc == 2 && std::string_view{argv[1]} == "--version") { + std::cout << fesa::version() << '\n'; + return 0; + } + + std::cerr << "Usage: fesa --version\n"; + return 1; +} diff --git a/src/fesa/core/version.cpp b/src/fesa/core/version.cpp new file mode 100644 index 0000000..ec44ee9 --- /dev/null +++ b/src/fesa/core/version.cpp @@ -0,0 +1,9 @@ +#include + +namespace fesa { + +std::string_view version() noexcept { + return "0.1.0"; +} + +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..8b29bcc --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test( + NAME VersionCommand + COMMAND "${CMAKE_BINARY_DIR}/$/fesa.exe" --version +) + +set_tests_properties( + VersionCommand + PROPERTIES + PASS_REGULAR_EXPRESSION "[0-9]+\\.[0-9]+\\.[0-9]+" +)