Repository: robotdad/vclinux Branch: master Commit: f452c76e8283 Files: 4 Total size: 13.8 KB Directory structure: gitextract_01bppl0p/ ├── LICENSE ├── README.md └── bash/ ├── genfilters.sh └── genvcxproj.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2016 Marc Goodner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # vclinux Unofficial scripts and stuff related to the [Visual C++ for Linux Development extension](http://aka.ms/vslinux). Yes I'm the program manger for that but this is stuff I've made on the side. Think about it. If this was good enough to ship it'd be in the box right? I hope you find this useful, especially for modifying to fit for your needs. If you have any comments or suggestions I'd love to hear them. ## Project generation bash scripts ### genvcxproj.sh This script generates a VC Linux project file that includes your source files from the directory specified. The project type is makefile and it is set to not copy sources since the assumption here is the files have been mapped to a Windows drive. This leaves your source in a flat list. To organize your files as seen in your directory use genfilters.sh to generate an accompanying filter file. The assumption this script has is that your source code is on a Linux machine and that this directory has been mapped to Windows so the code can be edited in Visual Studio. Input for this script is: 1. is the directory of source code to create a project file for 2. is file name to create, should be projectname.vcxproj Example usage: ``` $ ./genvcxproj.sh ~/repos/preciouscode/ preciouscode.vcxproj ``` Once you have your project open in Visual Studio connect to your Linux machine using the extension, [as shown here](https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/#consoleapp). Now add any paths needed for your includes to light up intellisense, and setup your remote build command line on the property page. This is specific to your project but would be something like: ``` cd ~/repos/preciouscode/; make ``` As you can see multiple commands can be used ; seperated. ### genfilters.sh This script generates a filter file for organizing source files in a VC Linux project based on the directory structure. The filter file must be the same name as your project file + .filters. So if your project file is preciouscode.vcxproj your filter file needs to be named preciouscode.vcxproj.filters. The assumption this script has is that your source code is on a Linux machine and that this directory has been mapped to Windows so the code can be edited in Visual Studio. To generate a project file for your source code see genvcxproj.sh 1. is the directory of source code to create project filters from 2. is file name to create, should be projectname.vcxproj.filters Example usage: ``` $ ./genfilters.sh ~/repos/preciouscode/ preciouscode.vcxproj.filters ``` ================================================ FILE: bash/genfilters.sh ================================================ #!/bin/bash # Here for latest: https://github.com/robotdad/vclinux # # This script generates a filter file for organizing source files in a VC Linux project based on the directory structure. # The filter file must be the same name as your project file + .filters. # So if your project file is preciouscode.vcxproj your filter file needs to be named preciouscode.vcxproj.filters. # # The assumption this script has is that your source code is on a Linux machine and that # this directory has been mapped to Windows so the code can be edited in Visual Studio. # To generate a project file for your source code see genvcxproj.sh # # You can find out more about VC++ for Linux here: http://aka.ms/vslinux # # Usage: # $1 is the directory of source code to create project filters from # $2 is file name to create, should be projectname.vcxproj.filters # $3 is the root of your Windows fodler where these files will be mapped # the meat of this is after the printheader/footer functions function printheader(){ echo " " } function printfooter(){ echo "" } function listfilters(){ echo " " for i in $(find . -not -path '*/\.*' -type d) do f=${i##./} f=${f//\//\\} uuid="$(uuidgen)" printf " \n" "$f" printf " {%s}\n" "$uuid" printf " \n" done echo " " } function listothers(){ echo " " for i in $(find . -not -path '*/\.*' -type f ! -iname "*.c" ! -iname "*.cpp" ! -iname "*.h" ! -iname "*.txt" ! -iname "*.o" ! -iname "*.vcxproj") do d=${i%/*} fd=${d##*/} fp=${d##./} fp=${fp//\//\\} d=${d//\//\\} f=${i##*/} if [ $fd = "." ] then printf " \n" "$d" "$f" else printf " \n" "$d" "$f" printf " %s\n" "$fp" printf " \n" fi done echo " " } function listtxt(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.txt") do d=${i%/*} fd=${d##*/} fp=${d##./} fp=${fp//\//\\} d=${d//\//\\} f=${i##*/} if [ $fd = "." ] then printf " \n" "$d" "$f" else printf " \n" "$d" "$f" printf " %s\n" "$fp" printf " \n" fi done echo " " } function listcompile(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.c" -or -iname "*.cpp") do d=${i%/*} fd=${d##*/} fd=${d##*/} fp=${d##./} fp=${fp//\//\\} d=${d//\//\\} f=${i##*/} if [ $fd = "." ] then printf " \n" "$d" "$f" else printf " \n" "$d" "$f" printf " %s\n" "$fp" printf " \n" "$d" "$f" fi done echo " " } function listinclude(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.h") do d=${i%/*} fd=${d##*/} fd=${d##*/} fp=${d##./} fp=${fp//\//\\} d=${d//\//\\} f=${i##*/} if [ $fd = "." ] then printf " \n" "$d" "$f" else printf " \n" "$d" "$f" printf " %s\n" "$fp" printf " \n" fi done echo " " } cd $1 || exit 2; touch $2 && test -w $2 || exit 2; printheader > $2 listfilters >> $2 listothers >> $2 listtxt >> $2 listcompile >> $2 listinclude >> $2 printfooter >> $2 exit ================================================ FILE: bash/genvcxproj.sh ================================================ #!/bin/bash # Here for latest: https://github.com/robotdad/vclinux # # This script generates a VC Linux project file that includes your source files from the directory specified. # The project type is makefile and it is set to not copy sources since the assumption here is the files have # been mapped to a Windows drive. # # This leaves your source in a flat list. # To organize your files as seen in your directory use genfilters.sh to generate an accompanying filter file. # # The assumption this script has is that your source code is on a Linux machine and that # this directory has been mapped to Windows so the code can be edited in Visual Studio. # # You can find out more about VC++ for Linux here: http://aka.ms/vslinux # Usage: # $1 is the directory of source code to create a project file for # $2 is file name to create, should be projectname.vcxproj # $3 is the root of your Windows fodler where these files will be mapped # the meat of this is after the printheader/footer functions function printheader(){ echo " Debug ARM Release ARM Debug x86 Release x86 Debug x64 Release x64 {d14472f1-e80c-4d22-a2b5-6694cdc04c48} Linux makefile 14.0 Linux 1.0 Generic {FC1A4D80-50E9-41DA-9192-61C0DBAA00D2} true Makefile false Makefile true Makefile false Makefile true Makefile false Makefile false false false false false false " } function printfooter(){ echo " " } function listothers(){ echo " " for i in $(find . -not -path '*/\.*' -type f ! -iname "*.c" ! -iname "*.cpp" ! -iname "*.h" ! -iname "*.txt" ! -iname "*.o" ! -iname "*.vcxproj" ! -iname "*.filters") do d=${i%/*} d=${d//\//\\} f=${i##*/} printf " \n" "$d" "$f" done echo " " } function listtxt(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.txt") do d=${i%/*} d=${d//\//\\} f=${i##*/} printf " \n" "$d" "$f" done echo " " } function listcompile(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.c" -or -iname "*.cpp") do d=${i%/*} d=${d//\//\\} f=${i##*/} printf " \n" "$d" "$f" done echo " " } function listinclude(){ echo " " for i in $(find . -not -path '*/\.*' -type f -iname "*.h") do d=${i%/*} d=${d//\//\\} d=${d/.} f=${i##*/} printf " \n" "$d" "$f" done echo " " } cd $1 || exit 2; touch $2 && test -w $2 || exit 2; printheader > $2 listothers >> $2 listtxt >> $2 listcompile >> $2 listinclude >> $2 printfooter >> $2 exit