Skip to content

Commit d70bfe6

Browse files
authored
Merge pull request #63 from elbeno/usage-test
✅ Add usage test for freestanding
2 parents b3eac95 + 2b1a797 commit d70bfe6

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

.github/workflows/usage_test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Usage Test
2+
permissions: read-all
3+
4+
on:
5+
workflow_dispatch:
6+
merge_group:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
env:
13+
DEBIAN_FRONTEND: noninteractive
14+
USER_LLVM_VERSION: 14
15+
USER_CMAKE_VERSION: 3.25
16+
17+
jobs:
18+
usage_test:
19+
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
freestanding: [0, 1]
24+
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
28+
- name: Install compiler
29+
run: sudo apt update && sudo apt-get install -y clang-${{env.USER_LLVM_VERSION}}
30+
31+
- name: Install cmake
32+
run: |
33+
pip3 install --upgrade pip
34+
pip3 install --force cmake==${{env.USER_CMAKE_VERSION}}
35+
36+
- name: Configure CMake
37+
working-directory: ${{github.workspace}}/usage_test
38+
env:
39+
CC: "/usr/lib/llvm-${{env.USER_LLVM_VERSION}}/bin/clang"
40+
CXX: "/usr/lib/llvm-${{env.USER_LLVM_VERSION}}/bin/clang++"
41+
run: ~/.local/bin/cmake -B build -DSIMULATE_FREESTANDING=${{matrix.freestanding}}
42+
43+
- name: Build
44+
working-directory: ${{github.workspace}}/usage_test
45+
run: ~/.local/bin/cmake --build build

usage_test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if(DEFINED ENV{USER_CMAKE_VERSION})
2+
message(STATUS "Required minimum cmake version: $ENV{USER_CMAKE_VERSION}")
3+
cmake_minimum_required(VERSION $ENV{USER_CMAKE_VERSION})
4+
endif()
5+
message(STATUS "Actual cmake version: ${CMAKE_VERSION}")
6+
7+
project(conc_usage)
8+
9+
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/get_cpm.cmake)
10+
cpmaddpackage(NAME conc SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/.." GIT_TAG HEAD)
11+
12+
add_executable(app main.cpp)
13+
target_link_libraries(app PRIVATE concurrency)
14+
if(SIMULATE_FREESTANDING)
15+
target_compile_definitions(app PRIVATE SIMULATE_FREESTANDING)
16+
target_compile_options(app PRIVATE -ffreestanding)
17+
endif()

usage_test/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <conc/atomic.hpp>
2+
#include <conc/concurrency.hpp>
3+
4+
#if __STDC_HOSTED__ == 0
5+
extern "C" auto main() -> int;
6+
#endif
7+
8+
auto main() -> int { return 0; }

0 commit comments

Comments
 (0)