Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: "Build"
name: "Build on ${{ matrix.os.suffix }}"

strategy:
matrix:
Expand Down Expand Up @@ -58,6 +58,9 @@ jobs:
vcpkgDirectory: '${{env.VCPKG_ROOT}}'
vcpkgGitCommitId: 'ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0'
runVcpkgInstall: false

- name: Set up rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.0

# Run CMake+vcpkg+Ninja+CTest to generate/build/test.
- name: Build and Test with CMake
Expand All @@ -77,8 +80,8 @@ jobs:
run: |
cmake --install ${{github.workspace}}/_build/github-actions --config RelWithDebInfo --prefix ${{github.workspace}}/_build/ci-install --component ${{ matrix.target }}

# Prepare artifact
- name: Prepare artifact
# Prepare and Upload Artifact
- name: Prepare and Upload Artifact
id: prepare_artifact
run: >
python scripts/package_target.py
Expand All @@ -87,10 +90,37 @@ jobs:
--artifact-dir ${{github.workspace}}/_build/ci-artifact
--target ${{ matrix.target }}
--suffix ${{ matrix.os.suffix }}
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare_artifact.outputs.artifact_name }}
path: ${{github.workspace}}/_build/ci-artifact/${{ steps.prepare_artifact.outputs.artifact_name }}

package:
name: "Package Release"
needs: build
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

# Upload result
- name: Upload build result
- name: Copy hamdata.ini to Windows artifact
run: |
mkdir -p artifacts/AG-server-ci-windows/ag_addon/addons/amxmodx/configs
cp artifacts/AG-server-ci-linux/ag_addon/addons/amxmodx/configs/hamdata.ini artifacts/AG-server-ci-windows/ag_addon/addons/amxmodx/configs/hamdata.ini

- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare_artifact.outputs.artifact_name }}
path: ${{github.workspace}}/_build/ci-artifact
name: AG-server-ci-windows
path: artifacts/AG-server-ci-windows
overwrite: true

- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
with:
name: AG-server-ci-linux
path: artifacts/AG-server-ci-linux
overwrite: true
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ include( CTest )
option( AUTO_DEPLOY "Whether to automatically deploy to deploy paths" )
option( NO_STEAM_API "Disable Steam API" )
option( GENERATE_AMXX_OFFSETS "Generate AMXX offsets when building" )
option( GENERATE_HAMDATA_INI "Generate hamdata.ini when building" )

#-----------------------------------------------------------------
# Compiler checks
Expand Down
2 changes: 2 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

"AUTO_DEPLOY": false,
"GENERATE_AMXX_OFFSETS": false,
"GENERATE_HAMDATA_INI": false,
"GNU_FORCE_COLORED_OUTPUT": true
}
},
Expand All @@ -28,6 +29,7 @@
"cacheVariables": {
"GNU_FORCE_COLORED_OUTPUT": false,
"GENERATE_AMXX_OFFSETS": true,
"GENERATE_HAMDATA_INI": true,
"WARNINGS_ARE_ERRORS": true
}
}
Expand Down
3 changes: 2 additions & 1 deletion CMakeUserPresets.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"inherits": ["base", "platform-generator"],
"cacheVariables": {
"AUTO_DEPLOY": true,
"GENERATE_AMXX_OFFSETS": false
"GENERATE_AMXX_OFFSETS": false,
"GENERATE_HAMDATA_INI": false
}
}
],
Expand Down
15 changes: 15 additions & 0 deletions cmake/InstallHamdataIni.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set the binary dir path from configure_file
set( ACTUAL_BINARY_DIR "@CMAKE_BINARY_DIR@" )

set( hamdata_ini "${ACTUAL_BINARY_DIR}/hamdata_ini_generator/target/release/output/auto_hamdata190.ini" )

if( NOT EXISTS ${hamdata_ini} )
message( FATAL_ERROR "hamdata.ini file not found at: ${hamdata_ini}" )
endif()

# Install it
file(
INSTALL ${hamdata_ini}
DESTINATION "${CMAKE_INSTALL_PREFIX}/addons/amxmodx/configs"
RENAME "hamdata.ini"
)
15 changes: 15 additions & 0 deletions gamedir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,18 @@ if( GENERATE_AMXX_OFFSETS )
COMPONENT server
)
endif()

if ( GENERATE_HAMDATA_INI AND PLATFORM_LINUX )
# Generate the install script
configure_file(
${CMAKE_SOURCE_DIR}/cmake/InstallHamdataIni.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/InstallHamdataIni.cmake
@ONLY
)

# Install hamdata.ini file
install(
SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/InstallHamdataIni.cmake
COMPONENT server
)
endif()
27 changes: 27 additions & 0 deletions src/game/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,30 @@ if( GENERATE_AMXX_OFFSETS )
${AMXX_OFFSETS_CLASS_LIST}
)
endif()

if( GENERATE_HAMDATA_INI AND PLATFORM_LINUX )
set( HAMDATA_GENERATOR_REPO_DIR "${CMAKE_BINARY_DIR}/hamdata_ini_generator" )
set( HAMDATA_GENERATOR_DIR "${HAMDATA_GENERATOR_REPO_DIR}/target/release" )
set( HAMDATA_GENERATOR_EXEC "${HAMDATA_GENERATOR_DIR}/vtable" )

FetchContent_Declare(
hamdata_ini_generator
GIT_REPOSITORY https://github.com/ag-community/hamdata_ini_generator
SOURCE_DIR ${HAMDATA_GENERATOR_REPO_DIR}
)

FetchContent_MakeAvailable( hamdata_ini_generator )

add_custom_command(
TARGET server POST_BUILD
COMMAND make -C ${HAMDATA_GENERATOR_REPO_DIR} release
COMMENT "Compiling hamdata.ini generator"
)

add_custom_command(
TARGET server POST_BUILD
COMMAND ${HAMDATA_GENERATOR_EXEC} vtable-dump $<TARGET_FILE:server>
WORKING_DIRECTORY ${HAMDATA_GENERATOR_DIR}
COMMENT "Generating hamdata.ini"
)
endif()
Loading