Commit ee384489 authored by Kaspar Emanuel's avatar Kaspar Emanuel

Switch gitlab ci to build.sh

parent 4b735674
Pipeline #99671505 passed with stage
in 4 minutes and 36 seconds
......@@ -18,8 +18,7 @@ build:
script:
# Build STL files with OpenSCAD
- mkdir -p /root/.local/share
- mkdir builds
- make -j2
- ./build.sh
artifacts:
expire_in: 1 week
......
# Makefile for the openflexure block stage
# Generated by generate_makefile.py
.PHONY: all cleanstl
SOURCE = openscad
OUTPUT = builds
BODIES := main_body_micromanipulator_2mm main_body_fibre_stage_1mm
BASES := base_micromanipulator_2mm base_fibre_stage_1mm
TOOLS := actuator_assembly_tools
ACCESSORIES := accessories/LED_to_top_plate accessories/rms_to_top_plate accessories/CPS532_to_top_plate accessories/microscope_module
COMMONPARTS := gears small_gears moving_platform
ALLPARTS := $(COMMONPARTS) $(TOOLS) $(BODIES) $(BASES) $(ACCESSORIES)
ALLSTLFILES := $(ALLPARTS:%=$(OUTPUT)/%.stl)
parameters_file := $(SOURCE)/parameters.scad
utilities_file := $(SOURCE)/utilities.scad
all_deps := $(parameters_file) $(utilities_file) #All targets depend on these
all: $(ALLSTLFILES)
cleanstl:
rm $(STLFILES)
#parameter and utilities files affect everything
$(OUTPUT)/%.stl: $(all_deps)
main_body_dep_names := compact_nut_seat fibre_stage_three_legs
main_body_deps := $(main_body_dep_names:%=$(SOURCE)/%.scad)
$(OUTPUT)/main_body_micromanipulator_2mm.stl: $(SOURCE)/main_body.scad $(main_body_deps)
openscad -o [email protected] -D 'xy_lever=20' -D 'z_lever=20' -D 'beam_height=85' -D 'fixed_stage=false' -D 'breadboard_lugs="atsides"' $<
$(OUTPUT)/base_micromanipulator_2mm.stl: $(SOURCE)/base.scad $(main_body_deps)
openscad -o [email protected] -D 'xy_lever=20' -D 'z_lever=20' -D 'beam_height=85' -D 'fixed_stage=false' -D 'breadboard_lugs="atsides"' $<
$(OUTPUT)/main_body_fibre_stage_1mm.stl: $(SOURCE)/main_body.scad $(main_body_deps)
openscad -o [email protected] -D 'xy_lever=10' -D 'z_lever=10' -D 'beam_height=75' -D 'fixed_stage=true' -D 'breadboard_lugs="diagonal"' $<
$(OUTPUT)/base_fibre_stage_1mm.stl: $(SOURCE)/base.scad $(main_body_deps)
openscad -o [email protected] -D 'xy_lever=10' -D 'z_lever=10' -D 'beam_height=75' -D 'fixed_stage=true' -D 'breadboard_lugs="diagonal"' $<
$(OUTPUT)/actuator_assembly_tools.stl: $(SOURCE)/actuator_assembly_tools.scad
openscad -o [email protected] -D 'foot_height=26' $<
$(OUTPUT)/accessories/LED_to_top_plate.stl: $(SOURCE)/accessories/LED_to_top_plate.scad
openscad -o [email protected] $<
$(OUTPUT)/accessories/rms_to_top_plate.stl: $(SOURCE)/accessories/rms_to_top_plate.scad
openscad -o [email protected] $<
$(OUTPUT)/accessories/CPS532_to_top_plate.stl: $(SOURCE)/accessories/CPS532_to_top_plate.scad
openscad -o [email protected] $<
$(OUTPUT)/accessories/microscope_module.stl: $(SOURCE)/accessories/microscope_module.scad
openscad -o [email protected] $<
$(OUTPUT)/%.stl: $(SOURCE)/%.scad $(all_deps)
openscad -o [email protected] $<
File mode changed from 100644 to 100755
#!python
import re
"""This script generates the Makefile for the Openflexure Microscope.
It is intended to be run whenever you need a new makefile. The makefile lives in
the repository and is versioned, so most people never need to run this script.
"""
def part_versions(part_name, versions):
"""Given a part name and a dictionary of versions, list all the possible part names.
For example::
>>> part_versions("body_{}", {"a":{}, "b":{}})
"body_a body_b"
"""
return " ".join(part_name.format(n) for n in versions.keys())
def openscad_recipe(**kwargs):
"""Create a makefile recipe to compile an openscad file with given options."""
output = "\t" + "openscad -o [email protected]"
for name, value in kwargs.iteritems():
try:
float(value)
except ValueError:
# numbers and booleans are OK, but strings need to be double-quoted on the command line.
if value not in ["true", "false"]:
value = '"{}"'.format(value)
if type(value) == type(True): #need to convert boolean values
value = "true" if value else "false"
output += " -D '{name}={value}'".format(name=name, value=str(value))
output += " $<\n"
return output
body_versions = {
"fibre_stage_1mm":{
"beam_height":75,
"xy_lever":10,
"z_lever":10,
"breadboard_lugs":"diagonal",
"fixed_stage":True,
},
"micromanipulator_2mm":{
"beam_height":85,
"xy_lever":20,
"z_lever":20,
"breadboard_lugs":"atsides",
"fixed_stage":False,
},
}
accessory_versions = {
"CPS532_to_top_plate":{},
"LED_to_top_plate":{},
"rms_to_top_plate":{},
"microscope_module":{},
}
if __name__ == "__main__":
with open("Makefile","w") as makefile:
def M(line):
makefile.write(line + "\n")
M("# Makefile for the openflexure block stage")
M("# Generated by generate_makefile.py")
M(".PHONY: all cleanstl")
M("")
M("SOURCE = openscad")
M("OUTPUT = builds")
M("")
M("BODIES := " + part_versions("main_body_{}", body_versions))
M("BASES := " + part_versions("base_{}", body_versions))
M("TOOLS := actuator_assembly_tools")
M("ACCESSORIES := " + part_versions("accessories/{}", accessory_versions))
M("COMMONPARTS := gears small_gears moving_platform")
M("ALLPARTS := $(COMMONPARTS) $(TOOLS) $(BODIES) $(BASES) $(ACCESSORIES)")
M("ALLSTLFILES := $(ALLPARTS:%=$(OUTPUT)/%.stl)")
M("")
M("parameters_file := $(SOURCE)/parameters.scad")
M("utilities_file := $(SOURCE)/utilities.scad")
M("all_deps := $(parameters_file) $(utilities_file) #All targets depend on these")
M("")
M("all: $(ALLSTLFILES)")
M("")
M("cleanstl:")
M("\t"+"rm $(STLFILES)")
M("")
M("#parameter and utilities files affect everything")
M("$(OUTPUT)/%.stl: $(all_deps)")
M("")
M("main_body_dep_names := compact_nut_seat fibre_stage_three_legs")
M("main_body_deps := $(main_body_dep_names:%=$(SOURCE)/%.scad)")
for version, parameters in body_versions.items():
M("$(OUTPUT)/main_body_" + version + ".stl: $(SOURCE)/main_body.scad $(main_body_deps)")
M(openscad_recipe(**parameters))
M(" ")
M("$(OUTPUT)/base_" + version + ".stl: $(SOURCE)/base.scad $(main_body_deps)")
M(openscad_recipe(**parameters))
M("")
M("$(OUTPUT)/actuator_assembly_tools.stl: $(SOURCE)/actuator_assembly_tools.scad")
M(openscad_recipe(foot_height=26))
M("")
for version, parameters in accessory_versions.items():
M("$(OUTPUT)/accessories/" + version + ".stl: $(SOURCE)/accessories/" + version + ".scad")
M(openscad_recipe(**parameters))
M("")
M("$(OUTPUT)/%.stl: $(SOURCE)/%.scad $(all_deps)")
M(openscad_recipe())
M("")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment