cmake_minimum_required(VERSION 3.20)
project(NablaQuant
    VERSION 0.1.1
    LANGUAGES CXX
    DESCRIPTION "High-Performance PDE Option Pricing Engine"
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
    add_compile_options(-Wall -Wextra -Wpedantic -O2 -mavx2 -mfma)
elseif(MSVC)
    add_compile_options(/W4 /O2 /arch:AVX2)
endif()

include_directories(${CMAKE_SOURCE_DIR}/include)

option(NABLA_BUILD_PYTHON "Build Python bindings via pybind11" ON)

add_subdirectory(src)

# Tests and examples are only relevant for local development / CI native builds.
# When scikit-build-core invokes cmake to build a wheel it sets SKBUILD=TRUE;
# skip the test/example targets in that context to keep wheel builds fast and
# avoid spurious failures from platform-specific test-only code paths.
if(NOT SKBUILD)
    enable_testing()
    add_subdirectory(tests)
    add_subdirectory(examples)
endif()

if(NABLA_BUILD_PYTHON)
    add_subdirectory(python)
endif()
