1 # HAT Project
 2 
 3 ## TLDR
 4 
 5 If you have babylon jdk and jextract in your path you should be able to build using
 6 
 7 ```bash
 8 java @hat/bld
 9 ```
10 
11 To run an example (say `mandel`) on a platform with opencl, you can run with
12 
13 ```bash
14 java @hat/run ffi-opencl mandel
15 ```
16 
17 To run the test-suite (again assuming opencl)
18 
19 ```bash
20 java @hat/test-suite ffi-opencl
21 ```
22 
23 
24 ## For the more patient ;)
25 
26 This is a fairly large project with Java and native (C/C++) artifacts.
27 
28 To use HAT you will need to clone and build the  `babylon` (JDK24+Babylon) project or of course your fork of the babylon project (say `babylon-myfork`)
29 
30 [github.com/openjdk/babylon](https://github.com/openjdk/babylon)
31 
32 The HAT project is in the 'hat' subdir of the babylon project.
33 
34 ## Building Babylon
35 
36 [See](docs/hat-01-02-building-babylon.md)
37 
38 ## Building HAT
39 
40 [See](docs/hat-01-03-building-hat.md)
41 
42 
43 ## Intellij and Clion
44 We can use JetBrains' `intelliJ` and `clion` but care must be taken as these tools
45 do not play well together, specifically we cannot have `Clion` and `Intellij`
46 project artifacts rooted under each other or in the same dir.
47 
48 The `intellij` subdir houses the various `*.iml` module files and the project `.idea` so
49 just open that dir as an intellij project
50 
51 Thankfully `clion` uses cmake. So we can reuse the same `hat/backends/CMakeLists.txt` that
52 maven uses to build the backends.
53 
54 ### Initial Project Layout
55 
56 ```
57 ${BABYLON_JDK}
58    └── hat
59         ├── build (created by the build)
60         │
61         ├── intellij
62         │    ├── .idea
63         │    │    ├── compiler.xml
64         │    │    ├── misc.xml
65         │    │    ├── modules.xml
66         │    │    ├── uiDesigner.xml
67         │    │    ├── vcs.xml
68         │    │    └── workspace.xml
69         │    │
70         │    ├── hat.iml
71         │    ├── backend_(spirv|mock|cuda|ptx|opencl).iml
72         │    └── (mandel|violajones|experiments|heal|view).iml
73         │
74         ├── hat
75         │    ├── pom.xml
76         │    └── src
77         │         ├── src/main/java
78         │         └── src/main/resources
79         │
80         ├── backends
81         │    ├── pom.xml
82         │    ├── CMakeLists.txt
83         │    └── (opencl|cuda|ptx|hip|mock|shared)
84         │          ├── pom.xml
85         │          ├── CMakeLists.txt
86         │          ├── cpp
87         │          ├── include
88         │          ├── src/main/java
89         │          └── src/main/resources
90         └── examples
91              ├── pom.xml
92              └── (mandel|violajones|squares|heal|view|experiments)
93                     ├── pom.xml
94                     ├── src/main/java
95                     └── src/main/resources
96 ```
97 As you will note the `intellij` dir is somewhat self contained.  the various `*.iml`
98 files refer to the source dirs using relative paths.