Skip to content

Commit

Permalink
Merge branch 'main' into port/nvidia-triton
Browse files Browse the repository at this point in the history
  • Loading branch information
luncliff committed Feb 26, 2025
2 parents bda996c + 912cb94 commit 3f3b4a2
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 147 deletions.
64 changes: 56 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ jobs:
if: runner.os == 'Linux'
run: |
# sudo apt update -y
sudo apt install -y pkg-config nasm \
libnuma-dev libopenmpi-dev \
libx11-dev libxi-dev libxext-dev libx11-xcb-dev \
libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa
sudo apt install -y $(cat test/packages-apt.txt)
- name: "Run homebrew"
if: runner.os == 'macOS'
Expand All @@ -82,7 +79,7 @@ jobs:
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
shell: pwsh

- name: "Run vcpkg(${{matrix.triplet}})"
- name: "Run vcpkg(${{ matrix.triplet }})"
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
vcpkg install --keep-going \
Expand All @@ -95,9 +92,9 @@ jobs:
VCPKG_BINARY_SOURCES: "${{ secrets.VCPKG_BINARY_SOURCES }}"
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/triplets"
VCPKG_DEFAULT_TRIPLET: "${{matrix.triplet}}"
VCPKG_DEFAULT_TRIPLET: "${{ matrix.triplet }}"

- name: "Run vcpkg(${{matrix.triplet}})"
- name: "Run vcpkg(${{ matrix.triplet }})"
if: runner.os == 'Windows'
run: |
vcpkg install --keep-going `
Expand All @@ -110,7 +107,58 @@ jobs:
VCPKG_BINARY_SOURCES: "${{ secrets.VCPKG_BINARY_SOURCES }}"
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/triplets"
VCPKG_DEFAULT_TRIPLET: "${{matrix.triplet}}"
VCPKG_DEFAULT_TRIPLET: "${{ matrix.triplet }}"

host-tools:
name: "Host Tools"
runs-on: ${{ matrix.runner_image }} # https://github.com/actions/runner-images
strategy:
matrix:
include:
- runner_image: "ubuntu-latest"
- runner_image: "macos-13"
# - runner_image: "windows-latest"
fail-fast: false
steps:
- uses: actions/[email protected]
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- uses: lukka/[email protected]
with:
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
vcpkgGitCommitId: "6f29f12e82a8293156836ad81cc9bf5af41fe836" # 2025.01.13
runVcpkgInstall: false

- name: "Run apt"
if: runner.os == 'Linux'
run: |
# sudo apt update -y
sudo apt install -y $(cat test/packages-apt.txt)
- name: "Run homebrew"
if: runner.os == 'macOS'
run: brew install autoconf automake libtool

- uses: microsoft/setup-msbuild@v2
if: runner.os == 'Windows'
with:
msbuild-architecture: x64

- uses: lukka/[email protected]
with:
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
vcpkgGitCommitId: "6f29f12e82a8293156836ad81cc9bf5af41fe836" # 2025.01.13
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--x-feature`, `host-tools`, `--clean-after-build`]'
vcpkgJsonGlob: "test/vcpkg.json"
vcpkgConfigurationJsonGlob: "test/vcpkg-configuration.json"
env:
VCPKG_BINARY_SOURCES: "${{ secrets.VCPKG_BINARY_SOURCES }}"
VCPKG_OVERLAY_PORTS: "${{ github.workspace }}/ports"
VCPKG_OVERLAY_TRIPLETS: "${{ github.workspace }}/triplets"

android:
name: "Android"
Expand Down
8 changes: 8 additions & 0 deletions ports/abseil/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
)

if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic"))
message(WARNING "macro 'ABSL_CONSUME_DLL' may needed in the abseil-cpp importing sources")

Check warning on line 32 in ports/abseil/portfile.cmake

View workflow job for this annotation

GitHub Actions / Overlay (windows-latest, x64-windows)

macro 'ABSL_CONSUME_DLL' may needed in the abseil-cpp importing sources

Check warning on line 32 in ports/abseil/portfile.cmake

View workflow job for this annotation

GitHub Actions / Overlay (windows-latest, arm64-windows)

macro 'ABSL_CONSUME_DLL' may needed in the abseil-cpp importing sources

Check warning on line 32 in ports/abseil/portfile.cmake

View workflow job for this annotation

GitHub Actions / Overlay (windows-latest, arm64-windows)

