Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS docs + VS cross-build #537

Merged
merged 3 commits into from
Jan 8, 2021
Merged

VS docs + VS cross-build #537

merged 3 commits into from
Jan 8, 2021

Conversation

Daft-Freak
Copy link
Collaborator

Mentions adding a release config in the setup docs and adds some info about doing a cross-build (I've tested that this at least builds...). Had to patch the toolchain to work around the lack of unzip though.

(Maybe the boilerplate should have a CMakeSettings.json with a reasonable set of configs and placehholder paths?)

@Gadgetoid
Copy link
Contributor

Agreed the boilerplate could stand to have some stub configs for CMake Tools and a launch.json too. I keep finding myself taking the same steps with each new project.

One approach could be encouraging the setting of an environment variable:

export PATH_32BLIT="/home/phil/Development/32blit/32blit-beta

And then have a set of default configs that use it:

.vscode/cmake-kits.json:

[
  {
    "name": "32blit",
    "toolchainFile": "${env:PATH_32BLIT}/32blit.toolchain"
  }
]

.vscode/settings.json:

{
    "cmake.configureSettings": {
        "32BLIT_PATH": "${env:PATH_32BLIT}"
    }
}

.vscode/c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${env:PATH_32BLIT}"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

@Daft-Freak
Copy link
Collaborator Author

So err, ignoring the fact I was talking about VS and not VS Code... 😄 (slightly different and more complex config, yay)

I have a global 32blit toolchain setup and "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", in my settings.json. I haven't had to set up c_cpp_properties.json, that shouldn't be necessary with the config provider set...

(Though you'd also want settings.json ignored so that you don't end up committing the random junk that gets added to it)

@Gadgetoid
Copy link
Contributor

Ugh VS/VS Code will always confuse me. Whyyy!

Yeah VS config is... more complicated.

I've raised a draft PR against the boilerplate here: 32blit/32blit-boilerplate#9

@Daft-Freak
Copy link
Collaborator Author

Yeah...

{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "32BLIT_PATH",
          "value": "C:/Users/Charlie/source/repos/32blit-beta",
          "type": "PATH"
        }
      ]
    },
    {
      "name": "x64-Release",
      "generator": "Ninja",
      "configurationType": "RelWithDebInfo",
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "variables": [
        {
          "name": "32BLIT_PATH",
          "value": "C:/Users/Charlie/source/repos/32blit-beta",
          "type": "PATH"
        }
      ]
    },
    {
      "name": "32Blit-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "inheritEnvironments": [ "gcc-arm" ],
      "variables": [],
      "cmakeToolchain": "C:/Users/Charlie/source/repos/32blit-beta/32blit.toolchain",
      "intelliSenseMode": "linux-gcc-arm"
    },
    {
      "name": "32Blit-Release",
      "generator": "Ninja",
      "configurationType": "Release",
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "cmakeToolchain": "C:/Users/Charlie/source/repos/32blit-beta/32blit.toolchain",
      "inheritEnvironments": [ "gcc-arm" ],
      "variables": [],
      "intelliSenseMode": "linux-gcc-arm"
    }
  ]
}

Really likes making you repeat yourself.

@Gadgetoid
Copy link
Contributor

At least you can set a variable starting with a number, that little wart of environment variables necessitated PATH_32BLIT, maybe I should have just made that PATH_TO_32BLIT 😆

@Daft-Freak
Copy link
Collaborator Author

CMake weirdness being a good thing... 😄

@Gadgetoid Gadgetoid merged commit 916922e into 32blit:master Jan 8, 2021
@Daft-Freak Daft-Freak deleted the patch-2 branch January 8, 2021 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants