user4478: How do you specify a custom location for your sketch?
I want my code to be located in a src folder, but when I try to compile my main.ino, arduino complains "The file main.ino needs to be inside a sketch folder named "main". How do I disable this arbitrary restriction?

user4478: I found I could accomplish this using the arduino-builder tool. I created this simple bash script to do the compilation:
#!/bin/bash
CURRENT_DIR=`pwd`
mkdir -p $CURRENT_DIR/.build
arduino-builder -compile -hardware /usr/share/arduino/hardware -tools /usr/share/arduino/hardware/tools -tools /usr/share/arduino/tools-builder -libraries $CURRENT_DIR/lib -fqbn arduino:avr:uno -build-path $CURRENT_DIR/.build $CURRENT_DIR/src/main.ino


4478: <p>How do you specify a custom location for your sketch?</p>

<p>I want my code to be located in a <code>src</code> folder, but when I try to compile my <code>main.ino</code>, <code>arduino</code> complains <code>"The file main.ino needs to be inside a sketch folder named "main".</code> How do I disable this arbitrary restriction?</p>
 4478: <p>I found I could accomplish this using the <a href="https://github.com/arduino/arduino-builder" rel="nofollow noreferrer">arduino-builder</a> tool. I created this simple bash script to do the compilation:</p>

<pre><code>#!/bin/bash
CURRENT_DIR=`pwd`
mkdir -p $CURRENT_DIR/.build
arduino-builder -compile -hardware /usr/share/arduino/hardware -tools /usr/share/arduino/hardware/tools -tools /usr/share/arduino/tools-builder -libraries $CURRENT_DIR/lib -fqbn arduino:avr:uno -build-path $CURRENT_DIR/.build $CURRENT_DIR/src/main.ino
</code></pre>
