Description of vsc+cmake+cpp17&& clion cygwin support

order

It took several hours to build the C + + environment for the nth time in my life

  • The 20-year-old driver said that markdown wrote articles and constructed paragraphs, which was really simple and comfortable
  • If the building fails, please ask me for help... Group Q 1414577, find the group leader

ultimate objective

  • Make some C + + wheels
  • Compiling V8
  • Compile OPENJDK8
  • Test the characteristics of C++20

List of software used this time

  • win 10 64
  • vscode
  • clion
  • cmake
  • gcc
  • make
  • gdb
  • cygwin
  • It's best to learn to surf the Internet

vscode+mingwin(gcc gdb make) + cmake combination

  • Pre conclusion
  • VScode writing C + + is still a little weak. I can't see the compilation
  • Maybe idea is used to it. She always feels uncomfortable there

reference resources

Settings in vscode

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:\\minGW64\\mingw64\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

launch.json

{
    // Use IntelliSense to understand related properties. 
    // Hover to view the description of an existing property.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/build/main.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "D:/minGW64/mingw64/bin/gdb.exe",
           // "preLaunchTask": "g++",

           "preLaunchTask": "buildAll",

            // "Prelaunchtask": "compile", / / label in task.json
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
    
}

tasks.json

{
    "version": "2.0.0",
    // "command": "g++",
    // "args": ["-g","${file}","-o","${fileBasenameNoExtension}.exe"],
    // "problemMatcher": {
    //     "owner": "cpp",
    //     "fileLocation": ["relative", "${workspaceRoot}"],
    //     "pattern": {
    //         "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
    //         "file": 1,
    //         "line": 2,
    //         "column": 3,
    //         "severity": 4,
    //         "message": 5
    //     }
    // }

    
        "tasks": [
    
            {
                "type": "shell",
                "label": "buildAll",
                "command": "make",
                "args": [
                   
                ],
                "options": {
                    "cwd": "${workspaceRoot}/build"
                },
                
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "detail": "Task generated by Debugger.",
                "dependsOn":["makeClean"],///Specifies that makeClean needs to be executed before buildAll
            },
            {
                "type": "shell",
                "label": "makeClean",
                "command": "make clean",
                "args": [
                   
                ],
                "options": {
                    "cwd": "${workspaceRoot}/build"
                },
                
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "detail": "Task generated by Debugger."
            }
    
        ],


}



clion+cygwin(gcc gdb cmake) combination

make clear beforehand

  • In the first combination, the path of mingw is configured in the system environment. Therefore, when cygwin is used, this path should be changed

The previous path configuration of MinGW was D:\minGW64\mingw64\bin

Now change to this D:\AAAA_STORE\small-tools\compile\cygwin\bin

clion installation

download

https://www.jetbrains.com/clion/download/other.html
I chose 2021.2.2 because I didn't have a tool to crack a higher version at the time of installation
Crack tools, please add Q group to download 1414577

cygwin installation

download

https://cygwin.com/install.html
Download setup x86_ 64.exe is OK

Software selected during cygwin installation

  • gcc (GNU compiler collection) is a programming language compiler developed by GNU. It has been adopted as a standard compiler by most Unix like operating systems (such as Linux, BSD, Mac OS X, etc.). gcc is the C compiler; gcc-g + + is a C + + compiler
  • make is a tool for compiling and installing programs in Linux.
  • gdb is a debugging tool for UNIX and UNIX like.
  • binutils is a set of binary toolsets used to generate object files or create static connection libraries.
  • cmake is a cross platform installation (compilation) tool, which can describe the installation or compilation process of all platforms with simple statements. cmake I installed it separately before, so I have no choice here.

After installation, a Cygwin64 Terminal icon will be generated on the desktop, and it will be started to verify the required software version

  • gcc --version 10.2.0

Do not delete the cygwin installation file. You can continue to use it when you need to install other software later

clion configuring cygwin

There are many online tutorials. Find them yourself.
It should be noted that when configuring the compiler, G + + should select x86 under cygwin_ 64-w64-mingw32-g++.exe
If you select g++.exe to generate EXE, you cannot debug

cmakeLists.txt configuring C++20 support

if(CMAKE_COMPILER_IS_GNUCXX)
    add_compile_options(-std=c++20)
    message(STATUS "optional:-std=c++20")
endif(CMAKE_COMPILER_IS_GNUCXX)

At present, although it is set, the compile time parameters are brought automatically, but it doesn't seem to work...

Windows 10 configure make command

https://blog.csdn.net/qq_45467083/article/details/110633407

Special attention

V8 compilation -- sorting

https://blog.csdn.net/zipper9527/article/details/8976250

V8 source code analysis

https://blog.csdn.net/theanarkh/category_9015796.html

Added by sean72 on Sat, 04 Dec 2021 07:03:00 +0200