apiaryio / drafter

API Blueprint Parser (C++)
https://apiblueprint.org/
MIT License
301 stars 54 forks source link

Windows cmake build #729

Closed tjanc closed 5 years ago

tjanc commented 5 years ago

In Visual C++ 2015 Build Tools:

drafter> mkdir build
drafter> cd build
drafter/build> cmake .. -DCMAKE_INSTALL_PREFIX=..\install -DCMAKE_BUILD_TYPE=Release
drafter/build> cd ..
drafter> cmake --build build -t drafter-cli --config Release
drafter> cmake --build install -t drafter-cli --config Release

After a successful build, a standalone drafter.exe is located in install/bin.

Notes

kylef commented 5 years ago

I can confirm these changes fix the problems I was facing, I am able to build using:

$ mkdir build
$ cd build
$ cmake ..
$ cmake . --build
$ .\src\Debug\drafter.exe --help
usage: drafter [options] ... <input file>

API Blueprint Parser
If called without <input file>, 'drafter' will listen on stdin.

options:
  -o, --output          save output Parse Result into file (string [=])
  -f, --format          output format of the Parse Result (yaml|json) (string [=yaml])
  -s, --sourcemap       export sourcemap in the Parse Result
  -h, --help            display this help message
  -v, --version         print Drafter version
  -l, --validate        validate input only, do not output Parse Result
  -u, --use-line-num    use line and row number instead of character index when printing annotation
  -L, --enable-log      enable logging
.\src\Debug\drafter.exe --validate ..\features\fixtures\blueprint.apib

OK.
warning: (9)  the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead :685:45
warning: (9)  the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead :992:45
warning: (4)  invalid value format for 'number' type. please check mson specification for valid format :200:102

That levaes me with one question, why is the debug build happening by default? We have release by default on other platforms (https://github.com/apiaryio/drafter/blob/50cfec3f5659c97f72a29d6e42b932daf513c80e/DefaultBuildType.cmake#L1).