From 9ab7dc723d32520b554cb7d38f7fc1af9d74b433 Mon Sep 17 00:00:00 2001 From: f0e <7321764+f0e@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:05:30 +1000 Subject: [PATCH] fix(ci): install latest clang version --- .github/workflows/build.yaml | 31 +++++++++++++++++++++++-------- CMakeLists.txt | 3 ++- CMakePresets.json | 6 ++++-- src/gui/gui.cpp | 4 ++-- src/gui/ui/utils.cpp | 26 +++++++++++++------------- src/gui/ui/utils.h | 2 +- 6 files changed, 45 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8800509..d223486 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] #, macos-latest, windows-latest] build-type: [release] steps: @@ -17,24 +17,37 @@ jobs: with: submodules: recursive + - name: Install LLVM Repository + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 19 + # Install system dependencies for Linux - name: Install Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y \ - libx11-dev \ - libxcursor-dev \ - libxinerama-dev \ - libxi-dev \ - libxrandr-dev \ - libgl1-mesa-dev + libc++-dev libc++abi-dev \ + libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \ + libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev \ + libpthread-stubs0-dev + + - name: Set up LLVM and Clang paths + run: | + echo "/usr/lib/llvm-19/bin" >> $GITHUB_PATH + echo "CC=/usr/bin/clang-19" >> $GITHUB_ENV + echo "CXX=/usr/bin/clang++-19" >> $GITHUB_ENV + + - name: Debug LLVM Version + run: clang++ --version # Install Ninja - name: Install Ninja uses: seanmiddleditch/gha-setup-ninja@master with: - version: 1.11.1 + version: 1.12.1 # Setup vcpkg - name: Setup vcpkg @@ -66,6 +79,8 @@ jobs: run: cmake --preset ${{ steps.select-preset.outputs.preset }} env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg + CMAKE_THREAD_LIBS_INIT: -pthread + THREADS_PREFER_PTHREAD_FLAG: ON # Build the project - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index ba18e7c..6e5455d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,8 @@ function(setup_target target) ${target} PRIVATE nlohmann_json::nlohmann_json Boost::system - Boost::filesystem) + Boost::filesystem + Threads::Threads) target_compile_definitions( ${target} PRIVATE NOMINMAX diff --git a/CMakePresets.json b/CMakePresets.json index eb1c5b7..8529b2b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -47,7 +47,9 @@ "value": "MultiThreadedDLL" }, "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++" + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++" }, "generator": "Ninja" }, @@ -134,4 +136,4 @@ "jobs": 0 } ] -} +} \ No newline at end of file diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 3a1e1a0..659f2df 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -17,8 +17,8 @@ void gui::update_vsync() { void* screen_handle = window->screen()->nativeHandle(); static void* last_screen_handle; #else - int screen_handle = (int)window->screen()->nativeHandle(); - static int last_screen_handle; + intptr_t screen_handle = (intptr_t)window->screen()->nativeHandle(); + static intptr_t last_screen_handle; #endif if (screen_handle != last_screen_handle) { diff --git a/src/gui/ui/utils.cpp b/src/gui/ui/utils.cpp index 2a286ca..5c6de9e 100644 --- a/src/gui/ui/utils.cpp +++ b/src/gui/ui/utils.cpp @@ -38,7 +38,7 @@ double utils::get_display_refresh_rate(HMONITOR hMonitor) #elif defined(__APPLE__) double utils::get_display_refresh_rate(void* nsScreen) // Take NSScreen* as void* to avoid Obj-C++ dependency #else -double utils::get_display_refresh_rate(int screenNumber) +double utils::get_display_refresh_rate(intptr_t screenNumber) #endif { #ifdef _WIN32 @@ -138,13 +138,13 @@ bool utils::show_file_selector( // aseprite dlg->setDefaultExtension(def_extension); } -#if LAF_LINUX // As the X11 version doesn't store the default path to - // start navigating, we use our own - // get_initial_path_to_select_filename() - dlg->setFileName(get_initial_path_to_select_filename(initialPath)); -#else // !LAF_LINUX - dlg->setFileName(initial_path); -#endif + // #if LAF_LINUX // As the X11 version doesn't store the default path to + // // start navigating, we use our own + // // get_initial_path_to_select_filename() + // dlg->setFileName(get_initial_path_to_select_filename(initialPath)); + // #else // !LAF_LINUX + // dlg->setFileName(initial_path); + // #endif dlg->setType(type); @@ -159,11 +159,11 @@ bool utils::show_file_selector( // aseprite else output.push_back(dlg->fileName()); -#if LAF_LINUX // Save the path in the configuration file - if (!output.empty()) { - set_current_dir_for_file_selector(base::get_file_path(output[0])); - } -#endif + // #if LAF_LINUX // Save the path in the configuration file + // if (!output.empty()) { + // set_current_dir_for_file_selector(base::get_file_path(output[0])); + // } + // #endif return true; } diff --git a/src/gui/ui/utils.h b/src/gui/ui/utils.h index 02f1355..c8daddf 100644 --- a/src/gui/ui/utils.h +++ b/src/gui/ui/utils.h @@ -11,7 +11,7 @@ namespace utils { #elif defined(__APPLE__) double get_display_refresh_rate(void* nsScreen); #else - double get_display_refresh_rate(int screenNumber); + double get_display_refresh_rate(intptr_t screenNumber); #endif // NOLINTEND