Sublime Forum

Using cygwin for build system

#1

Hi,

I’m using cygwin to launch build.sh file, which builds my project. How can I make build system in st2 which will run build.sh file using cygwin and of course print all messages to console? It will be really usefull for me.

Thanks :smile:.

0 Likes

#2

If nobody can help me, then maybe someone tell me how can I execute cygwin commands in sublime text 2 console window?

0 Likes

#3

4 Years later. Regardless this may help someone.

In sublime go to Tools>Build System> New Build System then

{ "cmd" : ["gcc", "$file_name", "-o", "${file_base_name}.exe", "&&", "${file_base_name}.exe"], "selector" : "source.c", "path" : "C:/cygwin64/bin/", "shell" : true, "working_dir" : "$file_path" }

Press Ctrl + Shift + s go up one directory so your are in the packages folder then make a new folder and call it C. Then save it their “C compiler.sublime-build” . Then go back to the C file in sublime. click Tools > Build System > C compiler
Then Press Ctrl B and this should compile and run both within sublime. Adding other flags while compiling produces complexity which this build does not provide but can be added see http://stackoverflow.com/questions/23588260/does-the-sublime-text-2-build-system-accept-input-if-does-not-are-there-any-wor

1 Like

#4

The shell_cmd has been designed to deprecate the shell option and accepts a string. This more accurately describes how she’ll commands are actually run.

0 Likes

#5

shell_cmd: “Cygwin” ? Rather than using shell and path? - if you know an improvement may as well write the whole thing if it’s just a line. If I knew it I wouldve done it from the beginning.

0 Likes

#6

Sorry, I was on mobile. I meant to say to do it like this:

{
    "shell_cmd" : "gcc \"$file_name\" -o \"${file_base_name}.exe\" && \"${file_base_name}.exe\"",
    "selector" : "source.c",
    "path" : "C:\\cygwin64\\bin;$path",
    "working_dir" : "$file_path"
}

Just like you would enter it into your shell (or the cmd prompt for Windows).

2 Likes

#7

Is there any benefit to this? - i dont know much about builds

0 Likes

#8

Knowing the internals of this (i.e. how builds are run), I’d say it is more predictable and there may be situations where the cmd + shell combination may not produce what you want, although I don’t know any example.

0 Likes

#10

Please be more specific.

0 Likes

#13

Here is how to do it with clang…

{
“shell_cmd” : “clang-3.8.exe -o “$file_base_name” “${file_name}” && “./${file_base_name}””,
“selector” : “source.c”,
“path” : “C:\cygwin64\bin;$path”,
“working_dir” : “$file_path”
}

0 Likes

#14

Is there a way i can get this to work with console exec?

{
“shell_cmd” : “clang-3.8.exe -o “$file_base_name” “${file_name}” && “./${file_base_name}””,
“selector” : “source.c”,
“path” : “C:\cygwin64\bin;$path”,
“working_dir” : “$file_path”
}
when i add ,
“,target”: “console_exec” it still doesnt work. although console exec is working with my java sublime build

https://packagecontrol.io/packages/Console%20Exec

@fico - i gave up on urs i saw this as much easier…
my java sublime build works with console exec why doesnt this?

0 Likes