[DOCS]: Building & Using

This commit is contained in:
2025-12-26 00:14:15 +05:30
parent 45403c94ac
commit 2f8f7025db
6 changed files with 155 additions and 78 deletions

43
Docs/BUILDING.md Normal file
View File

@ -0,0 +1,43 @@
## 🛠️ Building IACore
IACore uses **CMake Presets** to manage toolchains and cross-compilation. This ensures that the correct compilers (Clang) and flags (AVX2/SIMD) are used automatically.
### Prerequisites
* CMake 3.28+
* Ninja Build System
* Vcpkg (Environment variable `VCPKG_ROOT` must be set)
* Clang / Clang-CL
### Build Instructions
**1. Configure**
Select the preset for your target platform.
```bash
# List available presets
cmake --list-presets
# Configure for your platform (e.g., windows-x64, linux-arm64, wasm)
cmake --preset windows-x64
```
**2. Build**
```bash
cmake --build --preset windows-x64
```
**3. Test (Optional)**
```bash
ctest --preset windows-x64
```
### Presets
|Preset |Description |Toolchain |
|-------------|------------------------------|------------------------------------|
|windows-x64 |Windows (Clang-CL) |CMake/Toolchains/windows-x64.cmake |
|linux-x64 |Linux (Clang) |CMake/Toolchains/linux-x64.cmake |
|wasm |WebAssembly (Emscripten) |CMake/Toolchains/wasm.cmake |
|windows-arm64|Windows on ARM (Cross-compile)|CMake/Toolchains/windows-arm64.cmake|
|linux-arm64 |Linux on ARM (Cross-compile) |CMake/Toolchains/linux-arm64.cmake |

26
Docs/USING.md Normal file
View File

@ -0,0 +1,26 @@
## 🚀 Using IACore in a New Project
IACore provides a CMake macro `iacore_setup_project()`, which standardizes your build environment. This macro automatically:
* Enforces C++20 standard.
* Sets warning levels (-Wall -Wextra -Wpedantic for Clang/GCC, /W4 for MSVC/Clang-CL).
* Detects the target architecture (x64, ARM64, WASM) and sets internal cache variables.
* Suppresses C++98 compatibility warnings when using Clang on Windows.
Example CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 3.28)
project(MyGame)
add_subdirectory(external/IACore)
## Apply IACore's standard project configuration
# This applies C++20 and strict warning flags globally to your targets.
iacore_setup_project()
# Define your target(s)
add_executable(MyGame src/main.cpp)
# Link IACore
target_link_libraries(MyGame PRIVATE IACore)
```