Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

proposal: universal launch 'scheme' #1

Open
headupinclouds opened this issue Jun 22, 2017 · 0 comments
Open

proposal: universal launch 'scheme' #1

headupinclouds opened this issue Jun 22, 2017 · 0 comments

Comments

@headupinclouds
Copy link
Contributor

Notes on universal launch scheme proposal/extension:

The gauze_main() abstraction (currently used for cross platform testing) can be used to achieve a bundled command line argument universal launch "scheme". Below is the command line argument section from an Xcode scheme.

      <CommandLineArguments>
         <CommandLineArgument
            argument = " --output=/tmp/ "
            isEnabled = "YES">
         </CommandLineArgument>
         <CommandLineArgument
            argument = "--preview"
            isEnabled = "YES">
         </CommandLineArgument>
         <CommandLineArgument
            argument = "--width=1024"
            isEnabled = "YES">
         </CommandLineArgument>
         <CommandLineArgument
            argument = "--input=/Some/Long/Path/image_0010.png"
            isEnabled = "NO">
         </CommandLineArgument>
      </CommandLineArguments>

In practice they can be much more complex. Currently, schemes are managed outside of CMake, and they vary significantly between IDE's. In a CMake workflow, they are stored in the generated project build directory and can frequently be lost. A common use of such schemes is to store command line arguments for running applications. Editing complex schemes can be time consuming. The gauze_main() indirection could be leveraged to support a custom scheme file to manage command line arguments. It might look something like this:

  • int main() looks for a single universal launch scheme input file w/ *.gauze extension
  • if detected, parse command line arguments from JSON or XML
  • store command line arguments in gauze's int main() as std::vector<std::string> args
  • pass char **argv pointers to parsed args to int gauze_main(int argc, char **argv)

The Xcode scheme <CommandLineArgument ...> syntax could be borrowed for this purpose. The lightweight rapidxml package in the hunter-package repository could be used for parsing. This would support a consistent CLI implementation without the need to add custom XML or JSON parsing in each cross platform test or application.

Other scheme operations, such as setting environment variables and custom working directories, could be supported as an extension.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants