8000 GitHub - veluca93/subspace: An experimental take on a safer, simpler C++ standard library.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

veluca93/subspace

 
 

Repository files navigation

CI docs

Subspace Library

An experimental take on a safer, simpler C++ standard library.

Please don't use this library. This is an experiment and we don't yet know where it will take us. There will be breaking changes without warning, and there is no stable version.

Copyright

All source files must include this header:

// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

Getting started

  1. Install CMake
  2. Install python3
  3. cmake -B out
  4. cmake --build out
  5. ctest --test-dir out

Clang format

The latest LLVM release does not have sufficient C++20 support to format the library correctly. To get a more bleeding edge clang-format executable, we get it from the Chromium project:

  1. Install python3 (or from the Windows Store) and add it to your path.
  2. Download depot_tools, extract it, and put it in your path.
  3. Run gclient in a terminal to set it up.
  4. Make a directory to hold the clang-format binary.
  5. Download the sha1 file for your platform and put it in that directory.
  6. From in that same directory, in a terminal, run download_from_google_storage to pull down the clang-format binary.
    • On Windows: python ..\depot_tools\download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s clang-format.exe.sha1
    • Elsewhere: python ..\depot_tools\download_from_google_storage.py --no_resume --no_auth --bucket chromium-clang-format -s clang-format.sha1
    • The command comes from here.
  7. Point your IDE to the downloaded clang-format executable.

For Windows/VSCode.

  1. Install Visual Studio 2022. Don't bother installing the CMake tools from it, they don't work as well
  2. Set the "Windows SDK Version" in VSCode to 10.0.19041.0 (or the version installed with Visual Studio)
  3. Set the "CMake: Generator" in VSCode to Visual Studio 17 2022, or add it to "CMake: Preferred Generators"

Building CIR

CIR is a midlevel representaion of C++ built on Clang in the spirit of Rust's MIR.

CIR requires an installation of LLVM from Git HEAD, including the LLVM/Clang headers and libraries.

By default, in VSCode it looks for llvm and clang in the following places, from Subspace's .vscode/settings.json, but you will need to set these environment variables if building in another way.

    "cmake.environment": {
        "LLVM_DIR": "../../llvm/build/install/lib/cmake/llvm",
        "CLANG_DIR": "../../llvm/build/install/lib/cmake/clang",
    },

To build LLVM from VSCode, the following can be put in LLVM's .vscode/settings.json:

{
    "cmake.configureOnOpen": false,
    "cmake.sourceDirectory": "${workspaceFolder}/llvm",
    "cmake.buildDirectory": "${workspaceFolder}/build/${buildType}/${variant:platform}",
    "cmake.installPrefix": "${workspaceFolder}/build/install",
    "cmake.generator": "Ninja",
    "cmake.configureArgs": [
        "-DLLVM_ENABLE_PROJECTS=clang",
    ],
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}

Then use VSCode to choose a build configuration and run the "CMake: Build" and "CMake: Install" tasks.

Windows

On windows, set the envionment variable LLVM_DEBUG=1 if the LLVM build was a debug build in order for CIR to link the appropriate runtime.

About

An experimental take on a safer, simpler C++ standard library.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.9%
  • C 2.5%
  • CMake 0.6%
0