1. 系统安装python, 测试版本为(3.7.0)
2. 从官方网站获取get-pip.py
https://bootstrap.pypa.io/get-pip.py
3. 安装pip
python get-pip.py
4. 安装ninja
pip install ninja
5. 准备CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
project(hello_ninja)
add_executable(${PROJECT_NAME} main.cpp)
6. 准备main.cpp
#include <iostream>
#include <conio.h>
int main(int argc, char *argv[])
{
?? ?std::cout << "hello world" << std::endl;
?? ?_getch();
?? ?return 0;
}
7. 编译, 从vs2019 Developer Command Prompt for VS 2019进入命令窗口
mkdir build
cd build
cmake -G Ninja ..
ninja