macro 'ABSL_CONSUME_DLL' may needed in the abseil-cpp importing sources
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/absl/base/config.h"
"defined(ABSL_CONSUME_DLL)" "1")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/absl/base/internal/thread_identity.h"
"defined(ABSL_CONSUME_DLL)" "1")
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
7 changes: 2 additions & 5 deletions ports/abseil/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"name": "abseil",
"version": "20240722.0",
"description": [
"Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.",
"In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you.",
"Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole."
],
"port-version": 1,
"description": "Abseil is an open-source collection of C++ code (compliant to C++17) designed to augment the C++ standard library",
"homepage": "https://github.com/abseil/abseil-cpp",
"license": "Apache-2.0",
"dependencies": [
Expand Down
117 changes: 87 additions & 30 deletions ports/godot/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,55 @@ vcpkg_from_github(
"${GODOT_PR_96167_PATCH}"
)

x_vcpkg_get_python_packages(PYTHON_VERSION 3 OUT_PYTHON_VAR PYTHON3
PACKAGES SCons
)
function(make_linker_flag LIBNAME OUTPUT)
if(VCPKG_TARGET_IS_WINDOWS)
# for MSVC linker, use the library file's name
find_library(LIBRARY NAMES ${LIBNAME} PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH REQUIRED)
get_filename_component(OPTION "${LIBRARY}" NAME)
else()
# for other linkers, use -l${LIBNAME}
set(OPTION "-l${LIBNAME}")
endif()
set(${OUTPUT} "${OPTION}" PARENT_SCOPE)
endfunction()

if("spine-runtimes" IN_LIST FEATURES)
vcpkg_from_github(
OUT_SOURCE_PATH SPINE_SOURCE_PATH
REPO EsotericSoftware/spine-runtimes
REF 1cdbf9be1a92e0a3015af8e0f0e1b05b872e33c9
SHA512 444c8409c25e92b6c02a4d05f3ec84fced9622b62fbe68a4c4ce813b1451da5188b08be6df37dacde7da7a0bd01cb7d476afc531574793871b850025ec3c505a
HEAD_REF 4.2
)
# using 'spine-runtimes' port. exclude the sources from the build
file(REMOVE_RECURSE "${SPINE_SOURCE_PATH}/spine-cpp")
# path to the custom module. see SCsub file
get_filename_component(SPINE_GODOT_PATH "${SPINE_SOURCE_PATH}/spine-godot" ABSOLUTE)
list(APPEND CUSTOM_MODULES "${SPINE_GODOT_PATH}")
# see linkflags in scons_build function
make_linker_flag("spine-cpp" SPINE_FLAG)
list(APPEND LINKER_FLAGS ${SPINE_FLAG})
endif()
if(DEFINED CUSTOM_MODULES)
set(CUSTOM_MODULE_OPTIONS "custom_modules=${CUSTOM_MODULES}")
string(REPLACE ";" "," CUSTOM_MODULE_OPTIONS "${CUSTOM_MODULE_OPTIONS}")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
# https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category
# https://learn.microsoft.com/en-us/cpp/build/reference/linker-options
set(CCFLAGS "ccflags=/I${CURRENT_INSTALLED_DIR}/include")
set(LINKFLAGS "linkflags=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${LINKER_FLAGS}")
else()
set(CCFLAGS "ccflags=-I${CURRENT_INSTALLED_DIR}/include")
set(LINKFLAGS "linkflags=-L${CURRENT_INSTALLED_DIR}/lib;${LINKER_FLAGS}")
endif()
string(REPLACE ";" " " LINKFLAGS "${LINKFLAGS}")

message(STATUS "Using CCFLAGS: ${CCFLAGS}")
message(STATUS "Using LINKFLAGS: ${LINKFLAGS}")

x_vcpkg_get_python_packages(PYTHON_VERSION 3 OUT_PYTHON_VAR PYTHON3 PACKAGES SCons)
function(get_python_site_packages PYTHON OUT_PATH)
execute_process(
COMMAND "${PYTHON}" -c "import site; print(site.getsitepackages()[0])"
Expand All @@ -47,67 +92,79 @@ function(scons_build)
endif()
message(STATUS "Building target ${arg_TARGET}")
vcpkg_execute_required_process(
COMMAND "${SCONS}" target=${arg_TARGET} ${arg_SCONS_FLAGS}
tests=false deprecated=no debug_symbols=no
COMMAND "${SCONS}" target=${arg_TARGET} ${arg_SCONS_FLAGS} ${CCFLAGS} ${LINKFLAGS}
tests=false deprecated=no debug_symbols=no optimize=size
LOGNAME "build-${arg_TARGET}"
WORKING_DIRECTORY "${arg_DIRECTORY}"
)
endfunction()

# https://scons.org/doc/latest/HTML/scons-user/index.html
# https://scons.org/doc/production/TEXT/scons-man.txt
set(ENV{SCONS_CACHE} "${CURRENT_BUILDTREES_DIR}/scons-cache")
set(ENV{SCONSFLAGS} "--jobs=${VCPKG_CONCURRENCY}")

# https://github.com/godotengine/godot/blob/4.3-stable/.github/workflows/runner.yml
# see detect.py scripts
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ARCH_NAME "x86_64")
set(ARCH "x86_64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(ARCH_NAME "arm64")
set(ARCH "arm64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(ARCH "x86_32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(ARCH "arm32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
set(ARCH "wasm32")
else()
message(FATAL_ERROR "Unknown arch: ${VCPKG_TARGET_ARCHITECTURE}")
endif()

vcpkg_find_acquire_program(PKGCONFIG)
message(STATUS "Using pkgconfig: ${PKGCONFIG}")
get_filename_component(PKGCONFIG_PATH "${PKGCONFIG}" PATH)
vcpkg_add_to_path(PREPEND "${PKGCONFIG_PATH}")

# ${SOURCE_PATH}/.github/workflows
# todo: android, ios, web
if(VCPKG_TARGET_IS_WINDOWS) # windows_build.yml
set(PLATFORM windows)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(CRT_FLAG "use_static_cpp=true") # /MT
else()
set(CRT_FLAG "use_static_cpp=false") # /MD
endif()
scons_build(TARGET template_release
SCONS_FLAGS platform=windows arch=${ARCH_NAME} vsproj=yes vsproj_gen_only=no
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} vsproj=yes vsproj_gen_only=no ${CRT_FLAG} ${CUSTOM_MODULE_OPTIONS}
)
scons_build(TARGET editor
SCONS_FLAGS platform=windows arch=${ARCH_NAME} vsproj=yes vsproj_gen_only=no windows_subsystem=console
)
vcpkg_copy_tools(
TOOL_NAMES godot.windows.template_release.${ARCH_NAME}
godot.windows.editor.${ARCH_NAME}
SEARCH_DIR "${SOURCE_PATH}/bin" AUTO_CLEAN
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} vsproj=yes vsproj_gen_only=no windows_subsystem=console ${CRT_FLAG} ${CUSTOM_MODULE_OPTIONS}
)

elseif(VCPKG_TARGET_IS_OSX) # macos_build.yml
set(PLATFORM macos)
scons_build(TARGET template_release
SCONS_FLAGS platform=macos arch=${ARCH_NAME} optimize=size vulkan=false
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} vulkan=false ${CUSTOM_MODULE_OPTIONS}
)
scons_build(TARGET editor
SCONS_FLAGS platform=macos arch=${ARCH_NAME} optimize=size vulkan=false
)
vcpkg_copy_tools(
TOOL_NAMES godot.macos.template_release.${ARCH_NAME}
godot.macos.editor.${ARCH_NAME}
SEARCH_DIR "${SOURCE_PATH}/bin" AUTO_CLEAN
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} vulkan=false ${CUSTOM_MODULE_OPTIONS}
)

