Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added clang-17 back to ubuntuClang pipeline #334

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we could add a check for clang instead

and in CMakeLists add the define for clang like so:

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set(COMPILE_PLATFORM RAYX_PLATFORM_CLANG)

#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: 0 additions & 2 deletions Intern/rayx-ui/src/RayProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ std::vector<Line> getRays(const RAYX::BundleHistory& rayCache, const RAYX::Beaml
amountOfRays = (uint32_t)std::min(amountOfRays, uint32_t(rayCache.size()));
std::vector<size_t> rayIndices = filterFunction(rayCache, amountOfRays);
size_t maxRayIndex = rayCache.size();
int counter = 0;

// compile all elements
std::vector<RAYX::Element> compiledElements;
for (const auto& element : beamline.m_DesignElements) {
compiledElements.push_back(element.compile());
counter++;
}

for (size_t i : rayIndices) {
Expand Down
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
Loading