diff --git a/.github/workflows/Windows-CI.yml b/.github/workflows/Windows-CI.yml index ae9dd2947f..f8e8e264a9 100644 --- a/.github/workflows/Windows-CI.yml +++ b/.github/workflows/Windows-CI.yml @@ -16,59 +16,87 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: windows-2019 + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + include: + - os: windows-2019 + cmake-generator: VS2019Win64 + enable-pie: 1 + build-type: Release + - os: windows-2022 + cmake-generator: VS2022Win64 + enable-pie: 1 + build-type: Debug env: buildDir: '${{ github.workspace }}/build/' - PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' + # Indicates the location of vcpkg + VCPKG_ROOT: '${{ github.workspace }}/v' + # Tells vcpkg where binary packages are stored. + VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache' + ## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. + #VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' + VCPKG_DEFAULT_TRIPLET: x64-windows + VCPKG_DEFAULT_HOST_TRIPLET: x64-windows + #PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3' # Steps represent a sequence of tasks that will be executed as part of the job steps: + # Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage + # for Binary Caching. + - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Set up Python + uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1 + with: + python-version: '3.11.5' + check-latest: true + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: checkout - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - - name: install-cmake - uses: lukka/get-cmake@v3.21.2 + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE + shell: bash - - name: install-vcpkg - # You may pin to the exact commit or the version. - # uses: lukka/run-vcpkg@9c0ae56bad291f4b185cc433a9b56084b2962259 - uses: lukka/run-vcpkg@v7 + - name: install-cmake + uses: lukka/get-cmake@4865386b66955d11be0abf8c112d0230023e742a #v3.27.9 with: - vcpkgDirectory: '${{ github.workspace }}/v' - setupOnly: true - vcpkgGitCommitId: '49a30e9db17a8edf7c2809940ee2036746b1b982' - vcpkgTriplet: 'x64-windows' - appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }} - additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed + cmakeVersion: 3.27.9 + ninjaVersion: 1.11.1 - - name: run-cmake - # You may pin to the exact commit or the version. - # uses: lukka/run-cmake@7ba4481660f0f04c86cfa5f1f24b90effc97bde1 - uses: lukka/run-cmake@v3 - with: - # Path to CMakeLists.txt. Used for both CMakeListsTxtBasic and CMakeListsTxtAdvanced modes. - cmakeListsTxtPath: ${{ github.workspace }}/engine/CMakeLists.txt - # Indicates whether to use vcpkg's CMake toolchain file if RUNVCPKG_VCPKG_ROOT environment variable is defined, for example by a previous run-vcpkg action execution. If the variable is defined, its content would be passed with '-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake'. Used by any mode. - useVcpkgToolchainFile: true - # Specify the triplet used with vcpkg. Default value is RUNVCPKG_VCPKG_TRIPLET environment variable, which is set e.g. by the run-vcpkg. Possible values include any file name with no extension present in the vcpkgroot/trplet directory, e.g. x64-linux, x64-windows, x64-osx and so forth. Used by any mode. - vcpkgTriplet: x64-windows - # Select the build configuration, typically Debug or Release. Used by CMakeListsTxtBasic mode. - cmakeBuildType: Release - # Specify the CMake generator to use. Possible values: Ninja: Ninja, NinjaMulti: Ninja Multi-Config UnixMakefiles: Unix Makefiles, VS16Win64: Visual Studio 2019 x64, VS16Arm64: Visual Studio 2019 ARM64, VS16Arm: Visual Studio 2019 ARM, VS16Win32: Visual Studio 2019 Win32, VS15Win64: Visual Studio 2017 x64, VS15Arm64: Visual Studio 2017 ARM64, VS15Arm: Visual Studio 2017 ARM, VS15Win32: Visual Studio 2017 Win32. Used by CMakeListsTxtBasic mode. - cmakeGenerator: VS16Win64 - # Set the build directory, i.e. where CMake generates the build system files. Defaults to `$(Build.ArtifactStagingDirectory)` for CMakeLists.txt, and to `$(Build.ArtifactStagingDirectory)/` for CMakeSettings.json. Used by any mode. - buildDirectory: ${{ env.buildDir }} - # Provides a mean to provide all the CMake arguments. This is required when using CMakeLists.txt in Advanced mode. For CMakeSettings.json, the arguments are already inferred, but you can append your arguments providing them here. Used by CMakeListsTxtAdvanced and CMakeSettingsJson modes. - cmakeAppendedArgs: -DUSE_PYTHON_3=ON - # Indicates whether to run 'cmake --build' after CMake project files have been generated successfully. Used by any mode. - buildWithCMake: true - # Additional parameters for both CMake and the make program (e.g. ninja or make). Separate CMake arguments to the native make program arguments with '--', such as: '--clean-first --config Debug -- -j0'. Used by both CMakeListsTxtBasic and CMakeListsTxtAdvanced modes - buildWithCMakeArgs: "--config Release" + # # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching + # # when it is being run afterward by CMake. + # - name: restore-vcpkg + # uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1 + # with: + # # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. + # path: | + # ${{ env.VCPKG_ROOT }} + # !${{ env.VCPKG_ROOT }}/buildtrees + # !${{ env.VCPKG_ROOT }}/packages + # !${{ env.VCPKG_ROOT }}/downloads + # !${{ env.VCPKG_ROOT }}/installed + # # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used. + # key: | + # ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} - - name: copy-build-artifacts + - name: install-vcpkg + #if: steps.cache.outputs.cache-hit != 'true' run: | - mkdir bin - xcopy /y .\build\Release\*.* .\bin\ - xcopy /y .\build\objconv\Release\*.* .\bin\ + git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }} + ${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics + + - name: run-build-script + working-directory: ${{ github.workspace }} + run: .\script\build.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bac27dd057..56b5eb21df 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -20,21 +20,31 @@ jobs: language: ['cpp', 'python'] steps: - - name: Checkout repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - fetch-depth: 2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 - with: - languages: ${{ matrix.language }} - - - name: Bootstrap and Build the Code - run: | - sudo script/bootstrap - script/build.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@0225834cc549ee0ca93cb085b92954821a145866 #v2.3.5 + - name: Check out repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + fetch-depth: 2 + + - name: Download benchmark bundle + env: + GH_TOKEN: ${{ github.token }} + # download the latest version + run: | + gh release download -R github/codeql-action --pattern 'codeql-bundle.tar.gz' + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@4b6aa0b07da05d6e43d0e5f9c8596a6532ce1c85 #v2.15.3 + with: + languages: ${{ matrix.language }} + tools: codeql-bundle.tar.gz + + - name: Bootstrap and Build the Code + run: | + sudo script/bootstrap + script/build.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@4b6aa0b07da05d6e43d0e5f9c8596a6532ce1c85 #v2.15.3 + with: + tools: codeql-bundle.tar.gz diff --git a/.github/workflows/fortify-on-demand-scan.yml b/.github/workflows/fortify-on-demand-scan.yml index 325a6cf133..d9ff9bb24a 100644 --- a/.github/workflows/fortify-on-demand-scan.yml +++ b/.github/workflows/fortify-on-demand-scan.yml @@ -16,12 +16,11 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Fortify on Demand Scan # You may pin to the exact commit or the version. - # uses: fortify/gha-setup-fod-uploader@636f3c3a14aec1747eec5242a02c6349e4f3cce6 - uses: fortify/gha-setup-fod-uploader@v1.0.1 + uses: fortify/gha-setup-fod-uploader@16e5036c084b26cee63cb0c38cfc2101cc9fd13d #v1.1.3 with: # FoDUploader version to use version: latest diff --git a/.github/workflows/gh-actions-pr.yml b/.github/workflows/gh-actions-pr.yml index d0f9569af2..e773ed5a70 100644 --- a/.github/workflows/gh-actions-pr.yml +++ b/.github/workflows/gh-actions-pr.yml @@ -16,35 +16,35 @@ jobs: fail-fast: false matrix: include: - - FROM: 'ubuntu:jammy' + - FROM: 'ubuntu:mantic' COMPILER: 'gcc' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' allow_failure: false - - FROM: 'ubuntu:jammy' + - FROM: 'ubuntu:mantic' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' allow_failure: false - - FROM: 'ubuntu:jammy' + - FROM: 'ubuntu:mantic' COMPILER: 'gcc' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'ubuntu:jammy' + - FROM: 'ubuntu:mantic' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'ubuntu:focal' + - FROM: 'ubuntu:jammy' COMPILER: 'gcc' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' + OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'ubuntu:focal' + - FROM: 'ubuntu:jammy' COMPILER: 'clang' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' + OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - FROM: 'ubuntu:focal' COMPILER: 'gcc' @@ -56,111 +56,76 @@ jobs: USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'ubuntu:bionic' - COMPILER: 'gcc' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - - FROM: 'ubuntu:bionic' + - FROM: 'linuxmintd/mint21.1-amd64' COMPILER: 'clang' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - - FROM: 'ubuntu:bionic' - COMPILER: 'gcc' - USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'ubuntu:bionic' + - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'linuxmintd/mint20-amd64' - COMPILER: 'clang' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - FROM: 'linuxmintd/mint20-amd64' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'debian:bullseye' + - FROM: 'debian:bookworm' COMPILER: 'clang' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' + OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - FROM: 'debian:bullseye' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'debian:buster' - COMPILER: 'clang' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - FROM: 'debian:buster' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'opensuse/leap' + - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' allow_failure: false - - FROM: 'opensuse/leap' + - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'fedora:36' - COMPILER: 'clang' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - - FROM: 'fedora:36' + - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'fedora:35' + - FROM: 'fedora:38' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' allow_failure: false - - FROM: 'fedora:35' + - FROM: 'fedora:38' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'fedora:34' - COMPILER: 'clang' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: false - - FROM: 'fedora:34' + - FROM: 'fedora:37' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'rockylinux/rockylinux' + - FROM: 'rockylinux:9.1' COMPILER: 'clang' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' + OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'rockylinux/rockylinux' + - FROM: 'rockylinux/8.7' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' allow_failure: false - - FROM: 'manjarolinux/base' - COMPILER: 'clang' - USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' - allow_failure: true - FROM: 'manjarolinux/base' COMPILER: 'clang' USE_PYTHON_3: 'ON' @@ -168,29 +133,32 @@ jobs: allow_failure: true steps: - - name: Checkout repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - fetch-depth: 2 - submodules: false + #- name: Set up Python + # uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1 + # with: + # python-version: '3.11' + + - name: Check out repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + fetch-depth: 2 + submodules: false - # Ensure PRs are built against the PR Head - # As opposed to the merge commit - - name: Move to PR HEAD - run: git checkout ${{ github.event.pull_request.head.sha }} + - name: Move to PR HEAD + run: git checkout ${{ github.event.pull_request.head.sha }} - - name: Extract short SHA - shell: bash - run: | - echo "SHORT_SHA=`git rev-parse --short ${{ github.event.pull_request.head.sha }}`" >> $GITHUB_ENV - - name: Test short SHA - run: | - echo "${SHORT_SHA}" - - name: Run CI - env: - FROM: ${{ matrix.FROM }} - COMPILER: ${{ matrix.COMPILER }} - FLAGS: '-DUSE_PYTHON_3=${{ matrix.USE_PYTHON_3 }} -DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' - MY_OS_NAME: linux - IS_RELEASE: 0 - run: script/cibuild $FLAGS + - name: Extract short SHA + shell: bash + run: | + echo "SHORT_SHA=`git rev-parse --short ${{ github.event.pull_request.head.sha }}`" >> $GITHUB_ENV + - name: Test short SHA + run: | + echo "${SHORT_SHA}" + - name: Run CI + env: + FROM: ${{ matrix.FROM }} + COMPILER: ${{ matrix.COMPILER }} + FLAGS: '-DUSE_PYTHON_3=${{ matrix.USE_PYTHON_3 }} -DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' + MY_OS_NAME: linux + IS_RELEASE: 0 + run: script/cibuild $FLAGS diff --git a/.github/workflows/gh-actions-release.yml b/.github/workflows/gh-actions-release.yml index 4b68f6b2be..7c15d057ac 100644 --- a/.github/workflows/gh-actions-release.yml +++ b/.github/workflows/gh-actions-release.yml @@ -15,6 +15,16 @@ jobs: fail-fast: false matrix: include: + - FROM: 'ubuntu:mantic' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'LEGACY' + ARTIFACT_EXT: 'deb' + - FROM: 'ubuntu:mantic' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'GLVND' + ARTIFACT_EXT: 'deb' - FROM: 'ubuntu:jammy' COMPILER: 'clang' USE_PYTHON_3: 'ON' @@ -41,12 +51,12 @@ jobs: USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'tar.[xb]z*' - - FROM: 'ubuntu:bionic' + - FROM: 'linuxmintd/mint21.1-amd64' COMPILER: 'clang' USE_PYTHON_3: 'ON' - OpenGL_GL_PREFERENCE: 'LEGACY' + OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'deb' - - FROM: 'ubuntu:bionic' + - FROM: 'linuxmintd/mint21-amd64' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' @@ -61,6 +71,11 @@ jobs: USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'deb' + - FROM: 'debian:bookworm' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'GLVND' + ARTIFACT_EXT: 'deb' - FROM: 'debian:bullseye' COMPILER: 'clang' USE_PYTHON_3: 'ON' @@ -81,85 +96,110 @@ jobs: USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'deb' - - FROM: 'opensuse/leap' + - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'rpm' - - FROM: 'opensuse/leap' + - FROM: 'opensuse/leap:15.5' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:36' + - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:36' + - FROM: 'opensuse/leap:15.4' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:35' + - FROM: 'fedora:38' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:35' + - FROM: 'fedora:38' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:34' + - FROM: 'fedora:37' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'rpm' - - FROM: 'fedora:34' + - FROM: 'fedora:37' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'rpm' - - FROM: 'rockylinux/rockylinux' + - FROM: 'fedora:36' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'LEGACY' ARTIFACT_EXT: 'rpm' - - FROM: 'rockylinux/rockylinux' + - FROM: 'fedora:36' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'GLVND' + ARTIFACT_EXT: 'rpm' + - FROM: 'rockylinux:9.1' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'LEGACY' + ARTIFACT_EXT: 'rpm' + - FROM: 'rockylinux/9.1' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'GLVND' + ARTIFACT_EXT: 'rpm' + - FROM: 'rockylinux:8.7' + COMPILER: 'clang' + USE_PYTHON_3: 'ON' + OpenGL_GL_PREFERENCE: 'LEGACY' + ARTIFACT_EXT: 'rpm' + - FROM: 'rockylinux/8.7' COMPILER: 'clang' USE_PYTHON_3: 'ON' OpenGL_GL_PREFERENCE: 'GLVND' ARTIFACT_EXT: 'rpm' steps: - - name: Checkout repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - fetch-depth: 2 - submodules: false + #- name: Set up Python + # uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1 + # with: + # python-version: '3.11' + + - name: Check out repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + fetch-depth: 2 + submodules: false - - name: Extract tag name and short SHA - shell: bash - run: | - echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV - echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV - - name: Test tag name and short SHA - run: | - echo "${TAG_NAME}" - echo "${SHORT_SHA}" - - name: Run CI - env: - FROM: ${{ matrix.FROM }} - COMPILER: ${{ matrix.COMPILER }} - FLAGS: '-DUSE_PYTHON_3=${{ matrix.USE_PYTHON_3 }} -DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' - MY_OS_NAME: linux - IS_RELEASE: 1 - run: script/cibuild $FLAGS - - name: Upload the artifacts - uses: skx/github-action-publish-binaries@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} - with: - args: "packages/*.${{ matrix.ARTIFACT_EXT }}" + - name: Extract tag name and short SHA + shell: bash + run: | + echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV + echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV + - name: Test tag name and short SHA + run: | + echo "${TAG_NAME}" + echo "${SHORT_SHA}" + - name: Run CI + env: + FROM: ${{ matrix.FROM }} + COMPILER: ${{ matrix.COMPILER }} + FLAGS: '-DUSE_PYTHON_3=${{ matrix.USE_PYTHON_3 }} -DOpenGL_GL_PREFERENCE=${{ matrix.OpenGL_GL_PREFERENCE }}' + MY_OS_NAME: linux + IS_RELEASE: 1 + run: script/cibuild $FLAGS + - name: Upload the artifacts + uses: skx/github-action-publish-binaries@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ARTIFACT_EXT: ${{ matrix.ARTIFACT_EXT }} + with: + args: "packages/*.${{ matrix.ARTIFACT_EXT }}" diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml index aa6cd19410..9aa4f7a627 100644 --- a/.github/workflows/macos-ci.yml +++ b/.github/workflows/macos-ci.yml @@ -11,7 +11,6 @@ jobs: build: name: Build runs-on: ${{ matrix.os }} - continue-on-error: true defaults: run: @@ -21,19 +20,27 @@ jobs: fail-fast: false matrix: os: - - macos-11 - macos-12 - compiler: - - clang - - gcc + python-version: + - 3.12 homebrew-gl: - true - # - false homebrew-al: - true - false + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_UPGRADE: 1 + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + PYTHON_VERSION_STRING: "python@${{ matrix.python-version }}" + steps: + - name: Check out repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + fetch-depth: 2 + submodules: false # The following dependencies are already present within macos-* images: # - clang (llvm) @@ -45,42 +52,50 @@ jobs: # - libpng # - libvorbis # - python + # + # Note, though, that the Python version "varies between runners and can be changed unexpectedly", + # according to https://github.com/actions/setup-python#basic-usage . + # Hence the need to specify a particular Python version. + #- name: Set up Python + # uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1 + # with: + # python-version: ${{ matrix.python-version }} + # check-latest: true + - name: Install dependencies using homebrew - run: brew install boost-python3 gtk+3 gtkglext sdl + run: | + brew update + . ./script/brew-install-for-cmake.sh openssl@3 0 + . ./script/brew-install-for-cmake.sh $PYTHON_VERSION_STRING 0 + . ./script/brew-install-for-cmake.sh boost 0 + . ./script/brew-install-for-cmake.sh boost-python3 0 + . ./script/brew-install-for-cmake.sh gtk+3 1 + . ./script/brew-install-for-cmake.sh gtkglext 1 + . ./script/brew-install-for-cmake.sh sdl12-compat 1 # The following Apple-provided libraries are deprecated: - # * OpenGL as of MacOS 10.14 - # * GLUT as of MacOS 10.9 + # * OpenGL as of macOS 10.14 + # * GLUT as of macOS 10.9 - name: Optionally install homebrewed OpenGL and GLUT if: ${{ matrix.homebrew-gl }} run: | - brew install mesa mesa-glu freeglut + . ./script/brew-install-for-cmake.sh mesa 1 + . ./script/brew-install-for-cmake.sh mesa-glu 1 + . ./script/brew-install-for-cmake.sh freeglut 1 ln -s /usr/local/include/GL /usr/local/include/OpenGL ln -s /usr/local/include/GL /usr/local/include/GLUT - # ln -s /usr/local/lib/libGL.dylib /usr/local/lib/libOpenGL.dylib - # find /usr/local/lib/ -iname '*gl*.dylib' - # The Apple-provided OpenAL is deprecated as of MacOS 10.15 + # The Apple-provided OpenAL is deprecated as of macOS 10.15 - name: Optionally install homebrewed OpenAL if: ${{ matrix.homebrew-al }} - run: brew install openal-soft - - - name: Check out repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - fetch-depth: 2 - submodules: false - - - name: Conditionally relocate to PR HEAD - if: github.event.pull_request - run: git checkout HEAD^2 + run: | + . ./script/brew-install-for-cmake.sh openal-soft 1 + export OPENALDIR=$(brew --prefix openal-soft) - name: Build it env: MY_OS_NAME: macos - COMPILER: ${{ matrix.compiler }} - FLAGS: -DCMAKE_FIND_FRAMEWORK=LAST - OPENALDIR: "/usr/local/opt/openal-soft" + FLAGS: '-DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=LAST' run: script/cibuild $FLAGS # - name: Test diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 33bf2a530e..70956bc519 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (C) 2001-2002 Daniel Horn -# Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -23,6 +22,9 @@ # along with Vega Strike. If not, see . # + +CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) + INCLUDE(GNUInstallDirs) # There is no good method for this. The preferred method of using the `TYPE` argument doesn't exist until CMake 3.14 # and there is no CMake Policy to detect the change or force only the older style. `TYPE` is preferred because the diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index a98321cf72..9472670d3d 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (C) 2001-2002 Daniel Horn -# Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -23,6 +22,9 @@ # along with Vega Strike. If not, see . # + +CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) + IF (UNIX) # There is no good method for this. The preferred method of using the `TYPE` argument doesn't exist until CMake 3.14 diff --git a/doc/man/vegastrike-engine.1 b/doc/man/vegastrike-engine.1 index 8e35555bc3..8a301a943c 100644 --- a/doc/man/vegastrike-engine.1 +++ b/doc/man/vegastrike-engine.1 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH VEGASTRIKE 1 "Current" "Version 0.8.0" "Vega Strike 0.8.0" +.TH VEGASTRIKE 1 "Current" "Version 0.8.2" "Vega Strike 0.8.2" .SH NAME Vega Strike: Upon The Coldest Sea - Trade, Fight, and Explore the Universe .SH SYNOPSIS diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 27138b459b..18acdaa501 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -9,7 +9,7 @@ # to change build target (in Release, RelWithDebInfo, Debug, Profiler) # > cmake -DCMAKE_BUILD_TYPE=Debug #==================================== -# Copyright (C) 2008-2022 safemode, Anth0rx, pyramid, Roy Falk, +# Copyright (C) 2008-2023 safemode, Anth0rx, pyramid, Roy Falk, # Nachum Barcohen, Rune Morling, Stephen G. Tuggy, Benjamen Meyer, s0600204, # Evert Vorster, and other Vega Strike contributors. # @@ -35,7 +35,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) SET(VEGASTRIKE_VERSION_MAJOR "0") SET(VEGASTRIKE_VERSION_MINOR "8") -SET(VEGASTRIKE_VERSION_PATCH "1") +SET(VEGASTRIKE_VERSION_PATCH "2") IF (DEFINED ENV{SHORT_SHA} AND NOT "$ENV{SHORT_SHA}" STREQUAL "") SET(VEGASTRIKE_VERSION_TWEAK "$ENV{SHORT_SHA}") @@ -107,6 +107,11 @@ IF (POLICY CMP0075) CMAKE_POLICY (SET CMP0075 NEW) ENDIF () +# Concerning link time flags for turning on or off Position Independent Executables (PIE) +IF (POLICY CMP0083) + CMAKE_POLICY (SET CMP0083 NEW) +ENDIF () + # MSVC runtime library flags are selected by an abstraction. Supported by CMake 3.15 and up IF (POLICY CMP0091) CMAKE_POLICY (SET CMP0091 NEW) @@ -120,8 +125,8 @@ PROJECT(Vega_Strike ) # One version header generator to rule them all -CONFIGURE_FILE(src/version.h.in ${CMAKE_SOURCE_DIR}/src/version.h) -CONFIGURE_FILE(src/version.h.in ${CMAKE_SOURCE_DIR}/setup/src/include/version.h) +CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/src/version.h) +CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/setup/src/include/version.h) MESSAGE("== Vega Strike Version: ${VEGASTRIKE_VERSION_LONG_STR}") @@ -133,9 +138,7 @@ SET(CMAKE_C_STANDARD_REQUIRED TRUE) SET(CMAKE_C_EXTENSIONS ON) -UNSET(PYTHONLIBS_FOUND) UNSET(Boost_FOUND) -UNSET(Boost_python_FOUND) UNSET(Boost_python3_FOUND) UNSET(OPENGL_FOUND) UNSET(OPENGL_GLU_FOUND) @@ -152,20 +155,30 @@ UNSET(FFMPEG_FOUND) UNSET(OGRE_FOUND) UNSET(Boost_DIR) -IF (MSVC) +SET(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) +INCLUDE(InstallRequiredSystemLibraries) + +IF (UNIX) INCLUDE_DIRECTORIES( - ${Vega_Strike_SOURCE_DIR}/src - ${Vega_Strike_SOURCE_DIR}/src/cmd - ${Vega_Strike_BINARY_DIR} + ${Vega_Strike_SOURCE_DIR}/src + ${Vega_Strike_SOURCE_DIR}/src/cmd + ${Vega_Strike_SOURCE_DIR}/src/damage + ${Vega_Strike_SOURCE_DIR}/src/resource + ${Vega_Strike_BINARY_DIR} + ${Vega_Strike_BINARY_DIR}/src + /usr/include/harfbuzz/ ) -ELSE (MSVC) +ELSE () INCLUDE_DIRECTORIES( - ${Vega_Strike_SOURCE_DIR}/src - ${Vega_Strike_SOURCE_DIR}/src/cmd - ${Vega_Strike_BINARY_DIR} - /usr/include/harfbuzz/ + ${Vega_Strike_SOURCE_DIR}/src + ${Vega_Strike_SOURCE_DIR}/src/cmd + ${Vega_Strike_SOURCE_DIR}/src/damage + ${Vega_Strike_SOURCE_DIR}/src/resource + ${Vega_Strike_BINARY_DIR} + ${Vega_Strike_BINARY_DIR}/src ) -ENDIF (MSVC) +ENDIF () # The source files used to be listed here... @@ -219,8 +232,10 @@ OPTION(DISABLE_CLIENT "Disable building the vegastrike bin" OFF ) # OPTION(VEGA_STRIKE_PREFER_LEGACY_OPENGL "Prefer legacy OpenGL implementation (such as Mesa's)? Or prefer GLVND?" OFF ) IF (OpenGL_GL_PREFERENCE STREQUAL "LEGACY") SET (VEGA_STRIKE_GLU_DEPENDENCY "libglu1-mesa") -ELSE () +ELSEIF (OpenGL_GL_PREFERENCE STREQUAL "GLVND") SET (VEGA_STRIKE_GLU_DEPENDENCY "libglvnd0") +ELSE () + UNSET (VEGA_STRIKE_GLU_DEPENDENCY) ENDIF () MESSAGE("** OpenGL_GL_PREFERENCE: ${OpenGL_GL_PREFERENCE}") @@ -291,23 +306,39 @@ ENDIF (DATADIR) # #UNSET(CMAKE_POSITION_INDEPENDENT_CODE) OPTION(ENABLE_PIE "Enable Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint)" OFF) -IF (ENABLE_PIE) - MESSAGE("!! Enabling Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint) !!") - #SET(CMAKE_POSITION_INDEPENDENT_CODE ON) - ADD_COMPILE_OPTIONS("-fpie") - LINK_LIBRARIES("-pie") -ELSE (ENABLE_PIE) - MESSAGE("++ Disabling Position Independent Executables/Shared Libraries (Recommended on Ubuntu/Mint)") - IF (NOT MSVC) - ADD_COMPILE_OPTIONS("-fno-pie") - LINK_LIBRARIES("-no-pie") - ENDIF (NOT MSVC) -ENDIF (ENABLE_PIE) +IF (CMAKE_VERSION VERSION_LESS "3.14") + MESSAGE(STATUS "CMake version older than 3.14; falling back to old PIE logic") + IF (ENABLE_PIE) + MESSAGE("!! Enabling Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint) !!") + IF (NOT MSVC) + ADD_COMPILE_OPTIONS("-fpie") + LINK_LIBRARIES("-pie") + ENDIF () + ELSE (ENABLE_PIE) + MESSAGE("++ Disabling Position Independent Executables/Shared Libraries (Recommended on Ubuntu/Mint)") + IF (NOT MSVC) + ADD_COMPILE_OPTIONS("-fno-pie") + LINK_LIBRARIES("-no-pie") + ENDIF (NOT MSVC) + ENDIF (ENABLE_PIE) +ELSE () + MESSAGE(STATUS "CMake version 3.14 or later; using preferred PIE logic") + include(CheckPIESupported) + check_pie_supported() + UNSET(CMAKE_POSITION_INDEPENDENT_CODE) + IF (ENABLE_PIE) + MESSAGE("!! Enabling Position Independent Executables/Shared Libraries (NOT RECOMMENDED on Ubuntu/Mint) !!") + SET(CMAKE_POSITION_INDEPENDENT_CODE ON) + ELSE (ENABLE_PIE) + MESSAGE("++ Disabling Position Independent Executables/Shared Libraries (Recommended on Ubuntu/Mint)") + SET(CMAKE_POSITION_INDEPENDENT_CODE OFF) + ENDIF (ENABLE_PIE) +ENDIF () IF (MSVC) SET(COMPILER_SPECIFIC_CFLAGS " ") SET(COMPILER_SPECIFIC_FLAGS "/FI\"${Vega_Strike_BINARY_DIR}\"/config.h -D__x86_64__ ") - SET(COMPILER_SPECIFIC_DEBUG_FLAGS "/Z7 ") # also used for release-with-debug -- can change later + SET(COMPILER_SPECIFIC_DEBUG_FLAGS "/Z7 -DBOOST_DEBUG_PYTHON ") # also used for release-with-debug -- can change later SET(COMPILER_SPECIFIC_PROFILER_FLAGS "/Z7 /GL ") # not tested -- requires additional linker flag specialization for profiling run ( /FASTGENPROFILE) and profile use ( /USEPROFILE) SET(COMPILER_SPECIFIC_RELEASE_FLAGS " ") SET(TOOLCHAIN_SPECIFIC_LINK_FLAGS "/DEBUG:FULL ") @@ -435,27 +466,31 @@ FIND_PACKAGE(LinuxDistro REQUIRED) OPTION(USE_PYTHON_3 "Use Python 3 or Python 2.7 (default is 3)" ON) IF (USE_PYTHON_3) # We want at least Python 3.4, but we prefer newer versions - SET(Python_ADDITIONAL_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4) + FIND_PACKAGE(Python3 REQUIRED COMPONENTS Development Interpreter) ELSE (USE_PYTHON_3) MESSAGE("++ Adding python 2.7 variant") - SET(Python_ADDITIONAL_VERSIONS 2.7) + FIND_PACKAGE(Python2 REQUIRED COMPONENTS Development Interpreter) ENDIF (USE_PYTHON_3) -# If we don't unset cache variables -# ccmake won't pick up changes to the USE_PYTHON_3 option -UNSET(PYTHON_INCLUDE_DIR CACHE) -UNSET(PYTHON_LIBRARY CACHE) -# The python version we want is set via Python_ADDITIONAL_VERSIONS -MESSAGE("++ Python release(s) searched for : ${Python_ADDITIONAL_VERSIONS}") -FIND_PACKAGE(PythonLibs REQUIRED) -MESSAGE("++ Python library : ${PYTHON_LIBRARY} (${PYTHONLIBS_VERSION_STRING})") -MESSAGE("++ Python include dir : ${PYTHON_INCLUDE_DIR}") -IF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) - SET(TST_INCLUDES ${PYTHON_INCLUDE_DIRS}) - SET(TST_LIBS ${PYTHON_LIBRARIES}) +## If we don't unset cache variables +## ccmake won't pick up changes to the USE_PYTHON_3 option +#UNSET(PYTHON_INCLUDE_DIR CACHE) +#UNSET(PYTHON_LIBRARY CACHE) +## The python version we want is set via Python_ADDITIONAL_VERSIONS +#MESSAGE("++ Python release(s) searched for : ${Python_ADDITIONAL_VERSIONS}") +#FIND_PACKAGE(PythonLibs REQUIRED) +#MESSAGE("++ Python library : ${PYTHON_LIBRARY} (${PYTHONLIBS_VERSION_STRING})") +#MESSAGE("++ Python include dir : ${PYTHON_INCLUDE_DIR}") +IF (Python3_FOUND) + SET(TST_INCLUDES ${Python3_INCLUDE_DIRS}) + SET(TST_LIBS ${Python3_LIBRARIES}) + SET(HAVE_PYTHON 1) +ELSEIF (Python2_FOUND) + SET(TST_INCLUDES ${Python2_INCLUDE_DIRS}) + SET(TST_LIBS ${Python2_LIBRARIES}) SET(HAVE_PYTHON 1) -ELSE (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) +ELSE () MESSAGE(FATAL_ERROR "Can't find python") -ENDIF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) +ENDIF () # Find Boost with boost_python library OPTION(USE_SYSTEM_BOOST "Use system boost" ON) @@ -479,11 +514,17 @@ IF (USE_SYSTEM_BOOST) ELSE (Boost_DERIVED_VERSION VERSION_EQUAL 1.67.0) SET(Boost_1_67_Or_Later_Result FALSE) ENDIF (Boost_DERIVED_VERSION VERSION_EQUAL 1.67.0) - STRING(REPLACE "." ";" PYTHONLIBS_VERSION_LIST ${PYTHONLIBS_VERSION_STRING}) - LIST(GET PYTHONLIBS_VERSION_LIST 0 PYTHON_VERSION_MAJOR) - LIST(GET PYTHONLIBS_VERSION_LIST 1 PYTHON_VERSION_MINOR) - MESSAGE("-- Boost_1_67_Or_Later_Result: ${Boost_1_67_Or_Later_Result}") - MESSAGE("-- USE_PYTHON_3: ${USE_PYTHON_3}") + MESSAGE(STATUS "Boost_1_67_Or_Later_Result: ${Boost_1_67_Or_Later_Result}") + MESSAGE(STATUS "USE_PYTHON_3: ${USE_PYTHON_3}") + IF (USE_PYTHON_3) + SET(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}") + SET(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}") + ELSE () + SET(PYTHON_VERSION_MAJOR "${Python2_VERSION_MAJOR}") + SET(PYTHON_VERSION_MINOR "${Python2_VERSION_MINOR}") + ENDIF () + MESSAGE(STATUS "PYTHON_VERSION_MAJOR: ${PYTHON_VERSION_MAJOR}") + MESSAGE(STATUS "PYTHON_VERSION_MINOR: ${PYTHON_VERSION_MINOR}") IF (Boost_1_67_Or_Later_Result) SET(BOOST_PYTHON_COMPONENT "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}") ELSEIF (USE_PYTHON_3) @@ -518,37 +559,38 @@ IF (USE_SYSTEM_BOOST) SET(TST_LIBS ${TST_LIBS} ${Boost_LIBRARIES}) INCLUDE_DIRECTORIES(${TST_INCLUDES}) ELSE (Boost_FOUND) - SET(USE_SYSTEM_BOOST OFF) + MESSAGE(FATAL_ERROR "Cannot find system Boost. Unable to continue.") +# SET(USE_SYSTEM_BOOST OFF) ENDIF (Boost_FOUND) ENDIF (USE_SYSTEM_BOOST) -IF (NOT USE_SYSTEM_BOOST) - MESSAGE("++ Using Internal Boost") - # This is just to cleanup advanced variable viewing, since they're not used anyway - UNSET(Boost_INCLUDE_DIRS) - UNSET(Boost_LIBRARIES) - UNSET(Boost_INCLUDE_DIR) - UNSET(Boost_LIBRARY_DIRS) - SET(Boost_DIR ../ext/) - SET(BOOST_PYTHON_NO_PY_SIGNATURES 1) - SET(TST_INCLUDES ${TST_INCLUDES} ${Vega_Strike_SOURCE_DIR}/${Boost_DIR}) - IF (USE_PYTHON_3) - MESSAGE("++ Using Internal Boost::python3") - SET(TST_LIBS ${TST_LIBS} boost_python3) - ELSE (USE_PYTHON_3) - MESSAGE("++ Using Internal Boost::python (py2)") - SET(TST_LIBS ${TST_LIBS} boost_python) - ENDIF (USE_PYTHON_3) - INCLUDE_DIRECTORIES(${TST_INCLUDES}) - ADD_SUBDIRECTORY(${Boost_DIR} build) - MESSAGE("++ boost dir: ${Boost_DIR}") - #IF (NOT DISABLE_CLIENT) - # ADD_DEPENDENCIES(vegastrike-engine boost_python) - #ENDIF (NOT DISABLE_CLIENT) - #IF (NOT DISABLE_SERVER) - # ADD_DEPENDENCIES(vegaserver boost_python) - #ENDIF (NOT DISABLE_SERVER) -ENDIF (NOT USE_SYSTEM_BOOST) +#IF (NOT USE_SYSTEM_BOOST) +# MESSAGE("++ Using Internal Boost") +# # This is just to cleanup advanced variable viewing, since they're not used anyway +# UNSET(Boost_INCLUDE_DIRS) +# UNSET(Boost_LIBRARIES) +# UNSET(Boost_INCLUDE_DIR) +# UNSET(Boost_LIBRARY_DIRS) +# SET(Boost_DIR ../ext/) +# SET(BOOST_PYTHON_NO_PY_SIGNATURES 1) +# SET(TST_INCLUDES ${TST_INCLUDES} ${Vega_Strike_SOURCE_DIR}/${Boost_DIR}) +# IF (USE_PYTHON_3) +# MESSAGE("++ Using Internal Boost::python3") +# SET(TST_LIBS ${TST_LIBS} boost_python3) +# ELSE (USE_PYTHON_3) +# MESSAGE("++ Using Internal Boost::python (py2)") +# SET(TST_LIBS ${TST_LIBS} boost_python) +# ENDIF (USE_PYTHON_3) +# INCLUDE_DIRECTORIES(${TST_INCLUDES}) +# ADD_SUBDIRECTORY(${Boost_DIR} build) +# MESSAGE("++ boost dir: ${Boost_DIR}") +# #IF (NOT DISABLE_CLIENT) +# # ADD_DEPENDENCIES(vegastrike-engine boost_python) +# #ENDIF (NOT DISABLE_CLIENT) +# #IF (NOT DISABLE_SERVER) +# # ADD_DEPENDENCIES(vegaserver boost_python) +# #ENDIF (NOT DISABLE_SERVER) +#ENDIF (NOT USE_SYSTEM_BOOST) IF (NOT DISABLE_CLIENT) ########## @@ -775,6 +817,8 @@ CONFIGURE_FILE(${Vega_Strike_SOURCE_DIR}/cmake-config.h.in ${Vega_Strike_BINARY_ #end config.h generation #SET(CMAKE_CXX_FLAGS "-include config.h;-pipe;"${CMAKE_CXX_FLAGS}) +INCLUDE_DIRECTORIES(${TST_INCLUDES}) + # Now the source files are listed starting here! SET(LIBGUI_SOURCES src/gui/button.cpp @@ -904,6 +948,19 @@ ADD_LIBRARY(vegastrike-OPcollide src/cmd/collide2/CSopcodecollider.cpp ) +#TARGET_COMPILE_FEATURES(vegastrike-OPcollide PUBLIC cxx_std_11) +set_property(TARGET vegastrike-OPcollide PROPERTY POSITION_INDEPENDENT_CODE TRUE) +IF (NEED_LINKING_AGAINST_LIBM) + TARGET_LINK_LIBRARIES(vegastrike-OPcollide m) +ENDIF() +TARGET_COMPILE_DEFINITIONS(vegastrike-OPcollide PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") +IF (WIN32) + TARGET_COMPILE_DEFINITIONS(vegastrike-OPcollide PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-OPcollide PUBLIC _WIN32_WINNT=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-OPcollide PUBLIC WINVER=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-OPcollide PUBLIC "$<$:Py_DEBUG>") +ENDIF() + SET(LIBCMD_SOURCES src/cmd/alphacurve.cpp src/cmd/beam_generic.cpp @@ -1162,6 +1219,19 @@ ADD_LIBRARY(vegastrike-engine_com ${LIBGFXGENERIC_SOURCES} ) +#TARGET_COMPILE_FEATURES(vegastrike-engine_com PUBLIC cxx_std_11) +set_property(TARGET vegastrike-engine_com PROPERTY POSITION_INDEPENDENT_CODE TRUE) +IF (NEED_LINKING_AGAINST_LIBM) + TARGET_LINK_LIBRARIES(vegastrike-engine_com m) +ENDIF() +TARGET_COMPILE_DEFINITIONS(vegastrike-engine_com PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") +IF (WIN32) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine_com PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine_com PUBLIC _WIN32_WINNT=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine_com PUBLIC WINVER=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine_com PUBLIC "$<$:Py_DEBUG>") +ENDIF() + SET(VEGASTRIKE_SOURCES ${LIBGUI_SOURCES} ${LIBNETCLIENT_SOURCES} @@ -1232,7 +1302,6 @@ SET(VEGASTRIKE_SOURCES #Setup shared lib and include listings for vegastrike-engine. SET(TST_LIBS vegastrike-engine_com vegastrike-OPcollide ${TST_LIBS}) -INCLUDE_DIRECTORIES(${TST_INCLUDES}) IF (NOT DISABLE_CLIENT) ADD_EXECUTABLE(vegastrike-engine ${VEGASTRIKE_SOURCES}) @@ -1241,6 +1310,13 @@ IF (NOT DISABLE_CLIENT) IF (NEED_LINKING_AGAINST_LIBM) TARGET_LINK_LIBRARIES(vegastrike-engine m) ENDIF() + TARGET_COMPILE_DEFINITIONS(vegastrike-engine PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>") + IF (WIN32) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine PUBLIC _WIN32_WINNT=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine PUBLIC WINVER=0x0A00) + TARGET_COMPILE_DEFINITIONS(vegastrike-engine PUBLIC "$<$:Py_DEBUG>") + ENDIF() ADD_DEPENDENCIES(vegastrike-engine OpenGL::GL OpenGL::GLU) diff --git a/engine/CMakePresets.json b/engine/CMakePresets.json new file mode 100644 index 0000000000..a9c3c6c4ef --- /dev/null +++ b/engine/CMakePresets.json @@ -0,0 +1,774 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 16, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "hidden": true, + "displayName": "Default Config", + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceParentDir}/build/${presetName}", + "cacheVariables": { + "USE_PYTHON_3": "ON" + }, + "debug": { + "output": true + } + }, + { + "name": "debug", + "hidden": true, + "displayName": "Debug", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "release", + "hidden": true, + "displayName": "Release", + "inherits": "default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "pie-enabled", + "hidden": true, + "inherits": "default", + "displayName": "PIE Enabled", + "description": "Enable Position-Independent Executables (PIE)", + "cacheVariables": { + "ENABLE_PIE": true + } + }, + { + "name": "pie-disabled", + "hidden": true, + "inherits": "default", + "displayName": "PIE Disabled", + "description": "Build with Position-Independent Executables (PIE) turned off", + "cacheVariables": { + "ENABLE_PIE": false + } + }, + { + "name": "legacy-gl", + "hidden": true, + "displayName": "Legacy OpenGL", + "cacheVariables": { + "OpenGL_GL_PREFERENCE": { + "type": "string", + "value": "LEGACY" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "glvnd", + "hidden": true, + "displayName": "GLVND", + "cacheVariables": { + "OpenGL_GL_PREFERENCE": { + "type": "string", + "value": "GLVND" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-glvnd-debug", + "inherits": [ + "pie-enabled", + "glvnd", + "debug" + ], + "displayName": "PIE Enabled, GLVND, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-glvnd-release", + "inherits": [ + "pie-enabled", + "glvnd", + "release" + ], + "displayName": "PIE Enabled, GLVND, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-legacy-gl-debug", + "inherits": [ + "pie-enabled", + "legacy-gl", + "debug" + ], + "displayName": "PIE Enabled, Legacy OpenGL, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-enabled-legacy-gl-release", + "inherits": [ + "pie-enabled", + "legacy-gl", + "release" + ], + "displayName": "PIE Enabled, Legacy OpenGL, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-glvnd-debug", + "inherits": [ + "pie-disabled", + "glvnd", + "debug" + ], + "displayName": "PIE Disabled, GLVND, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-glvnd-release", + "inherits": [ + "pie-disabled", + "glvnd", + "release" + ], + "displayName": "PIE Disabled, GLVND, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-legacy-gl-debug", + "inherits": [ + "pie-disabled", + "legacy-gl", + "debug" + ], + "displayName": "PIE Disabled, Legacy OpenGL, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-pie-disabled-legacy-gl-release", + "inherits": [ + "pie-disabled", + "legacy-gl", + "release" + ], + "displayName": "PIE Disabled, Legacy OpenGL, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "macos-default", + "hidden": true, + "inherits": "default", + "displayName": "macOS Default", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + }, + "environment": { + "VERBOSE": "ON" + }, + "cacheVariables": { + "CMAKE_FIND_FRAMEWORK": "LAST" + } + }, + { + "name": "macos-pie-enabled-debug", + "inherits": [ + "macos-default", + "pie-enabled", + "debug" + ], + "displayName": "macOS, PIE Enabled, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-enabled-release", + "inherits": [ + "macos-default", + "pie-enabled", + "release" + ], + "displayName": "macOS, PIE Enabled, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-disabled-debug", + "inherits": [ + "macos-default", + "pie-disabled", + "debug" + ], + "displayName": "macOS, PIE Disabled, Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-pie-disabled-release", + "inherits": [ + "macos-default", + "pie-disabled", + "release" + ], + "displayName": "macOS, Pie Disabled, Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "windows-default", + "hidden": true, + "inherits": "default", + "displayName": "Windows Default", + "description": "Default build for Windows", + "environment": { + "VCPKG_DEFAULT_TRIPLET": "x64-windows", + "VCPKG_DEFAULT_HOST_TRIPLET": "x64-windows", + "VCPKG_TARGET_TRIPLET": "x64-windows", + "VCPKG_HOST_TRIPLET": "x64-windows" + }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "debug": { + "output": true, + "find": true + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64", + "hidden": true, + "inherits": "windows-default", + "displayName": "Visual Studio 2019 on Windows x64", + "generator": "Visual Studio 16 2019", + "architecture": "X64", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64", + "hidden": true, + "inherits": "windows-default", + "displayName": "Visual Studio 2022 on Windows x64", + "generator": "Visual Studio 17 2022", + "architecture": "X64", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "ninja-windows", + "hidden": true, + "inherits": "windows-default", + "displayName": "Ninja on Windows", + "generator": "Ninja", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-enabled-debug", + "displayName": "Windows, Ninja, PIE Enabled, Debug", + "inherits": [ + "ninja-windows", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-enabled-release", + "displayName": "Windows, Ninja, PIE Enabled, Release", + "inherits": [ + "ninja-windows", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-disabled-debug", + "displayName": "Windows, Ninja, PIE Disabled, Debug", + "inherits": [ + "ninja-windows", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-pie-disabled-release", + "displayName": "Windows, Ninja, PIE Disabled, Release", + "inherits": [ + "ninja-windows", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-enabled-debug", + "displayName": "VS2019Win64, PIE Enabled, Debug", + "inherits": [ + "VS2019Win64", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-enabled-release", + "displayName": "VS2019Win64, PIE Enabled, Release", + "inherits": [ + "VS2019Win64", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-disabled-debug", + "displayName": "VS2019Win64, PIE Disabled, Debug", + "inherits": [ + "VS2019Win64", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2019Win64-pie-disabled-release", + "displayName": "VS2019Win64, PIE Disabled, Release", + "inherits": [ + "VS2019Win64", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-enabled-debug", + "displayName": "VS2022Win64, PIE Enabled, Debug", + "inherits": [ + "VS2022Win64", + "pie-enabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-enabled-release", + "displayName": "VS2022Win64, PIE Enabled, Release", + "inherits": [ + "VS2022Win64", + "pie-enabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-disabled-debug", + "displayName": "VS2022Win64, PIE Disabled, Debug", + "inherits": [ + "VS2022Win64", + "pie-disabled", + "debug" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "VS2022Win64-pie-disabled-release", + "displayName": "VS2022Win64, PIE Disabled, Release", + "inherits": [ + "VS2022Win64", + "pie-disabled", + "release" + ], + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ], + "buildPresets": [ + { + "name": "build-linux-pie-enabled-glvnd-debug", + "configurePreset": "linux-pie-enabled-glvnd-debug", + "displayName": "Linux, PIE Enabled, GLVND, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-glvnd-release", + "configurePreset": "linux-pie-enabled-glvnd-release", + "displayName": "Linux, PIE Enabled, GLVND, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-legacy-gl-debug", + "configurePreset": "linux-pie-enabled-legacy-gl-debug", + "displayName": "Linux, PIE Enabled, Legacy OpenGL, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-enabled-legacy-gl-release", + "configurePreset": "linux-pie-enabled-legacy-gl-release", + "displayName": "Linux, PIE Enabled, Legacy OpenGL, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-glvnd-debug", + "configurePreset": "linux-pie-disabled-glvnd-debug", + "displayName": "Linux, PIE Disabled, GLVND, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-glvnd-release", + "configurePreset": "linux-pie-disabled-glvnd-release", + "displayName": "Linux, PIE Disabled, GLVND, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-legacy-gl-debug", + "configurePreset": "linux-pie-disabled-legacy-gl-debug", + "displayName": "Linux, PIE Disabled, Legacy OpenGL, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-linux-pie-disabled-legacy-gl-release", + "configurePreset": "linux-pie-disabled-legacy-gl-release", + "displayName": "Linux, PIE Disabled, Legacy OpenGL, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "build-macos-pie-enabled-debug", + "configurePreset": "macos-pie-enabled-debug", + "displayName": "macOS, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-enabled-release", + "configurePreset": "macos-pie-enabled-release", + "displayName": "macOS, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-disabled-debug", + "configurePreset": "macos-pie-disabled-debug", + "displayName": "macOS, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-macos-pie-disabled-release", + "configurePreset": "macos-pie-disabled-release", + "displayName": "macOS, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "build-windows-ninja-pie-enabled-debug", + "configurePreset": "windows-ninja-pie-enabled-debug", + "displayName": "Windows, Ninja, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-enabled-release", + "configurePreset": "windows-ninja-pie-enabled-release", + "displayName": "Windows, Ninja, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-disabled-debug", + "configurePreset": "windows-ninja-pie-disabled-debug", + "displayName": "Windows, Ninja, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-windows-ninja-pie-disabled-release", + "configurePreset": "windows-ninja-pie-disabled-release", + "displayName": "Windows, Ninja, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-enabled-debug", + "configurePreset": "VS2019Win64-pie-enabled-debug", + "displayName": "VS2019Win64, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-enabled-release", + "configurePreset": "VS2019Win64-pie-enabled-release", + "displayName": "VS2019Win64, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-disabled-debug", + "configurePreset": "VS2019Win64-pie-disabled-debug", + "displayName": "VS2019Win64, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2019Win64-pie-disabled-release", + "configurePreset": "VS2019Win64-pie-disabled-release", + "displayName": "VS2019Win64, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-enabled-debug", + "configurePreset": "VS2022Win64-pie-enabled-debug", + "displayName": "VS2022Win64, PIE Enabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-enabled-release", + "configurePreset": "VS2022Win64-pie-enabled-release", + "displayName": "VS2022Win64, PIE Enabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-disabled-debug", + "configurePreset": "VS2022Win64-pie-disabled-debug", + "displayName": "VS2022Win64, PIE Disabled, Debug", + "configuration": "Debug", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "build-VS2022Win64-pie-disabled-release", + "configurePreset": "VS2022Win64-pie-disabled-release", + "displayName": "VS2022Win64, PIE Disabled, Release", + "configuration": "Release", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ] +} diff --git a/engine/objconv/CMakeLists.txt b/engine/objconv/CMakeLists.txt index 4fb0f050c5..1a1ebf35e1 100644 --- a/engine/objconv/CMakeLists.txt +++ b/engine/objconv/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (C) 2001-2002 Daniel Horn -# Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# and other Vega Strike Contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -16,23 +15,43 @@ # # Vega Strike is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . # +CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) + #SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "") INCLUDE_DIRECTORIES("..") SET(TRISORT_SOURCES trisort.cpp) ADD_EXECUTABLE(vs-buildenv-trisort ${TRISORT_SOURCES}) +target_compile_definitions(vs-buildenv-trisort PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-trisort PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-trisort PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-trisort PUBLIC WINVER=0x0A00) +ENDIF() SET(ASTEROID_SOURCES asteroidgen.cpp) ADD_EXECUTABLE(vs-buildenv-asteroidgen ${ASTEROID_SOURCES}) +target_compile_definitions(vs-buildenv-asteroidgen PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-asteroidgen PUBLIC WINVER=0x0A00) +ENDIF() SET(REPLACE_SOURCES replace.cpp) ADD_EXECUTABLE(vs-buildenv-replace ${REPLACE_SOURCES}) +target_compile_definitions(vs-buildenv-replace PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vs-buildenv-replace PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vs-buildenv-replace PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vs-buildenv-replace PUBLIC WINVER=0x0A00) +ENDIF() #find Expat FIND_PACKAGE(EXPAT REQUIRED) @@ -74,6 +93,12 @@ SET(MESHER_SOURCES INCLUDE_DIRECTORIES(${MSH_INCLUDES} mesher) ADD_EXECUTABLE(vega-meshtool ${MESHER_SOURCES}) +target_compile_definitions(vega-meshtool PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") +IF (WIN32) + target_compile_definitions(vega-meshtool PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(vega-meshtool PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(vega-meshtool PUBLIC WINVER=0x0A00) +ENDIF() # OGRE already looked for by parent # USE_SYSTEM_BOOST already set by main script diff --git a/engine/objconv/mesher/CMakeLists.txt b/engine/objconv/mesher/CMakeLists.txt index 308b0f54ec..eca36279d4 100644 --- a/engine/objconv/mesher/CMakeLists.txt +++ b/engine/objconv/mesher/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (C) 2001-2002 Daniel Horn -# Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -16,13 +15,16 @@ # # Vega Strike is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . # + +CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) + FIND_PACKAGE(EXPAT REQUIRED) IF (EXPAT_FOUND) SET(MESHER_SOURCES @@ -50,10 +52,16 @@ IF (EXPAT_FOUND) #if have OGRE to_OgreMesh.cpp ADD_EXECUTABLE(mesher ${MESHER_SOURCES}) + target_compile_definitions(mesher PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") + IF (WIN32) + target_compile_definitions(mesher PUBLIC BOOST_USE_WINAPI_VERSION=0x0A00) + target_compile_definitions(mesher PUBLIC _WIN32_WINNT=0x0A00) + target_compile_definitions(mesher PUBLIC WINVER=0x0A00) + ENDIF() # OGRE already looked for by parent # USE_SYSTEM_BOOST already set by main script - MESSAGE("-- ${OGRE_FOUND} ${USE_SYSTEM_BOOST}" + MESSAGE("-- ${OGRE_FOUND} ${USE_SYSTEM_BOOST}") IF (OGRE_FOUND AND NOT USE_SYSTEM_BOOST) # Ogre usage in mesher requires boost::system ADD_DEPENDENCIES(mesher boost_system) diff --git a/engine/setup/CMakeLists.txt b/engine/setup/CMakeLists.txt index a22cc15292..6ce362a84b 100644 --- a/engine/setup/CMakeLists.txt +++ b/engine/setup/CMakeLists.txt @@ -1,9 +1,8 @@ ## # CMakeLists.txt # -# Copyright (C) 2001-2002 Daniel Horn -# Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -# Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors +# Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, +# Benjamen R. Meyer, and other Vega Strike contributors # # https://github.com/vegastrike/Vega-Strike-Engine-Source # @@ -16,13 +15,16 @@ # # Vega Strike is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . # + +CMAKE_MINIMUM_REQUIRED(VERSION 3.11 FATAL_ERROR) + IF ((NOT BEOS) AND (NOT WIN32)) #SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "") SET(VEGASETTINGS_SOURCES @@ -63,6 +65,7 @@ IF ((NOT BEOS) AND (NOT WIN32)) ENDIF (NOT USE_SYSTEM_BOOST) ADD_EXECUTABLE(vegasettings ${VEGASETTINGS_SOURCES}) + target_compile_definitions(vegasettings PUBLIC "BOOST_ALL_DYN_LINK" "$<$:BOOST_DEBUG_PYTHON>" "$<$:Py_DEBUG>") INSTALL(TARGETS vegasettings DESTINATION bin) diff --git a/engine/src/SharedPool.h b/engine/src/SharedPool.h index f764a0121c..61724ac233 100644 --- a/engine/src/SharedPool.h +++ b/engine/src/SharedPool.h @@ -1,33 +1,32 @@ -/** -* SharedPool.h -* -* Copyright (C) 2001-2002 Daniel Horn -* Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -* Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors -* -* https://github.com/vegastrike/Vega-Strike-Engine-Source -* -* This file is part of Vega Strike. -* -* Vega Strike is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Vega Strike is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Vega Strike. If not, see . -*/ - -#ifndef __STRINGPOOL_H__INCLUDED__ -#define __STRINGPOOL_H__INCLUDED__ +/* + * SharedPool.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * and other Vega Strike contributors. + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source + * + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Vega Strike. If not, see . + */ + +#ifndef VEGA_STRIKE_ENGINE_STRINGPOOL_H +#define VEGA_STRIKE_ENGINE_STRINGPOOL_H + #include #include "gnuhash.h" -//#include "vsfilesystem.h" #ifndef INITIAL_STRINGPOOL_SIZE @@ -35,212 +34,186 @@ #endif //Need reference counted strings, or we'll eat memory like crazy -template < class T, class RefcounterTraits = vsHashComp< T > > -class SharedPool -{ +template > +class SharedPool { public: - typedef vsUMap< T, unsigned int > ReferenceCounter; - typedef SharedPool< T, RefcounterTraits >PoolType; + typedef vsUMap ReferenceCounter; + typedef SharedPool PoolType; private: ReferenceCounter referenceCounter; static PoolType *ms_singleton; public: - typedef T ValueType; + typedef T ValueType; typedef RefcounterTraits RefocounterTraitsType; - static PoolType& getSingleton() - { + static PoolType &getSingleton() { return *ms_singleton; } - static PoolType * getSingletonPtr() - { + static PoolType *getSingletonPtr() { return ms_singleton; } SharedPool(); + ~SharedPool(); public: - class Reference - { + class Reference { typename ReferenceCounter::iterator _it; ReferenceCounter *_rc; - void unref() - { - if ( _rc && ( _it != _rc->end() ) ) { - if ( (_it->second == 0) || ( ( --(_it->second) ) == 0 ) ) { - _rc->erase( _it ); + void unref() { + if (_rc && (_it != _rc->end())) { + if ((_it->second == 0) || ((--(_it->second)) == 0)) { + _rc->erase(_it); } _it = _rc->end(); // Should this be inside the if block? } } - void ref() - { - if ( _rc && ( _it != _rc->end() ) ) { + void ref() { + if (_rc && (_it != _rc->end())) { ++(_it->second); } } public: Reference() : - _it( SharedPool::getSingleton().referenceCounter.end() ) - , _rc( &SharedPool::getSingleton().referenceCounter ) - {} + _it(SharedPool::getSingleton().referenceCounter.end()), + _rc(&SharedPool::getSingleton().referenceCounter) {} - explicit Reference( const T &s ) : - _it( SharedPool::getSingleton().referenceCounter.end() ) - , _rc( &SharedPool::getSingleton().referenceCounter ) - { - set( s ); + explicit Reference(const T &s) : + _it(SharedPool::getSingleton().referenceCounter.end()), + _rc(&SharedPool::getSingleton().referenceCounter) { + set(s); } - explicit Reference( ReferenceCounter *pool ) : - _it( pool->end() ) - , _rc( pool ) - {} + explicit Reference(ReferenceCounter *pool) : + _it(pool->end()), _rc(pool) {} - Reference( ReferenceCounter *pool, const T &s ) : - _it( pool->end() ) - , _rc( pool ) - { - set( s ); + Reference(ReferenceCounter *pool, const T &s) : + _it(pool->end()), _rc(pool) { + set(s); } - Reference( const Reference &other ) : - _it( other._it ) - , _rc( other._rc ) - { + Reference(const Reference &other) : + _it(other._it), _rc(other._rc) { ref(); } - ~Reference() - { + ~Reference() { unref(); } - const T& get() const - { + const T &get() const { static T empty_value; - if ( _rc && ( _it != _rc->end() ) && (_it->second > 0) ) { + if (_rc && (_it != _rc->end()) && (_it->second > 0)) { return _it->first; } else { return empty_value; } } - Reference& set( const T &s ) - { + Reference &set(const T &s) { unref(); if (_rc) { - _it = _rc->insert( std::pair< T, unsigned int > ( s, 0 ) ).first; + _it = _rc->insert(std::pair(s, 0)).first; ref(); } return *this; } - operator const T& () const - { + // TODO: Uncomment the `explicit`, and then fix the resulting compile errors + /*explicit*/ operator const T &() const { return get(); } - Reference& operator=( const T &s ) - { - return set( s ); + Reference &operator=(const T &s) { + return set(s); } - Reference& operator=( const Reference &s ) - { - if (this == &s) + Reference &operator=(const Reference &s) { + if (this == &s) { return *this; + } if (s._rc == _rc) { unref(); _it = s._it; ref(); } else { - set( s.get() ); + set(s.get()); } return *this; } - bool operator==( const T &s ) const - { + bool operator==(const T &s) const { return get() == s; } - bool operator==( const Reference &r ) const - { - if ( _rc && (_rc == r._rc) ) + bool operator==(const Reference &r) const { + if (_rc && (_rc == r._rc)) { return _it == r._it; - - else + } else { return get() == r.get(); + } } - bool operator<( const T &s ) const - { + bool operator<(const T &s) const { return get() < s; } - bool operator<( const Reference &r ) const - { + bool operator<(const Reference &r) const { return get() < r.get(); } - bool operator!=( const T &s ) const - { + bool operator!=(const T &s) const { return get() != s; } - bool operator!=( const Reference &r ) const - { + bool operator!=(const Reference &r) const { return !(*this == r); } }; - Reference get( const T &s ) - { - return Reference( &referenceCounter, s ); + Reference get(const T &s) { + return Reference(&referenceCounter, s); } - Reference get() - { - return Reference( &referenceCounter ); + Reference get() { + return Reference(&referenceCounter); } + friend class PoolType::Reference; }; -class StringpoolTraits : public vsHashComp< std::string > -{ +class StringpoolTraits : public vsHashComp { public: - enum {min_buckets=INITIAL_STRINGPOOL_SIZE}; + enum { + min_buckets = INITIAL_STRINGPOOL_SIZE + }; }; -typedef SharedPool< std::string, StringpoolTraits >StringPool; +typedef SharedPool StringPool; static StringPool stringPool; -inline std::string operator+( const std::string &s, const StringPool::Reference &r ) -{ - return s+r.get(); +inline std::string operator+(const std::string &s, const StringPool::Reference &r) { + return s + r.get(); } -inline std::string operator+( const StringPool::Reference &r, const std::string &s ) -{ - return r.get()+s; +inline std::string operator+(const StringPool::Reference &r, const std::string &s) { + return r.get() + s; } -template < typename T > -inline T& operator<<( T &stream, const StringPool::Reference &ref ) -{ - return stream< +inline T &operator<<(T &stream, const StringPool::Reference &ref) { + return stream << ref.get(); } #include "SharedPool.cpp" -#endif //__STRINGPOOL_H__INCLUDED__ +#endif //VEGA_STRIKE_ENGINE_STRINGPOOL_H diff --git a/engine/src/cmd/ai/aggressive.cpp b/engine/src/cmd/ai/aggressive.cpp index 3192d63947..a4bb371f9a 100644 --- a/engine/src/cmd/ai/aggressive.cpp +++ b/engine/src/cmd/ai/aggressive.cpp @@ -1,9 +1,8 @@ -/** +/* * aggressive.cpp * - * Copyright (C) Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -16,11 +15,11 @@ * * Vega Strike is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with Vega Strike. If not, see . + * along with Vega Strike. If not, see . */ @@ -203,12 +202,12 @@ static AIEvents::ElemAttrMap * getProperScript( Unit *me, Unit *targ, bool inter int fac = 0; if (me) { fac = me->faction; - nam = me->name; + nam = me->name.get(); } return getProperLogicOrInterruptScript( "default", fac, nam, interrupt, personalityseed ); } return getProperLogicOrInterruptScript( ROLES::getRoleEvents( me->attackPreference(), - targ->unitRole() ), me->faction, me->name, interrupt, + targ->unitRole() ), me->faction, me->name.get(), interrupt, personalityseed ); } diff --git a/engine/src/cmd/ai/comm_ai.cpp b/engine/src/cmd/ai/comm_ai.cpp index 4fd187295c..72e1ece782 100644 --- a/engine/src/cmd/ai/comm_ai.cpp +++ b/engine/src/cmd/ai/comm_ai.cpp @@ -1,27 +1,26 @@ -/** -* comm_ai.cpp -* -* Copyright (C) 2001-2002 Daniel Horn -* Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -* Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors -* -* https://github.com/vegastrike/Vega-Strike-Engine-Source -* -* This file is part of Vega Strike. -* -* Vega Strike is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Vega Strike is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Vega Strike. If not, see . -*/ +/* + * comm_ai.cpp + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * and other Vega Strike Contributors + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source + * + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Vega Strike. If not, see . + */ #include "comm_ai.h" #include "faction_generic.h" @@ -236,7 +235,7 @@ void CommunicatingAI::UpdateContrabandSearch() unsigned int max = u->numCargo(); unsigned int quantity = 0; for (unsigned int i = 0; i < max; ++i) - if (InList( u->GetCargo( i ).content, contrabandlist ) > 0) { + if (InList( u->GetCargo( i ).content.get(), contrabandlist ) > 0) { quantity += u->GetCargo( i ).quantity; if (quantity > HiddenTotal) { TerminateContrabandSearch( true ); diff --git a/engine/src/cmd/images.h b/engine/src/cmd/images.h index 644063f70a..2fc6aebc16 100644 --- a/engine/src/cmd/images.h +++ b/engine/src/cmd/images.h @@ -1,30 +1,29 @@ -/** -* images.h -* -* Copyright (C) 2001-2002 Daniel Horn -* Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -* Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors -* -* https://github.com/vegastrike/Vega-Strike-Engine-Source -* -* This file is part of Vega Strike. -* -* Vega Strike is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Vega Strike is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Vega Strike. If not, see . -*/ +/* + * images.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Benjamen R. Meyer, and other Vega Strike Contributors + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source + * + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Vega Strike. If not, see . + */ -#ifndef _IMAGES_H -#define _IMAGES_H +#ifndef VEGA_STRIKE_ENGINE_CMD_IMAGES_H +#define VEGA_STRIKE_ENGINE_CMD_IMAGES_H #include #include @@ -252,15 +251,15 @@ class Cargo } const std::string& GetCategory() const { - return category; + return category.get(); } const std::string& GetContent() const { - return content; + return content.get(); } const std::string& GetDescription() const { - return description; + return description.get(); } std::string GetCategoryPython() { diff --git a/engine/src/cmd/unit_generic.h b/engine/src/cmd/unit_generic.h index bd9ebe413d..b1ffcad54f 100644 --- a/engine/src/cmd/unit_generic.h +++ b/engine/src/cmd/unit_generic.h @@ -1,14 +1,14 @@ // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- -#ifndef __UNIT_GENERIC_H__ -#define __UNIT_GENERIC_H__ +#ifndef VEGA_STRIKE_ENGINE_CMD_UNIT_GENERIC_H +#define VEGA_STRIKE_ENGINE_CMD_UNIT_GENERIC_H +// Q: Why 2 header guards??? -/** +/* * unit_generic.cpp * - * Copyright (C) 2001-2002 Daniel Horn - * Copyright (C) 2020 pyramid3d, Stephen G. Tuggy, and other Vega Strike - * contributors + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, + * Roy Falk, Benjamen R. Meyer, and other Vega Strike contributors * * https://github.com/vegastrike/Vega-Strike-Engine-Source * @@ -30,8 +30,8 @@ /***** Unit is the Unit class without GFX/Sound with AI *****/ -#ifndef _UNIT_H_ -#define _UNIT_H_ +#ifndef VEGA_STRIKE_ENGINE_CMD_UNIT_H +#define VEGA_STRIKE_ENGINE_CMD_UNIT_H #include "armed.h" #include "audible.h" @@ -415,7 +415,7 @@ class Unit : public Armed, public Audible, public Drawable, public Damageable, p //Uses GFX so only in Unit class virtual void Draw( const Transformation &quat = identity_transformation, const Matrix &m = identity_matrix ) override {} virtual void DrawNow( const Matrix &m = identity_matrix, float lod = 1000000000 ) override {} - virtual std::string drawableGetName() override { return name; } + virtual std::string drawableGetName() override { return name.get(); } //Sets the camera to be within this unit. //Uses Universe & GFX so not needed here -> only in Unit class diff --git a/engine/src/gnuhash.h b/engine/src/gnuhash.h index a507ebe3c6..1b2d477eb1 100644 --- a/engine/src/gnuhash.h +++ b/engine/src/gnuhash.h @@ -1,84 +1,81 @@ -/** -* gnuhash.h -* -* Copyright (C) 2001-2002 Daniel Horn -* Copyright (C) 2002-2019 pyramid3d and other Vega Strike Contributors -* Copyright (C) 2019-2022 Stephen G. Tuggy and other Vega Strike Contributors -* -* https://github.com/vegastrike/Vega-Strike-Engine-Source -* -* This file is part of Vega Strike. -* -* Vega Strike is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Vega Strike is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Vega Strike. If not, see . -*/ +/* + * gnuhash.h + * + * Copyright (C) 2001-2023 Daniel Horn, pyramid3d, Stephen G. Tuggy, Benjamen R. Meyer, + * and other Vega Strike contributors. + * + * https://github.com/vegastrike/Vega-Strike-Engine-Source + * + * This file is part of Vega Strike. + * + * Vega Strike is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Vega Strike is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Vega Strike. If not, see . + */ -#ifndef _GNUHASH_H_ -#define _GNUHASH_H_ + +#ifndef VEGA_STRIKE_ENGINE_GNUHASH_H +#define VEGA_STRIKE_ENGINE_GNUHASH_H #include +#include #define vsUMap std::unordered_map -#define vsHashComp std::hash_compare +#define vsHashComp vega_std_overrides::hash_compare #define vsHash std::hash class Unit; -namespace std -{ +namespace std { // defining things in std:: for basic types is ... frowned upon: http://eel.is/c++draft/namespace.std#1 -template < > -struct hash< void* > -{ - hash< size_t >a; -public: - size_t operator()( const void *key ) const - { - return a( (size_t) key ); - } -}; -template < > -struct hash< const void* > -{ - hash< size_t >a; -public: - size_t operator()( const void*const &key ) const - { - return a( (size_t) key ); - } -}; + template<> + struct hash { + hash a; + public: + size_t operator()(const void *key) const { + return a((size_t) key); + } + }; -template < > -struct hash< const Unit* > -{ - hash< size_t >a; -public: - size_t operator()( const Unit*const &key ) const - { - return a( (size_t) key>>4 ); - } -}; -template < > -struct hash< std::pair< Unit*, Unit* > > -{ - hash< size_t >a; -public: - size_t operator()( const std::pair< Unit*, Unit* > &key ) const - { - return (size_t) ((size_t) ( a( (int) ( ( (size_t) key.first )>>4 ) )) - ^((size_t) a( (int) ( ( (size_t) key.second )>>4 ) ) )); - } -}; -#ifdef __GNUC__ + template<> + struct hash { + hash a; + public: + size_t operator()(const void *const &key) const { + return a((size_t) key); + } + }; + + template<> + struct hash { + hash a; + public: + size_t operator()(const Unit *const &key) const { + return a((size_t) key >> 4); + } + }; + + template<> + struct hash > { + hash a; + public: + size_t operator()(const std::pair &key) const { + return (size_t) ((size_t) (a((int) (((size_t) key.first) >> 4))) + ^ ((size_t) a((int) (((size_t) key.second) >> 4)))); + } + }; + +} + +namespace vega_std_overrides { //Minimum declaration needed by SharedPool.h template < class Key, class Traits = std::less< Key > > class hash_compare @@ -87,8 +84,8 @@ class hash_compare static const size_t bucket_size = 4; static const size_t min_buckets = 8; }; -#endif + } -#endif //def _GNUHASH_H_ +#endif //def VEGA_STRIKE_ENGINE_GNUHASH_H diff --git a/engine/vcpkg-configuration.json b/engine/vcpkg-configuration.json new file mode 100644 index 0000000000..81539fafef --- /dev/null +++ b/engine/vcpkg-configuration.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "default-registry": { + "kind": "git", + "baseline": "45c660987c371515ddcc5c355e7989c0d652b85f", + "repository": "https://github.com/vegastrike/vcpkg-local" + } +} diff --git a/engine/vcpkg.json b/engine/vcpkg.json index 763a4d43ff..5bb4441d25 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -1,8 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", "name": "vega-strike", - "version-string": "0.8.0", - "builtin-baseline": "1085a57da0725c19e19586025438e8c16f34c890", + "version-string": "0.8.2", "dependencies": [ "boost-python", "boost-log", diff --git a/engine/vegastrike.spec b/engine/vegastrike.spec index 0d8f13534d..53b06264c9 100644 --- a/engine/vegastrike.spec +++ b/engine/vegastrike.spec @@ -1,7 +1,7 @@ # norootforbuild Name: vegastrike -Version: 0.8.0 +Version: 0.8.2 Release: 1 Summary: 3D OpenGL spaceflight simulator Group: Amusements/Games diff --git a/script/brew-install-for-cmake.sh b/script/brew-install-for-cmake.sh new file mode 100755 index 0000000000..b76be51583 --- /dev/null +++ b/script/brew-install-for-cmake.sh @@ -0,0 +1,47 @@ +#!/bin/bash +#==================================== +# @file : brew-install-for-cmake.sh +# @brief : installs a package with Homebrew, keg-only, then registers that package's +# include, lib, bin, etc. directories for use by CMake +# @usage : script/brew-install-for-cmake.sh +# @param : first, the brew formula name, optionally including a version suffix +# second, a truthy value indicating whether or not to leave it linked +#==================================== +# Copyright (C) 2023 Stephen G. Tuggy and other Vega Strike contributors +# +# This file is part of Vega Strike. +# +# Vega Strike is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Vega Strike is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Vega Strike. If not, see . + +set -e + +PACKAGE_SPEC="$1" +LEAVE_LINKED="$2" + +export HOMEBREW_NO_AUTO_UPDATE=1 +export HOMEBREW_NO_INSTALL_UPGRADE=1 +export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + +if ! brew list "$PACKAGE_SPEC" &>/dev/null; then + brew install "$PACKAGE_SPEC" + if [ ! "$LEAVE_LINKED" ] ; then + brew unlink "$PACKAGE_SPEC" + fi +fi +PACKAGE_INSTALLED_PREFIX=$(brew --prefix "$PACKAGE_SPEC") +PACKAGE_INSTALLED_BIN="$PACKAGE_INSTALLED_PREFIX/bin" +#PACKAGE_INSTALLED_INCLUDE="$PACKAGE_INSTALLED_PREFIX/include" +#PACKAGE_INSTALLED_LIB="$PACKAGE_INSTALLED_PREFIX/lib" +export PATH="$PACKAGE_INSTALLED_BIN:$PATH" +export CMAKE_PREFIX_PATH="$PACKAGE_INSTALLED_PREFIX:$CMAKE_PREFIX_PATH" diff --git a/script/build.ps1 b/script/build.ps1 index fac81a6514..b4515adca4 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -1,4 +1,6 @@ -# Copyright (C) 2021 Stephen G. Tuggy +# build.ps1 + +# Copyright (C) 2021-2023 Stephen G. Tuggy and other Vega Strike contributors # https://github.com/vegastrike/Vega-Strike-Engine-Source @@ -17,10 +19,51 @@ # You should have received a copy of the GNU General Public License # along with Vega Strike. If not, see . -cmake -B build -S .\engine\ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_3=ON -cmake --build .\build\ --config Release + +param( + [String]$Generator = "VS2019Win64", # Other options include "ninja" and "VS2022Win64" + [Boolean]$EnablePIE = $false, + [String]$BuildType = "Release" # You can also specify "Debug" +) + +[String]$cmakePresetName = "" +if ($Generator -ieq "Ninja") { + $cmakePresetName += "windows-ninja" +} elseif ($Generator -ieq "VS2019Win64") { + $cmakePresetName += "VS2019Win64" +} elseif ($Generator -ieq "VS2022Win64") { + $cmakePresetName += "VS2022Win64" +} else { + Write-Error "Invalid value for Generator: $Generator" + exit 1 +} +$cmakePresetName += "-" +if ($EnablePIE) { + $cmakePresetName += "pie-enabled" +} else { + $cmakePresetName += "pie-disabled" +} +$cmakePresetName += "-" +if ($BuildType -ieq "Debug") { + $cmakePresetName += "debug" +} elseif ($BuildType -ieq "Release") { + $cmakePresetName += "release" +} else { + Write-Error "Unrecognized value for BuildType: $BuildType" + exit 1 +} + +[String]$baseDir = (Get-Location -PSProvider "FileSystem").Path +[String]$binaryDir = "$baseDir\build\$cmakePresetName" +Push-Location $baseDir\engine +cmake --preset $cmakePresetName +cmake --build --preset "build-$cmakePresetName" -v +Pop-Location + New-Item bin -ItemType Directory -Force -xcopy /y .\build\Release\*.* .\bin\ -xcopy /y .\build\objconv\Release\*.* .\bin\ -# Not building vegasettings for the moment -# xcopy /y .\build\setup\Release\*.* .\bin\ +$aPossibleBinaryDirs = @("$binaryDir","$binaryDir\$BuildType", "$binaryDir\$BuildType\objconv", "$binaryDir\objconv\$BuildType", "$binaryDir\$BuildType\setup", "$binaryDir\setup\$BuildType") +$aPossibleBinaryDirs | ForEach-Object { + if (Test-Path $_) { + Copy-Item -Force -Verbose $_\*.* .\bin + } +} diff --git a/script/install b/script/install index 6731f11ba4..440e0bfa14 100755 --- a/script/install +++ b/script/install @@ -50,7 +50,7 @@ fi SOURCE_PATH="$PWD" cd "$SOURCE_PATH" -echo ' ==== VEGA STRIKE 0.8.0 ====' +echo ' ==== VEGA STRIKE 0.8.2 ====' echo '' echo '' if [ "x" = "x$BINARY_APPEND" ]; then