elseif(VCPKG_TARGET_IS_LINUX) # linux_build.yml
set(PLATFORM linuxbsd)
scons_build(TARGET template_release
SCONS_FLAGS platform=linuxbsd arch=${ARCH_NAME} optimize=size
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} ${CUSTOM_MODULE_OPTIONS}
)
scons_build(TARGET editor
SCONS_FLAGS platform=linuxbsd arch=${ARCH_NAME} optimize=size
)
vcpkg_copy_tools(
TOOL_NAMES godot.linuxbsd.template_release.${ARCH_NAME}
godot.linuxbsd.editor.${ARCH_NAME}
SEARCH_DIR "${SOURCE_PATH}/bin" AUTO_CLEAN
SCONS_FLAGS platform=${PLATFORM} arch=${ARCH} ${CUSTOM_MODULE_OPTIONS}
)

endif()

vcpkg_copy_tools(
TOOL_NAMES godot.${PLATFORM}.template_release.${ARCH}
godot.${PLATFORM}.editor.${ARCH}
SEARCH_DIR "${SOURCE_PATH}/bin" AUTO_CLEAN
)

file(INSTALL "${SOURCE_PATH}/README.md" "${SOURCE_PATH}/CHANGELOG.md" "${SOURCE_PATH}/AUTHORS.md"
"${SOURCE_PATH}/LOGO_LICENSE.txt" "${SOURCE_PATH}/logo.png" "${SOURCE_PATH}/icon.png"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
Expand Down
11 changes: 10 additions & 1 deletion ports/godot/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "godot",
"version": "4.3",
"port-version": 1,
"description": "Godot Engine - Multi-platform 2D and 3D game engine",
"homepage": "https://godotengine.org/",
"license": "MIT",
Expand All @@ -10,5 +11,13 @@
"name": "vcpkg-get-python-packages",
"host": true
}
]
],
"features": {
"spine-runtimes": {
"description": "https://esotericsoftware.com/spine-godot",
"dependencies": [
"spine-runtimes"
]
}
}
}
7 changes: 7 additions & 0 deletions test/packages-apt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ libx11-dev
libxi-dev
libxext-dev
libx11-xcb-dev
python3-pip
python3-venv
pkg-config
libxinerama-dev
libxcursor-dev
xorg-dev
libglu1-mesa
3 changes: 3 additions & 0 deletions test/self-hosted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"dependencies": [
{
"name": "godot",
"features": [
"spine-runtimes"
],
"platform": "x64 & windows"
},
{
Expand Down
Loading

0 comments on commit 3f3b4a2

Please sign in to comment.