From a484ba067f8e48f7ad5026f2eab2e19b227f5645 Mon Sep 17 00:00:00 2001 From: Radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Mon, 10 Jun 2024 06:32:35 +0430 Subject: [PATCH] macos workflow, format build for windows, fix config_file.c called pthread directly --- .github/workflows/cmake-multi-macos.yml | 58 +++++++++++++++++++++++++ ww/CMakeLists.txt | 3 ++ ww/config_file.c | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cmake-multi-macos.yml diff --git a/.github/workflows/cmake-multi-macos.yml b/.github/workflows/cmake-multi-macos.yml new file mode 100644 index 00000000..6d5327c6 --- /dev/null +++ b/.github/workflows/cmake-multi-macos.yml @@ -0,0 +1,58 @@ +name: macos gcc + clang + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + + + matrix: + os: [macos-latest] + build_type: [Release] + c_compiler: [gcc, clang] + include: + - os: macos-latest + c_compiler: gcc + cpp_compiler: g++ + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + + + steps: + - uses: actions/checkout@v3 + + + - name: Set reusable strings + + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install dependencies on macOS + if: runner.os == 'macOS' + run: | + brew update + brew install ccache + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} + + diff --git a/ww/CMakeLists.txt b/ww/CMakeLists.txt index c18db76a..989bc8e7 100644 --- a/ww/CMakeLists.txt +++ b/ww/CMakeLists.txt @@ -93,6 +93,9 @@ endif() if(CMAKE_BUILD_TYPE STREQUAL "Release") target_link_options(ww PUBLIC -s) + if (WIN32) + target_link_options(ww PUBLIC -static-libgcc -static) + endif() endif() # target_compile_options(hv_static PRIVATE -fPIC) diff --git a/ww/config_file.c b/ww/config_file.c index dc0596c1..bce793a1 100644 --- a/ww/config_file.c +++ b/ww/config_file.c @@ -67,7 +67,7 @@ void commitChangesSoft(config_file_t *state) #ifdef OS_WIN commitChangesHard(state); #else - if (0 == pthread_mutex_trylock(&(state->guard))) + if (0 == hmutex_lock(&(state->guard))) { unsafeCommitChanges(state); releaseUpdateLock(state);