# Step 7: CMake and GoogleTest Foundation ## 담당 역할과 필수 스킬 - 담당 역할: `implementation-agent` - 필수 스킬: `fesa-cpp-msvc-tdd` - 구현 전에 스킬과 Step 6 implementation plan을 끝까지 읽어라. ## 읽어야 할 파일 - `/AGENTS.md` - `/docs/ARCHITECTURE.md` - `/docs/ADR.md` - `/docs/linear-static-3d-euler-beam/implementation-plan.md` - `/docs/superpowers/specs/2026-08-08-linear-static-3d-euler-beam-design.md` - `/docs/HARNESS_WORKFLOW.md` - `/docs/HARNESS.md` - `/CMakeLists.txt`가 이미 생겼다면 그 파일 ## 소유 파일 - Create: `/CMakeLists.txt` - Create: `/cmake/FesaDependencies.cmake` - Create: `/include/fesa/build_info.hpp` - Create: `/src/fesa/build_info.cpp` - Create: `/src/fesa/CMakeLists.txt` - Create: `/tests/CMakeLists.txt` - Create: `/tests/unit/build_info_test.cpp` - Create: `/docs/linear-static-3d-euler-beam/implementation-report.md` ## 작업 MSVC x64 Debug에서 이후 모든 C++ step을 TDD로 실행할 최소 build/test foundation을 구현하라. Step 6이 정한 exact file layout을 우선하되 최소 책임은 다음과 같다. - `CMakeLists.txt`: C++17, `enable_testing()`, FESA target 구성과 하위 CMake 진입점. - `cmake/FesaDependencies.cmake`: cache variable `FESA_GTEST_SOURCE_DIR`을 검증하고 `C:/git/googletest`를 source tree로 받을 수 있게 한다. 이 절대경로를 default나 production source에 하드코딩하지 않는다. oneMKL, oneTBB, HDF5 CONFIG package를 찾고 dependency target 차이는 이 파일 안에서 정규화한다. - `include/fesa/build_info.hpp`, `src/fesa/build_info.cpp`: HDF5 metadata가 재사용할 `std::string_view solverVersion() noexcept`의 최소 안정 API. - `src/fesa/CMakeLists.txt`: `fesa_solver` static library와 FESA에만 `/W4 /WX` 적용. - `tests/CMakeLists.txt`, `tests/unit/build_info_test.cpp`: GoogleTest 연결, `gtest_discover_tests`, `BuildInfo` regex와 공통 `linear-static-3d-euler-beam` label을 가진 최소 제품 test. 이후 이 phase의 모든 CTest는 같은 공통 label을 상속한다. - `docs/linear-static-3d-euler-beam/implementation-report.md`: feature metadata, dependency/configure evidence와 Step 7–24별 RED/GREEN/VERIFY command, exit code, 핵심 output, 변경 파일, requirement/test trace를 누적할 implementation report. GoogleTest external target에는 `/W4 /WX`를 전파하지 않는다. MKL/TBB/HDF5 header나 type을 `build_info.hpp` 또는 다른 public header에 노출하지 않는다. 외부 checkout을 수정하거나 network fetch를 하지 않는다. ## Acceptance Criteria 먼저 `C:/git/googletest`의 revision을 read-only로 확인하라. ```powershell if (-not (Test-Path 'C:/git/googletest/CMakeLists.txt')) { throw 'GoogleTest checkout is missing' } $gtestRevision = git -C C:/git/googletest rev-parse HEAD if ($gtestRevision -ne '04ee1b4f2aefdffb0135d7cf2a2c519fe50dabe4') { throw "Unexpected GoogleTest revision: $gtestRevision" } ``` 구성·build·discovery·test를 실행한다. ```powershell cmake -S . -B .harness/build -A x64 ` -DFESA_GTEST_SOURCE_DIR=C:/git/googletest ` "-DMKL_DIR=C:/Program Files (x86)/Intel/oneAPI/mkl/2026.1/lib/cmake/mkl" ` "-DTBB_DIR=C:/Program Files (x86)/Intel/oneAPI/tbb/2023.1/lib/cmake/tbb" ` "-DHDF5_DIR=C:/Program Files/HDF_Group/HDF5/2.1.1/cmake" cmake --build .harness/build --config Debug ctest --test-dir .harness/build -C Debug -R BuildInfo --output-on-failure $discovery = ctest --test-dir .harness/build -C Debug --show-only=json-v1 | ConvertFrom-Json if ($discovery.tests.Count -lt 1) { throw 'CTest discovered zero tests' } ctest --test-dir .harness/build -C Debug --output-on-failure if (-not (Test-Path 'docs/linear-static-3d-euler-beam/implementation-report.md')) { throw 'Missing implementation evidence report' } ``` ## 검증 절차 1. build_info test를 먼저 작성하고 API가 없어 compile RED가 발생하는지 확인한 뒤 `build_info` production 파일을 추가한다. 2. 위 명령을 실행해 GREEN과 전체 VERIFY를 확인한다. 3. MSVC compiler metadata와 FESA target `/W4 /WX`, third-party warning 격리를 확인한다. 4. implementation report에 Step 7 RED/GREEN/VERIFY의 실제 command, exit code와 핵심 output을 기록한다. 5. Step 7을 `completed`로 바꾸고 build files, target names, dependency resolution을 `summary`에 기록한다. 설치 경로/환경이 실제로 없으면 `blocked`, 반복 구현 실패는 `error`로 기록한다. ## 금지사항 - dependency source를 vendor하거나 download하지 마라. 이유: 승인된 local install을 사용한다. - GoogleTest 절대경로를 CMake default로 하드코딩하지 마라. 이유: cache variable 계약이다. - FESA warning option을 third-party target에 적용하지 마라. 이유: 외부 코드 경고는 제품 책임이 아니다. - 이후 solver module을 미리 만들지 마라. 이유: 이 step은 build/test foundation만 소유한다. - 직접 commit하지 마라. 이유: Harness executor가 담당한다.