Skip to content

Commit

Permalink
added clang-17 back to ubuntuClang pipeline (#334)
Browse files Browse the repository at this point in the history
* enforce clang in ci

---------

Co-authored-by: F Zotter <[email protected]>
  • Loading branch information
fannyzotter and F Zotter authored Oct 8, 2024
1 parent 8ec21ec commit 23af4fa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/testUbuntuClang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ jobs:
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install --yes libomp-17-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DWERROR=YES -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRAYX_ENABLE_CUDA=OFF

run: |
CC="clang-17" CXX="clang++-17" cmake -B ${{github.workspace}}/build \
-DWERROR=YES \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DRAYX_ENABLE_CUDA=OFF \
-DCMAKE_CXX_FLAGS="-fopenmp -Werror" \
-DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib/llvm-17/lib -lomp"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: CXX="clang++-17 -Werror" cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Run
working-directory: ${{github.workspace}}
Expand All @@ -38,5 +45,4 @@ jobs:
- name: Test
working-directory: ${{github.workspace}}/build/bin/release
run: ./rayx-core-tst -x

run: ./rayx-core-tst -x
5 changes: 4 additions & 1 deletion Intern/rayx-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:${MSVC_CUDA_FLAGS}>)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
else()
message(STATUS "GCC")
message(STATUS "GCC or Clang")

target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wpedantic>)
Expand Down Expand Up @@ -134,7 +134,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(COMPILE_PLATFORM RAYX_PLATFORM_GCC)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILE_PLATFORM RAYX_PLATFORM_MSVC)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(COMPILE_PLATFORM RAYX_PLATFORM_CLANG)
else()
message(STATUS "Use undefined compiler: ${CMAKE_CXX_COMPILER_ID}")
set(COMPILE_PLATFORM RAYX_PLATFORM_UNKNOWN)
endif()

Expand Down
8 changes: 7 additions & 1 deletion Intern/rayx-core/src/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@
#else
#define RAYX_API
#endif
#elif defined(RAYX_PLATFORM_CLANG) // Clang
#ifdef RAYX_BUILD_DLL
#define RAYX_API __attribute__((visibility("default")))
#else
#define RAYX_API
#endif
#else // do nothing and hope for the best?
#ifdef RAYX_BUILD_DLL
#define RAYX_API
#else
#define RAYX_API
#endif
#pragma warning Unknown dynamic link import / export semantics.
#pragma warning Unknown dynamic link import / export semantics
#endif

// make string comparison available for msvc compiler
Expand Down
2 changes: 1 addition & 1 deletion Intern/rayx-core/src/Tracer/DeviceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct RAYX_API DeviceConfig {
std::vector<Device> devices;

private:
const DeviceType m_fetchedDeviceType;
DeviceType m_fetchedDeviceType;
};

} // namespace RAYX
2 changes: 1 addition & 1 deletion Intern/rayx-ui/src/UserInterface/BeamlineDesignHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void BeamlineDesignHandler::createInputField(const std::string& key, RAYX::Desig
}

if (ImGui::BeginCombo("##combo", currentItem >= 0 ? RAYX::ElementStringMap[currentEl].c_str() : "")) {
int n = 0;
[[maybe_unused]] int n = 0;
for (const auto& pair : RAYX::ElementStringMap) {
bool isSelected = (currentEl == pair.first);
if (ImGui::Selectable(pair.second.c_str(), isSelected)) {
Expand Down

0 comments on commit 23af4fa

Please sign in to comment.