diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc0acd3..30ed0e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,35 @@ jobs: name: e-book PDF (Ubuntu) path: controls-engineering-in-frc-ebook.pdf + windows: + runs-on: windows-latest + defaults: + run: + shell: bash + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install system dependencies + run: ./setup_windows.sh + + - name: Generate PDF + run: | + setx path "%PATH%;C:\texlive\2022\bin\win32" + make -j1 ebook + + - uses: actions/upload-artifact@v3 + with: + name: e-book PDF (Windows) + path: controls-engineering-in-frc-ebook.pdf + macos: if: false runs-on: macos-latest diff --git a/Makefile b/Makefile index 01f2141..1f4c738 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,11 @@ rwildcard=$(wildcard $1$2) $(foreach dir,$(wildcard $1*),$(call rwildcard,$(dir) # C++ files that generate SVG files CPP := $(filter-out ./bookutil/% ./build/% ./lint/% ./snippets/%,$(call rwildcard,./,*.cpp)) -CPP_EXE := $(addprefix build/,$(CPP:.cpp=)) +ifeq ($(OS),Windows_NT) + CPP_EXE := $(addprefix build/,$(CPP:.cpp=.exe)) +else + CPP_EXE := $(addprefix build/,$(CPP:.cpp=)) +endif # Python files that generate SVG files PY := $(filter-out ./bookutil/% ./build/% ./lint/% ./setup_venv.py ./snippets/%,$(call rwildcard,./,*.py)) @@ -90,13 +94,22 @@ build/venv.stamp: $(VENV_PIP) install frccontrol==2023.28 pylint qrcode requests robotpy-wpimath==2024.0.0b3.post1 @touch $@ +ifeq ($(OS),Windows_NT) +$(CPP_EXE): build/%.exe: %.cpp build/venv.stamp +else $(CPP_EXE): build/%: %.cpp build/venv.stamp +endif @mkdir -p $(@D) # Run CMake cmake -B $(@D) -S $(dir $<) # Build and run binary - cmake --build $(@D) - cd $(@D) && ./$(notdir $(basename $<)) + cmake --build $(@D) --target $(notdir $(basename $@)) +ifeq ($(OS),Windows_NT) + cd $(@D)/Debug && ls ./$(notdir $@) + cd $(@D)/Debug && ./$(notdir $@) +else + cd $(@D) && ./$(notdir $@) +endif # Convert generated CSVs to PDFs $(abspath $(VENV_PYTHON)) ./snippets/sleipnir_csv_to_pdf.py $(@D)/*.csv diff --git a/README.md b/README.md index 1920056..da1d488 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Install the dependencies via one of the following commands: * `./setup_archlinux.sh` * `./setup_ubuntu.sh` +* `./setup_windows.sh' * `./setup_macos.sh` Run `make` to generate a PDF named controls-engineering-in-frc-ebook.pdf. diff --git a/setup_windows.sh b/setup_windows.sh new file mode 100644 index 0000000..70fd96e --- /dev/null +++ b/setup_windows.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +choco install \ + llvm \ + imagemagick \ + inkscape +choco install texlive --params="'/collections:basic /extraPackages:biber,biblatex,cm-super,csquotes,datatool,enumitem,footmisc,glossaries,glossaries-english,imakeidx,latexmk,mdframed,mfirstuc,needspace,placeins,titlesec,tracklang,type1cm,was,xfor,zref'" +setx path "%PATH%;C:\texlive\2022\bin\win32" + +# Python packages +# * black (to format Python source code) +# * gersemi (to format CMake files) +# * pylint (for Python linting) +pip3 install --user autoflake black gersemi qrcode requests wheel