pipeline {
    agent none

    stages {
        stage('Build Linux') {
            agent { label 'linux' }
            steps {
                cleanWs()
                checkout scm

                sh '''
                    cmake -S . -B build/linux -G Ninja -DCMAKE_BUILD_TYPE=Release
                    cmake --build build/linux
                '''
            }
        }

        stage('Check Windows Agent') {
            agent { label 'windows' }
            steps {
                cleanWs()
                checkout scm

                bat '''
                    echo Windows agent works
                    hostname
                    where cmake
                    where ninja
                    where git
                    java -version

                    call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
                    where cl
                    cl
                '''
            }
        }
    }
}