Advertisement
weberc2

cw example

Aug 9th, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.54 KB | None | 0 0
  1. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ ls
  2. cppdeps.py  cw  example_cwpath  project.py  target.py
  3.  
  4. # This is what the example project looks like. $CWPATH is akin to $GOPATH in golang
  5. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ find example_cwpath/
  6. example_cwpath/
  7. example_cwpath/.hgignore
  8. example_cwpath/src
  9. example_cwpath/src/greet
  10. example_cwpath/src/greet/hello.cpp
  11. example_cwpath/src/greet/unused.h
  12. example_cwpath/src/greet/main.cpp # the presence of a main.cpp tells `cw` to try to build a binary artifact
  13. example_cwpath/src/greet/hello.h
  14. example_cwpath/src/greet/goodbye.cpp
  15. example_cwpath/src/greet/transitive_dep.h
  16. example_cwpath/src/greet/goodbye.h
  17. example_cwpath/src/range
  18. example_cwpath/src/range/range.h
  19. example_cwpath/src/range/range.cpp
  20.  
  21. # alias `cw` so we can execute the program without the full path
  22. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ alias cw=$PWD/cw
  23.  
  24. # set the $CWPATH. Like $GOPATH, $CWPATH can be a colon-indexed list of workspaces.
  25. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ export CWPATH=$PWD/example_cwpath
  26.  
  27. # build from project URI (URI = relative path from $CWPATH)
  28. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ cw build greet
  29.  
  30. # binary and library artifacts are built
  31. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ ls example_cwpath/bin/greet
  32. example_cwpath/bin/greet
  33. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ ls example_cwpath/lib/greet
  34. goodbye.o  hello.o  libgreet.a  main.o
  35.  
  36. # artifacts are cleaned via URI
  37. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ cw clean greet
  38. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/hello.o
  39. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/main.o
  40. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/goodbye.o
  41. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/libgreet.a
  42. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/bin/greet
  43.  
  44. # artifacts can also be built/cleaned via relative (or absolute) project filepath
  45. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ cw build ./example_cwpath/src/greet/
  46. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ cw clean ./example_cwpath/src/greet/
  47. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/hello.o
  48. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/main.o
  49. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/goodbye.o
  50. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/lib/greet/libgreet.a
  51. Removed /home/someone/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/bin/greet
  52.  
  53. # artifacts can be built/cleaned without parameter if current dir is the project dir
  54. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground$ cd example_cwpath/src/greet/
  55. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/src/greet$ cw build
  56.  
  57. # execute binary; we could omit the `../../bin` part if the `bin` dir was in `$PATH`
  58. someone@someone-desktop:~/Projects/src/bitbucket.org/weberc2/playground/example_cwpath/src/greet$ ../../bin/greet
  59. Hello, world!
  60. Goodbye!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement