Skip to content

Commit 909b1e9

Browse files
committed
wip
1 parent 4fc6b75 commit 909b1e9

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

brewkit/path.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export default class Path {
2525
return new Path(Deno.cwd());
2626
}
2727

28+
static parent(): Path {
29+
return Path.cwd().parent();
30+
}
31+
2832
static home(): Path {
2933
return new Path(
3034
(() => {

projects/llvm.org/openmp/build.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { BuildOptions, unarchive, run, Path } from "brewkit";
2+
3+
export default async function ({ prefix, version }: BuildOptions) {
4+
await unarchive(`https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/openmp-${version}.src.tar.xz`);
5+
6+
// grab the extra `*.cmake` files this project needs to build
7+
// the cd stuff is required to make it build, we need a directory parent to the sources with the cmake shit
8+
Path.parent().join("cmake").mkdir().cd();
9+
await unarchive(`https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/cmake-${version}.src.tar.xz`);
10+
Path.parent().cd();
11+
12+
run`cmake
13+
-S src
14+
-B bld
15+
-DLIBOMP_INSTALL_ALIASES=OFF
16+
-DCMAKE_INSTALL_PREFIX=${prefix}
17+
-Wno-dev'
18+
-DBUILD_TESTING=OFF
19+
`;
20+
run`cmake --build bld --target install`;
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name:
2+
OpenMP
3+
4+
names:
5+
- OpenMP
6+
- libomp
7+
8+
repository:
9+
https://github.com/llvm/llvm-project
10+
11+
platforms:
12+
- darwin/aarch64
13+
- linux/x86-64
14+
15+
linux:
16+
dependencies:
17+
gnu.org/gcc/libstdcxx: ^14

projects/llvm.org/openmp/test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <omp.h>
2+
#include <array>
3+
int main (int argc, char** argv) {
4+
std::array<size_t,2> arr = {0,0};
5+
#pragma omp parallel num_threads(2)
6+
{
7+
size_t tid = omp_get_thread_num();
8+
arr.at(tid) = tid + 1;
9+
}
10+
if(arr.at(0) == 1 && arr.at(1) == 2)
11+
return 0;
12+
else
13+
return 1;
14+
}

projects/llvm.org/openmp/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { run } from "brewkit";
2+
3+
export default async function () {
4+
run`c++ -Werror -Xpreprocessor -fopenmp ./test.cpp -std=c++11 -lomp `;
5+
run`./a.out`;
6+
}

0 commit comments

Comments
 (0)