use provided base project

This commit is contained in:
Arnaud Vergnet 2020-11-03 16:06:32 +01:00
parent 973184f0a9
commit 9ccd1c005b
16 changed files with 132 additions and 40 deletions

47
.github/workflows/workflow.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Basic test workflow
on:
- pull_request
- push
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
# - macos-latest
# - ubuntu-latest
# - windows-latest
- ubuntu-18.04
ocaml-version:
- 4.11.0
# - 4.10.1
# - 4.09.1
# - 4.08.1
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Try to restore opam cache
if: runner.os != 'Windows'
id: opam-cache
uses: actions/cache@v2
with:
path: "~/.opam"
key: ${{ matrix.os }}-${{ matrix.ocaml-version }}
- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml-version }}
- run: opam install ocamlbuild
- name: Build project
run: eval $(opam env) && make build
- name: Run demo
run: eval $(opam env) && make demo

24
.gitignore vendored
View file

@ -1,22 +1,4 @@
# ---> OCaml
*.annot
*.cmo
*.cma
*.cmi
*.a
*.o
*.cmx
*.cmxs
*.cmxa
# ocamlbuild working directory
_build/ _build/
ftest.native
# ocamlbuild targets outfile
*.byte *~
*.native
# oasis generated files
setup.data
setup.log

4
.merlin Normal file
View file

@ -0,0 +1,4 @@
PRJ maxflow
S src
B _build/src

7
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"files.associations": {
"*.ml": "ocaml",
"*.mli": "ocaml"
},
"editor.formatOnSave": true
}

16
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View file

@ -1,5 +0,0 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

20
Makefile Normal file
View file

@ -0,0 +1,20 @@
build:
@echo "\n==== COMPILING ====\n"
ocamlbuild ftest.native
format:
ocp-indent --inplace src/*
edit:
code . -n
demo: build
@echo "\n==== EXECUTING ====\n"
./ftest.native graphs/graph1 1 2 outfile
@echo "\n==== RESULT ==== (content of outfile) \n"
@cat outfile
clean:
-rm -rf _build/
-rm ftest.native

View file

@ -1,3 +1,21 @@
# be_ocaml Base project for Ocaml project on Ford-Fulkerson. This project contains some simple configuration files to facilitate editing Ocaml in VSCode.
To use, you should install the *OCaml* extension in VSCode. Other extensions might work as well but make sure there is only one installed.
Then open VSCode in the root directory of this repository (command line: `code path/to/ocaml-maxflow-project`).
Features :
- full compilation as VSCode build task (Ctrl+Shift+b)
- highlights of compilation errors as you type
- code completion
- automatic indentation on file save
A makefile provides some useful commands:
- `make build` to compile. This creates an ftest.native executable
- `make demo` to run the `ftest` program with some arguments
- `make format` to indent the entire project
- `make edit` to open the project in VSCode
- `make clean` to remove build artifacts
In case of trouble with the VSCode extension (e.g. the project does not build, there are strange mistakes), a common workaround is to (1) close vscode, (2) `make clean`, (3) `make build` and (4) reopen vscode (`make edit`).
Dépôt du be Ocaml 4IR

3
_tags Normal file
View file

@ -0,0 +1,3 @@
<src/**>: include

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB