Compile all parts in project, optionally using GNU parallel if available.
This commit is contained in:
parent
98e1e73163
commit
de6f0d0495
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy-app",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy-app",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "mcopy",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mcopy",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"arduino": "file:app/lib/arduino",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mcopy",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"description": "Small gauge film optical printer platform",
|
||||
"main": "build.js",
|
||||
"directories": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"ext_port": 1111,
|
||||
"profiles": {
|
||||
"mcopy": {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
listParts () {
|
||||
cat "${1}" | grep 'PART ==' | grep -v 'debug' | awk -F'"' '{print $2}'
|
||||
}
|
||||
|
||||
allParts () {
|
||||
PARTS=($(listParts "scad/${1}.scad"))
|
||||
for part in "${PARTS[@]}"; do
|
||||
bash ./scripts/openscadPart.sh "${1}.scad" "${part}" "${1}_${part}.stl"
|
||||
done
|
||||
}
|
||||
|
||||
parallelParts () {
|
||||
PARTS=($(listParts "scad/${1}.scad"))
|
||||
parallel --use-cpus-instead-of-cores bash ./scripts/openscadPart.sh "${1}.scad" "{}" "${1}_{}.stl" ::: "${PARTS[@]}"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
openscad -o "./stl/${3}" -D"PART=\"${2}\"" "./scad/${1}"
|
||||
echo "Compiled ${3} from ${1}"
|
||||
if [ -f "./scad/common/c14n_stl.py" ]; then
|
||||
python3 ./scad/common/c14n_stl.py "./stl/${3}"
|
||||
echo "Normalized ${3}"
|
||||
fi
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
source ./scripts/common.sh
|
||||
|
||||
FILES=(
|
||||
arri_s
|
||||
bellows
|
||||
|
@ -8,25 +10,11 @@ FILES=(
|
|||
mcopy_projector
|
||||
)
|
||||
|
||||
openscadPart () {
|
||||
openscad -o "./stl/${3}" -D"PART=\"${2}\"" "./scad/${1}"
|
||||
echo "Compiled ${3} from ${1}"
|
||||
if [ -f "./scad/common/c14n_stl.py" ]; then
|
||||
python3 ./scad/common/c14n_stl.py "./stl/${3}"
|
||||
echo "Normalized ${3}"
|
||||
fi
|
||||
}
|
||||
|
||||
listParts () {
|
||||
cat "${1}" | grep 'PART ==' | grep -v 'debug' | awk -F'"' '{print $2}'
|
||||
}
|
||||
|
||||
allParts () {
|
||||
PARTS=($(listParts "scad/${1}.scad"))
|
||||
for part in "${PARTS[@]}"; do
|
||||
echo opencadPart "${1}.scad" "${part}" "${1}_${part}.stl"
|
||||
done
|
||||
}
|
||||
PARALLEL=0
|
||||
HAS_PARALLEL=$(which parallel)
|
||||
if [[ "${HAS_PARALLEL}" != "" ]]; then
|
||||
PARALLEL=1
|
||||
fi
|
||||
|
||||
if [[ "${1}" == "all" ]]; then
|
||||
for file in "${FILES[@]}"; do
|
||||
|
@ -34,7 +22,11 @@ if [[ "${1}" == "all" ]]; then
|
|||
done
|
||||
else
|
||||
if [ -f "scad/${1}.scad" ]; then
|
||||
allParts "${1}"
|
||||
if [ ${PARALLEL} -eq 1 ]; then
|
||||
parallelParts "${1}"
|
||||
else
|
||||
allParts "${1}"
|
||||
fi
|
||||
elif [[ "${1}" != "" ]]; then
|
||||
echo "File scad/${1}.scad not found"
|
||||
exit 2
|
||||
|
|
Loading…
Reference in New Issue