From 7756235123317e289d74290ec7b956615176c897 Mon Sep 17 00:00:00 2001 From: Bocchio01 Date: Tue, 5 Mar 2024 05:43:57 -0500 Subject: [PATCH] Fixing compiler option and adding macOS compiling --- .github/workflows/cmake-multi-platform.yml | 23 ++++------------------ README.md | 2 +- libs/cFILE/cFILE.c | 2 +- libs/cFILE/cFILE.h | 4 ++-- libs/cGETOPT/CMakeLists.txt | 2 +- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 9ec0432..b3affb0 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -1,5 +1,3 @@ -# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. -# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml name: CMake on multiple platforms on: @@ -13,17 +11,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. fail-fast: false - - # Set up a matrix to run the following 3 configurations: - # 1. - # 2. - # 3. - # - # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest] build_type: [Release] c_compiler: [gcc, clang, cl] include: @@ -36,6 +26,9 @@ jobs: - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ exclude: - os: windows-latest c_compiler: gcc @@ -48,28 +41,20 @@ jobs: - uses: actions/checkout@v3 - name: Set reusable strings - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 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 - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --build-config ${{ matrix.build_type }} diff --git a/README.md b/README.md index 5321b63..3c7acb8 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ Here is an example of how to run the code with the default parameters: ### Plot the results -You can plot the results using the `MATLAB` script provided in the `sim_output/plotting` folder. +You can plot the results using the `MATLAB` script provided in the `sim_plotting` folder. ## Trouble shooting diff --git a/libs/cFILE/cFILE.c b/libs/cFILE/cFILE.c index 8dec38a..dde7164 100644 --- a/libs/cFILE/cFILE.c +++ b/libs/cFILE/cFILE.c @@ -87,7 +87,7 @@ bool FILE_Read(cFILE_t *file) return true; } -bool FILE_Write(cFILE_t *file, mode_t mode) +bool FILE_Write(cFILE_t *file, cFILE_opening_mode_t mode) { char full_path[100] = {0}; diff --git a/libs/cFILE/cFILE.h b/libs/cFILE/cFILE.h index dfbda95..7ac0e85 100644 --- a/libs/cFILE/cFILE.h +++ b/libs/cFILE/cFILE.h @@ -16,7 +16,7 @@ typedef enum { WRITE = 'w', APPEND = 'a' -} mode_t; +} cFILE_opening_mode_t; typedef struct { @@ -34,7 +34,7 @@ void FILE_Free(cFILE_t *file); bool FILE_Read(cFILE_t *file); -bool FILE_Write(cFILE_t *file, mode_t mode); +bool FILE_Write(cFILE_t *file, cFILE_opening_mode_t mode); char *FILE_Extension_to_String(extension_t extension); diff --git a/libs/cGETOPT/CMakeLists.txt b/libs/cGETOPT/CMakeLists.txt index 90ef982..fdb3f23 100644 --- a/libs/cGETOPT/CMakeLists.txt +++ b/libs/cGETOPT/CMakeLists.txt @@ -13,7 +13,7 @@ if(MSVC) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(-w) + target_compile_options(${PROJECT_NAME} PRIVATE -w) elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") target_compile_options(${PROJECT_NAME} PRIVATE /w) endif()