From 5ee5b7c829b8ad3d8cc382ca4bd5590915bc8db8 Mon Sep 17 00:00:00 2001 From: Matthew Rodusek Date: Wed, 30 Dec 2020 22:30:13 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A8=20Update=20broken=20CI=20workf?= =?UTF-8?q?low?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Github has deprecated and removed support for `set-env` in the CI workflow which has broken all of the existing CI workflows for Alloy. This updates the various workflows to use more modern support methods. --- .github/workflows/build-linux.yaml | 100 ---------------- .github/workflows/build-macos.yaml | 121 ++++++++++++------- .github/workflows/build-ubuntu.yaml | 132 +++++++++++++++++++++ .github/workflows/build-windows.yaml | 171 +++++++++++++++------------ 4 files changed, 306 insertions(+), 218 deletions(-) delete mode 100644 .github/workflows/build-linux.yaml create mode 100644 .github/workflows/build-ubuntu.yaml diff --git a/.github/workflows/build-linux.yaml b/.github/workflows/build-linux.yaml deleted file mode 100644 index 6ab0b275..00000000 --- a/.github/workflows/build-linux.yaml +++ /dev/null @@ -1,100 +0,0 @@ -name: build-linux - -on: [push, pull_request] - -jobs: - ci: - name: Ubuntu ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }} - runs-on: ${{ matrix.os }} - - env: - CMAKE_GENERATOR: Ninja - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - - strategy: - fail-fast: false - matrix: - os: [ubuntu-18.04] - compiler: [gcc, clang] - arch: [x86, x86_64] - build_type: [Debug, Release] - - include: - - - os: ubuntu-18.04 - compiler: gcc - version: 10 - - - os: ubuntu-18.04 - compiler: clang - version: 10 - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - - name: Install - run: | - # CMake 3.15 allows specifying the generator using the CMAKE_GENERATOR - # environment variable. - curl -sSL https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz -o cmake.tar.gz - sudo tar xf cmake.tar.gz --strip 1 -C /usr/local - # Required for libc6-dbg:i386 and g++-multilib packages which are - # needed for x86 builds. - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt-get install -y ninja-build - if [ "${{ matrix.compiler }}" = "gcc" ]; then - sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib - echo "::set-env name=CC::gcc-${{ matrix.version }}" - echo "::set-env name=CXX::g++-${{ matrix.version }}" - else - sudo apt-get install -y clang-${{ matrix.version }} g++-10-multilib - echo "::set-env name=CC::clang-${{ matrix.version }}" - echo "::set-env name=CXX::clang++-${{ matrix.version }}" - fi - python -m pip install --upgrade pip - pip install conan - conan --version - - - name: Prepare Architecture - run: | - if [ "${{ matrix.arch }}" = "x86" ]; then - echo "::set-env name=CXXFLAGS::${CXXFLAGS} -m32" - fi - - - name: Create Conan Profile - run: | - conan profile new --detect default - conan profile update settings.arch=${{ matrix.arch }} default - - - name: Configure - run: | - cmake -E remove_directory build - mkdir build - cd build - conan install .. -s build_type=${{ matrix.build_type }} - cmake .. \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \ - -DALLOY_COMPILE_TESTS=On \ - -DALLOY_COMPILE_EXTRAS=On \ - -DALLOY_COMPILE_EXAMPLES=On \ - -DALLOY_ENABLE_EXCEPTIONS=On - - - name: Build - run: | - cd build - cmake --build . - - - name: Test - run: | - cd build - ctest --output-on-failure diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 181ee464..42bf9580 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -3,32 +3,23 @@ name: build-macos on: [push, pull_request] jobs: - ci: - name: macOS ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }} - runs-on: ${{ matrix.os }} + test: + name: macoS Xcode ${{matrix.compiler.version}} ${{matrix.arch}} ${{matrix.build_type}} + runs-on: macos-latest env: - CMAKE_GENERATOR: Ninja - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 + build-directory: build strategy: fail-fast: false matrix: - os: [macOS-latest] - compiler: [xcode] arch: [x86_64] build_type: [Debug, Release] - - include: - - - os: macOS-latest - compiler: xcode - version: "11.3" + compiler: + - { name: "xcode", version: "12.3" } steps: - - - name: Checkout + - name: Clone uses: actions/checkout@v2 - name: Set up Python @@ -36,35 +27,27 @@ jobs: with: python-version: 3.7 - - name: Install + - name: Prepare Environment run: | - brew install cmake ninja - if [ "${{ matrix.compiler }}" = "gcc" ]; then - brew install gcc@${{ matrix.version }} - echo "::set-env name=CC::gcc-${{ matrix.version }}" - echo "::set-env name=CXX::g++-${{ matrix.version }}" - else - ls -ls /Applications/ - sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app - echo "::set-env name=CC::clang" - echo "::set-env name=CXX::clang++" - fi + ls -ls /Applications/ + sudo xcode-select -switch /Applications/Xcode_${{matrix.compiler.version}}.app + brew install ninja + python -m pip install --upgrade pip pip install conan - conan --version - - - name: Create Conan Profile - run: | - conan profile new --detect default + cmake -E make_directory ${{env.build-directory}} + cmake -E chdir ${{env.build-directory}} conan install .. -s build_type=${{matrix.build_type}} - name: Configure + working-directory: ${{env.build-directory}} + env: + CC: clang + CXX: clang++ run: | - cmake -E remove_directory build - mkdir build - cd build - conan install .. -s build_type=${{ matrix.build_type }} + conan profile new --detect default cmake .. \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -GNinja \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \ -DALLOY_COMPILE_TESTS=On \ -DALLOY_COMPILE_EXTRAS=On \ @@ -72,11 +55,63 @@ jobs: -DALLOY_ENABLE_EXCEPTIONS=On - name: Build - run: | - cd build - cmake --build . + working-directory: ${{env.build-directory}} + run: cmake --build . - name: Test + working-directory: ${{env.build-directory}} + run: ctest --output-on-failure + + sanitize: + name: macOS Xcode ${{matrix.compiler.version}} '${{matrix.sanitizer}}' sanitizer + runs-on: macos-latest + needs: test + + env: + build-directory: build + + strategy: + matrix: + sanitizer: [address, undefined] + + steps: + - name: Clone + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Prepare Environment + run: | + python -m pip install --upgrade pip + pip install conan + brew install ninja + cmake -E make_directory ${{env.build-directory}} + cmake -E chdir ${{env.build-directory}} conan install .. + + - name: Configure + working-directory: ${{env.build-directory}} + env: + CC: clang + CXX: clang++ run: | - cd build - ctest --output-on-failure + conan profile new --detect default + cmake .. \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \ + -DALLOY_COMPILE_TESTS=On \ + -DALLOY_COMPILE_EXTRAS=On \ + -DALLOY_COMPILE_EXAMPLES=On \ + -DALLOY_ENABLE_EXCEPTIONS=On \ + -DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}" + + - name: Build + working-directory: ${{env.build-directory}} + run: cmake --build . + + - name: Test (Sanitize) + working-directory: ${{env.build-directory}} + run: ctest --output-on-failure diff --git a/.github/workflows/build-ubuntu.yaml b/.github/workflows/build-ubuntu.yaml new file mode 100644 index 00000000..c94fb7a7 --- /dev/null +++ b/.github/workflows/build-ubuntu.yaml @@ -0,0 +1,132 @@ +name: build-linux + +on: [push, pull_request] + +jobs: + test: + name: Ubuntu ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }} + runs-on: ubuntu-20.04 + + env: + build-directory: build + + strategy: + fail-fast: false + matrix: + arch: [x86, x86_64] + build_type: [Debug, Release] + compiler: + - { cc: gcc-10, cxx: g++-10 } + - { cc: clang-10, cxx: clang++-10 } + + steps: + + - name: Clone + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Prepare Environment + run: | + if [[ "${{matrix.arch}}" == "x86" ]]; then + sudo dpkg --add-architecture i386 + fi + sudo apt-get update + sudo apt-get install -y ninja-build + if [[ "${{matrix.compiler.cc}}" =~ "gcc" ]]; then + sudo apt-get install -y ${{matrix.compiler.cxx}} ${{matrix.compiler.cxx}}-multilib + else + sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib + fi + python -m pip install --upgrade pip + pip install conan + conan --version + cmake -E make_directory ${{env.build-directory}} + + - name: Prepare Architecture + run: | + if [[ "${{matrix.arch}}" = "x86" ]]; then + echo "CXXFLAGS=${CXXFLAGS} -m32" >> ${GITHUB_ENV} + fi + + - name: Configure + working-directory: ${{env.build-directory}} + env: + CC: ${{matrix.compiler.cc}} + CXX: ${{matrix.compiler.cxx}} + run: | + conan profile new --detect default + conan profile update settings.arch=${{matrix.arch}} default + cmake .. \ + -GNinja \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \ + -DALLOY_COMPILE_TESTS=On \ + -DALLOY_COMPILE_EXTRAS=On \ + -DALLOY_COMPILE_EXAMPLES=On \ + -DALLOY_ENABLE_EXCEPTIONS=On + + - name: Build + working-directory: ${{env.build-directory}} + run: cmake --build . + + - name: Test + working-directory: ${{env.build-directory}} + run: ctest --output-on-failure + + # TODO(#9): Enable sanitizer on Ubuntu + # sanitize: + # name: ${{matrix.compiler.cc}} '${{matrix.sanitizer}}' sanitizer + # runs-on: ubuntu-20.04 + # needs: test + # + # env: + # build-directory: build + # + # strategy: + # matrix: + # compiler: + # - { cc: gcc, cxx: g++ } + # - { cc: clang, cxx: clang++ } + # sanitizer: [address, undefined] + # + # steps: + # - name: Clone + # uses: actions/checkout@v2 + # + # - name: Prepare Environment + # run: | + # sudo apt-get install -y ninja-build + # if [[ "${{matrix.compiler.cc}}" =~ "gcc" ]]; then + # sudo apt-get install -y ${{matrix.compiler.cxx}} ${{matrix.compiler.cxx}}-multilib + # else + # sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib + # fi + # cmake -E make_directory ${{env.build-directory}} + # + # - name: Configure + # working-directory: ${{env.build-directory}} + # env: + # CC: ${{matrix.compiler.cc}} + # CXX: ${{matrix.compiler.cxx}} + # run: | + # cmake .. \ + # -GNinja \ + # -DCMAKE_BUILD_TYPE=Debug \ + # -DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}}" \ + # -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On \ + # -DALLOY_COMPILE_TESTS=On \ + # -DALLOY_COMPILE_EXTRAS=On \ + # -DALLOY_COMPILE_EXAMPLES=On \ + # -DALLOY_ENABLE_EXCEPTIONS=On + # + # - name: Build + # working-directory: ${{env.build-directory}} + # run: cmake --build . + # + # - name: Test (Sanitize) + # working-directory: ${{env.build-directory}} + # run: ctest --output-on-failure diff --git a/.github/workflows/build-windows.yaml b/.github/workflows/build-windows.yaml index ad0ca3a5..2f734c57 100644 --- a/.github/workflows/build-windows.yaml +++ b/.github/workflows/build-windows.yaml @@ -3,36 +3,40 @@ name: build-windows on: [push, pull_request] jobs: - ci: - name: Windows ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }} - runs-on: ${{ matrix.os }} - + test: + name: Windows ${{matrix.compiler.name}} ${{matrix.arch}} ${{matrix.build_type}} + runs-on: windows-latest env: - CMAKE_GENERATOR: Ninja - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 + build-directory: build strategy: fail-fast: false matrix: - os: [windows-latest] - compiler: [cl, clang-cl, clang] arch: [x86, x86_64] build_type: [Debug, Release] - + compiler: + # TODO(#8): Fix GCC build + # - { name: "gcc", cc: gcc, cxx: g++ } + - { name: "clang", cc: clang, cxx: clang++ } + - { name: "clang-cl", cc: clang-cl, cxx: clang-cl } + - { name: "cl", cc: cl, cxx: cl } + + # Visual Studios specifies strange terminology for x86/x86_64 include: - - compiler: cl - version: 16 - - - compiler: clang-cl - version: 10 + - arch: x86 + vs_arch: Win32 + - arch: x86_64 + vs_arch: x64 - - compiler: clang - version: 10 + # GCC fails to compile 32-bit correctly with Github's Windows runner + # configuration. + exclude: + - arch: x86 + compiler: { name: "gcc", cc: gcc, cxx: g++ } steps: - - name: Checkout + - name: Clone uses: actions/checkout@v2 - name: Set up Python @@ -40,80 +44,97 @@ jobs: with: python-version: 3.7 - - name: Install - shell: powershell + - name: Prepare Environment run: | - Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') - scoop install ninja --global - if ("${{ matrix.compiler }}".StartsWith("clang")) { - scoop install llvm --global - } - if ("${{ matrix.compiler }}" -eq "clang") { - echo "::set-env name=CC::clang" - echo "::set-env name=CXX::clang++" - } else { - echo "::set-env name=CC::${{ matrix.compiler }}" - echo "::set-env name=CXX::${{ matrix.compiler }}" - } - # Scoop modifies the PATH so we make the modified PATH global. - echo "::set-env name=PATH::$env:PATH" - & python -m pip install --upgrade pip - & pip install conan - & conan --version + curl -fsSL -o LLVM10.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe ; 7z x LLVM10.exe -y -o"C:/Program Files/LLVM" - - name: Prepare Architecture - shell: powershell - run: | - if ("${{ matrix.arch }}" -eq "x86_64") { - & .github\workflows\vsenv.bat -arch=x64 -host_arch=x64 - } else { - & .github\workflows\vsenv.bat -arch=x86 -host_arch=x64 - if ("${{ matrix.compiler }}" -notcontains "cl") { - echo "::set-env name=CXXFLAGS::$env:CXXFLAGS -m32" - } - } + python -m pip install --upgrade pip + pip install conan + conan --version + cmake -E make_directory ${{env.build-directory}} - name: Create Conan Profile (MSVC) - if: matrix.compiler == 'cl' + if: matrix.compiler.name == 'cl' run: | conan profile new default conan profile update settings.compiler="Visual Studio" default - conan profile update settings.compiler.version=${{ matrix.version }} default - if ("${{ matrix.build_type }}" -eq "Release") { + if ("${{matrix.build_type}}" -eq "Release") { conan profile update settings.compiler.runtime=MD default } else { conan profile update settings.compiler.runtime=MDd default } - conan profile update settings.arch=${{ matrix.arch }} default conan profile update settings.os=Windows default - name: Create Conan Profile (other) - if: matrix.compiler != 'cl' - run: | - conan profile new --detect default - conan profile update settings.arch=${{ matrix.arch }} default + if: matrix.compiler.name != 'cl' + env: + CC: ${{matrix.compiler.cc}} + CXX: ${{matrix.compiler.cxx}} + run: conan profile new --detect default + + - name: Install Conan Dependencies + working-directory: ${{env.build-directory}} + run: conan install .. -s build_type=${{matrix.build_type}} - - name: Configure + - name: Prepare Architecture + if: (matrix.compiler.name == 'clang' || matrix.compiler.name == 'gcc') && matrix.arch == 'x86' + shell: bash + run: echo "CXXFLAGS=${CXXFLAGS} -m32" >> ${GITHUB_ENV} + + - name: Configure (gcc) + working-directory: ${{env.build-directory}} + if: matrix.compiler.name == 'gcc' + env: + CC: gcc + CXX: g++ + run: | + cmake .. -G"MinGW Makefiles" ` + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ` + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On ` + -DALLOY_COMPILE_TESTS=On ` + -DALLOY_COMPILE_EXTRAS=On ` + -DALLOY_COMPILE_EXAMPLES=On ` + -DALLOY_ENABLE_EXCEPTIONS=On + + - name: Configure (clang) + working-directory: ${{env.build-directory}} + if: matrix.compiler.name == 'clang' run: | - cmake -E remove_directory build - mkdir build - cd build - conan install .. -s build_type=${{ matrix.build_type }} - - cmake .. ` - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` - -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On ` - -DALLOY_COMPILE_TESTS=On ` - -DALLOY_COMPILE_EXTRAS=On ` - -DALLOY_COMPILE_EXAMPLES=On ` - -DALLOY_ENABLE_EXCEPTIONS=On + cmake .. -G"MinGW Makefiles" ` + -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" ` + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ` + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On ` + -DALLOY_COMPILE_TESTS=On ` + -DALLOY_COMPILE_EXTRAS=On ` + -DALLOY_COMPILE_EXAMPLES=On ` + -DALLOY_ENABLE_EXCEPTIONS=On + + - name: Configure (clang-cl) + working-directory: ${{env.build-directory}} + if: matrix.compiler.name == 'clang-cl' + run: | + cmake .. -G"Visual Studio 16 2019" -A ${{matrix.vs_arch}} -T ClangCL ` + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On ` + -DALLOY_COMPILE_TESTS=On ` + -DALLOY_COMPILE_EXTRAS=On ` + -DALLOY_COMPILE_EXAMPLES=On ` + -DALLOY_ENABLE_EXCEPTIONS=On + + - name: Configure (MSVC) + working-directory: ${{env.build-directory}} + if: matrix.compiler.name == 'cl' + run: | + cmake .. -G"Visual Studio 16 2019" -A ${{matrix.vs_arch}} ` + -DALLOY_COMPILE_SELF_CONTAINMENT_TESTS=On ` + -DALLOY_COMPILE_TESTS=On ` + -DALLOY_COMPILE_EXTRAS=On ` + -DALLOY_COMPILE_EXAMPLES=On ` + -DALLOY_ENABLE_EXCEPTIONS=On - name: Build - run: | - cd build - cmake --build . + working-directory: ${{env.build-directory}} + run: cmake --build . --config ${{matrix.build_type}} - name: Test - run: | - cd build - ctest --output-on-failure + working-directory: ${{env.build-directory}} + run: ctest --output-on-failure From 5b58fd8b3f1fa4a6ec17f530155eac4424860589 Mon Sep 17 00:00:00 2001 From: Matthew Rodusek Date: Wed, 30 Dec 2020 23:56:31 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A7=20Add=20Catch=20as=20submodule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Working with `conan` to handle all dependencies has become a hassle for the CI workflow. `conan` requires knowing a lot of information about the current architecture, even if the dependency is header-only -- which is completely unnecessary. As useful as `conan` is, it overcomplicates the system and adds an external dependency to the codebase. Since this is (currently) only used for the `catch` dependency, its easier to simply add this as either a subtree or submodule instead. The latter approach has been chosen here so that it may simply be cloned with a basic `git clone --recursive` command. Subtree could also have been a viable alternative, however for the purposes being used here would likely have been overkill, and would be checking in a rather large chunk of code for the sole purpose of being used as a dependency. --- .gitmodules | 3 +++ third_party/catch | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 third_party/catch diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..8f882f2e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Catch2"] + path = third_party/catch + url = git@github.com:catchorg/Catch2.git diff --git a/third_party/catch b/third_party/catch new file mode 160000 index 00000000..de6fe184 --- /dev/null +++ b/third_party/catch @@ -0,0 +1 @@ +Subproject commit de6fe184a9ac1a06895cdd1c9b437f0a0bdf14ad From 8000e030030048e637759abb0f43be1b90c3fa29 Mon Sep 17 00:00:00 2001 From: Matthew Rodusek Date: Thu, 31 Dec 2020 00:24:42 -0500 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=A8=20Remove=20conan=20from=20buil?= =?UTF-8?q?d=20scripts=20and=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit added `Catch2` as a proper submodule dependency in the system, which removes the need for this project to be relying on `conan` dependencies. This updates the CMakeLists and the Github workflows so that they no longer rely on `conan` as a dependency. --- .github/workflows/build-macos.yaml | 22 +++-------------- .github/workflows/build-ubuntu.yaml | 16 +++--------- .github/workflows/build-windows.yaml | 37 +++------------------------- CMakeLists.txt | 15 ++++++----- lib/alloy-core/test/CMakeLists.txt | 2 -- lib/alloy-io/test/CMakeLists.txt | 2 -- third_party/CMakeLists.txt | 4 +++ 7 files changed, 23 insertions(+), 75 deletions(-) create mode 100644 third_party/CMakeLists.txt diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 42bf9580..4302d4b9 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -13,19 +13,16 @@ jobs: strategy: fail-fast: false matrix: - arch: [x86_64] - build_type: [Debug, Release] compiler: - { name: "xcode", version: "12.3" } + arch: [x86_64] + build_type: [Debug, Release] steps: - name: Clone uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v1 with: - python-version: 3.7 + submodules: true - name: Prepare Environment run: | @@ -33,10 +30,7 @@ jobs: sudo xcode-select -switch /Applications/Xcode_${{matrix.compiler.version}}.app brew install ninja - python -m pip install --upgrade pip - pip install conan cmake -E make_directory ${{env.build-directory}} - cmake -E chdir ${{env.build-directory}} conan install .. -s build_type=${{matrix.build_type}} - name: Configure working-directory: ${{env.build-directory}} @@ -44,7 +38,6 @@ jobs: CC: clang CXX: clang++ run: | - conan profile new --detect default cmake .. \ -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ @@ -77,19 +70,13 @@ jobs: steps: - name: Clone uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v1 with: - python-version: 3.7 + submodules: true - name: Prepare Environment run: | - python -m pip install --upgrade pip - pip install conan brew install ninja cmake -E make_directory ${{env.build-directory}} - cmake -E chdir ${{env.build-directory}} conan install .. - name: Configure working-directory: ${{env.build-directory}} @@ -97,7 +84,6 @@ jobs: CC: clang CXX: clang++ run: | - conan profile new --detect default cmake .. \ -GNinja \ -DCMAKE_BUILD_TYPE=Debug \ diff --git a/.github/workflows/build-ubuntu.yaml b/.github/workflows/build-ubuntu.yaml index c94fb7a7..3619eae1 100644 --- a/.github/workflows/build-ubuntu.yaml +++ b/.github/workflows/build-ubuntu.yaml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: test: - name: Ubuntu ${{ matrix.compiler }} ${{ matrix.arch }} ${{ matrix.build_type }} + name: Ubuntu ${{matrix.compiler.cc}} ${{matrix.arch}} ${{matrix.build_type}} runs-on: ubuntu-20.04 env: @@ -13,21 +13,18 @@ jobs: strategy: fail-fast: false matrix: - arch: [x86, x86_64] - build_type: [Debug, Release] compiler: - { cc: gcc-10, cxx: g++-10 } - { cc: clang-10, cxx: clang++-10 } + arch: [x86, x86_64] + build_type: [Debug, Release] steps: - name: Clone uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v1 with: - python-version: 3.7 + submodules: true - name: Prepare Environment run: | @@ -41,9 +38,6 @@ jobs: else sudo apt-get install -y ${{matrix.compiler.cc}} g++-multilib fi - python -m pip install --upgrade pip - pip install conan - conan --version cmake -E make_directory ${{env.build-directory}} - name: Prepare Architecture @@ -58,8 +52,6 @@ jobs: CC: ${{matrix.compiler.cc}} CXX: ${{matrix.compiler.cxx}} run: | - conan profile new --detect default - conan profile update settings.arch=${{matrix.arch}} default cmake .. \ -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ diff --git a/.github/workflows/build-windows.yaml b/.github/workflows/build-windows.yaml index 2f734c57..9af9cca6 100644 --- a/.github/workflows/build-windows.yaml +++ b/.github/workflows/build-windows.yaml @@ -12,14 +12,14 @@ jobs: strategy: fail-fast: false matrix: - arch: [x86, x86_64] - build_type: [Debug, Release] compiler: # TODO(#8): Fix GCC build # - { name: "gcc", cc: gcc, cxx: g++ } - { name: "clang", cc: clang, cxx: clang++ } - { name: "clang-cl", cc: clang-cl, cxx: clang-cl } - { name: "cl", cc: cl, cxx: cl } + arch: [x86, x86_64] + build_type: [Debug, Release] # Visual Studios specifies strange terminology for x86/x86_64 include: @@ -38,46 +38,17 @@ jobs: - name: Clone uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v1 with: - python-version: 3.7 + submodules: true - name: Prepare Environment run: | curl -fsSL -o LLVM10.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe ; 7z x LLVM10.exe -y -o"C:/Program Files/LLVM" - python -m pip install --upgrade pip - pip install conan - conan --version cmake -E make_directory ${{env.build-directory}} - - name: Create Conan Profile (MSVC) - if: matrix.compiler.name == 'cl' - run: | - conan profile new default - conan profile update settings.compiler="Visual Studio" default - if ("${{matrix.build_type}}" -eq "Release") { - conan profile update settings.compiler.runtime=MD default - } else { - conan profile update settings.compiler.runtime=MDd default - } - conan profile update settings.os=Windows default - - - name: Create Conan Profile (other) - if: matrix.compiler.name != 'cl' - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: conan profile new --detect default - - - name: Install Conan Dependencies - working-directory: ${{env.build-directory}} - run: conan install .. -s build_type=${{matrix.build_type}} - - name: Prepare Architecture - if: (matrix.compiler.name == 'clang' || matrix.compiler.name == 'gcc') && matrix.arch == 'x86' + if: matrix.compiler.name == 'clang' && matrix.arch == 'x86' shell: bash run: echo "CXXFLAGS=${CXXFLAGS} -m32" >> ${GITHUB_ENV} diff --git a/CMakeLists.txt b/CMakeLists.txt index f57441df..7df6487c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,9 @@ if (PROJECT_NAME) endif () set(ALLOY_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") -set(CMAKE_MODULE_PATH "${ALLOY_MODULE_PATH}" "${CMAKE_MODULE_PATH}") +set(CATCH_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/third_party/catch/contrib") + +set(CMAKE_MODULE_PATH "${ALLOY_MODULE_PATH}" "${CMAKE_MODULE_PATH}" "${CATCH_MODULE_PATH}") ############################################################################## # Project Options @@ -92,13 +94,6 @@ set(ALLOY_VERSION_MINOR ${PROJECT_VERSION_MINOR} CACHE INTERNAL "Minor version o set(ALLOY_VERSION_PATCH ${PROJECT_VERSION_PATCH} CACHE INTERNAL "Patch version of the Alloy game engine") set(ALLOY_VERSION ${PROJECT_VERSION} CACHE INTERNAL "Version of Alloy game engine") -# If using conan, only set the find paths. This project is trying to be -# fully CMake -if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake") - include("${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake") - conan_set_find_paths() -endif () - #----------------------------------------------------------------------------- # default to debug when building CMake @@ -173,6 +168,10 @@ endif () # Targets ############################################################################## +# Dependencies + +add_subdirectory("third_party") + # Library Targets add_subdirectory("lib/alloy-core") diff --git a/lib/alloy-core/test/CMakeLists.txt b/lib/alloy-core/test/CMakeLists.txt index 1fa7731e..5929bc36 100644 --- a/lib/alloy-core/test/CMakeLists.txt +++ b/lib/alloy-core/test/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(Catch2 REQUIRED) - ############################################################################## # Target ############################################################################## diff --git a/lib/alloy-io/test/CMakeLists.txt b/lib/alloy-io/test/CMakeLists.txt index ffda2120..051c738a 100644 --- a/lib/alloy-io/test/CMakeLists.txt +++ b/lib/alloy-io/test/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(Catch2) - ############################################################################## # Target ############################################################################## diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 00000000..9c228457 --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1,4 @@ +# If we are compiling unit tests, then we need catch +if (ALLOY_COMPILE_TESTS) + add_subdirectory("catch") +endif () From 075f5e4d5c3e8a7631e6464357acb2a875074c53 Mon Sep 17 00:00:00 2001 From: Matthew Rodusek Date: Thu, 31 Dec 2020 00:43:57 -0500 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20default=20`expected`?= =?UTF-8?q?=20constructors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `= default`ing constructors, it can be detrimental to specify the `noexcept`-ness and `constexpr`-ness of the constructor since it may either be misleading, or worse, implicitly deleted if the `noexcept`ness cannot be satisfied. GCC has determined that `expected() noexcept = default` is resulting in an implicitly deleted default-constructor due to the constructor not actually being `noexcept`. The exact reason for this failure is not known, but realistically, the non-throwing nature of the constructor should *not* be cause for this type of issue. As a result, all `expected` constructors have removed `constexpr` or implicitly expected `noexcept`-ness to instead simply be determined by the compiler with `= default`. --- .../include/alloy/core/utilities/expected.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/alloy-core/include/alloy/core/utilities/expected.hpp b/lib/alloy-core/include/alloy/core/utilities/expected.hpp index 7180f474..d03c6da6 100644 --- a/lib/alloy-core/include/alloy/core/utilities/expected.hpp +++ b/lib/alloy-core/include/alloy/core/utilities/expected.hpp @@ -294,7 +294,7 @@ namespace alloy::core { /// \brief Constructs the underlying value by default-construction by /// calling T's constructor - constexpr expected() = default; + expected() = default; /// \brief Constructs the underlying value of this expected by calling /// T's constructor with the given args @@ -334,12 +334,12 @@ namespace alloy::core { /// \brief Constructs this expected by moving the contents of \p other /// /// \param other the other expected to move - constexpr expected(expected&& other) = default; + expected(expected&& other) = default; /// \brief Constructs this expected by copying the contents of \p other /// /// \param other the other expected to copy - constexpr expected(const expected& other) = default; + expected(const expected& other) = default; //-------------------------------------------------------------------------- @@ -516,7 +516,7 @@ namespace alloy::core { public: /// \brief Constructs this expected successfully - constexpr expected() noexcept = default; + expected() = default; /// \brief Constructs the underlying error of this expected /// @@ -528,12 +528,12 @@ namespace alloy::core { /// \brief Constructs this expected by moving the contents of \p other /// /// \param other the other expected to move - constexpr expected(expected&& other) = default; + expected(expected&& other) = default; /// \brief Constructs this expected by copying the contents of \p other /// /// \param other the other expected to copy - constexpr expected(const expected& other) = default; + expected(const expected& other) = default; //--------------------------------------------------------------------------