diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..aa146220 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,83 @@ +name: cmake + +on: + push: + pull_request: + schedule: + - cron: '0 1 * * SUN' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - CC: gcc-12 + CXX: g++-12 + PackageDeps: g++-12 + os: ubuntu-22.04 + - CC: vs2019 + CXX: vs2019 + os: windows-2019 + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} ${{ matrix.CXX }} + env: + DOC_ROOT: ${{ github.workspace }}/ACE_TAO + ACE_ROOT: ${{ github.workspace }}/ACE_TAO/ACE + MPC_ROOT: ${{ github.workspace }}/ + CC: ${{ matrix.CC }} + CXX: ${{ matrix.CXX }} + steps: + - name: checkout MPC + uses: actions/checkout@v4 + - name: checkout ACE_TAO + uses: actions/checkout@v4 + with: + repository: DOCGroup/ACE_TAO + path: ${{ env.DOC_ROOT }} + - name: Add Repo + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ ${{ matrix.Repo }} main" + if: matrix.Repo != '' + - name: Add packages + run: | + sudo apt-get --yes update + sudo apt-get --yes install ${{ matrix.PackageDeps }} + if: matrix.PackageDeps != '' + - name: create $ACE_ROOT/ace/config.h + run: | + '#ifdef linux' > ${env:ACE_ROOT}/ace/config.h + '# include "ace/config-linux.h"' >> ${env:ACE_ROOT}/ace/config.h + '#else' >> ${env:ACE_ROOT}/ace/config.h + '# include "ace/config-win32.h"' >> ${env:ACE_ROOT}/ace/config.h + '#endif' >> ${env:ACE_ROOT}/ace/config.h + shell: pwsh + - name: Run mwc.pl on $(ACE_ROOT)/ace/ace.mwc + run: | + perl ${env:ACE_ROOT}/bin/mwc.pl -type cmake ${env:ACE_ROOT}/ace/ace.mwc -workers 6 + shell: pwsh + - name: Run mwc.pl on $(ACE_ROOT)/apps/gperf/src + run: | + perl ${env:ACE_ROOT}/bin/mwc.pl -type cmake ${env:ACE_ROOT}/apps/gperf/src + shell: pwsh + - name: Build ace project + run: | + cd ${env:ACE_ROOT}/ace + cmake -S . -B build + cmake --build build -j6 + shell: pwsh + - name: Build ACE/apps/gperf/src project + run: | + cd ${env:ACE_ROOT}/apps/gperf/src + cmake -S . -B build + cmake --build build -j6 + shell: pwsh diff --git a/docs/templates/cmake.txt b/docs/templates/cmake.txt index c20cb054..bca6cd84 100644 --- a/docs/templates/cmake.txt +++ b/docs/templates/cmake.txt @@ -15,3 +15,4 @@ env_libout = The value of 'libout' with $() values converted to $ENV{}. env_libpaths = The value of 'libpaths' with $() values converted to $ENV{}. packages = A list of packages to be used with the find_package() command. pre_find_package = A specific command or set of commands to be issued before any find_package() commands are called. +languagestandard = Which version of ISO C++ standard to compile against (14, 17, 20) diff --git a/templates/cmake.mpd b/templates/cmake.mpd index 9e39dc43..c9bbcaf3 100644 --- a/templates/cmake.mpd +++ b/templates/cmake.mpd @@ -127,6 +127,10 @@ set_target_properties(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PROPERTI <%endif%> <%endfor%> <%endif%> +<%endif%> +<%if(languagestandard)%> +target_compile_features(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC "cxx_std_<%languagestandard%>") + <%endif%> if(CMAKE_CONFIGURATION_TYPES)