mirror of https://github.com/aap/librw.git
ci: don't use conan for ci
This commit is contained in:
parent
e40a19be72
commit
a85292e799
|
@ -1,57 +0,0 @@
|
|||
name: Conan
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
jobs:
|
||||
build-cmake:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
platform: ['null', 'gl3', 'd3d9']
|
||||
gl3_gfxlib: ['glfw', 'sdl2']
|
||||
exclude:
|
||||
- os: ubuntu-latest
|
||||
platform: d3d9
|
||||
- os: macos-latest
|
||||
platform: d3d9
|
||||
- platform: 'null'
|
||||
gl3_gfxlib: sdl2
|
||||
- platform: d3d9
|
||||
gl3_gfxlib: sdl2
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: "Setup conan"
|
||||
run: |
|
||||
python -m pip install conan
|
||||
conan config init
|
||||
- name: "Create host profile"
|
||||
shell: bash
|
||||
run: |
|
||||
cp ~/.conan/profiles/default host_profile
|
||||
- name: "Download/build dependencies (conan install)"
|
||||
run: |
|
||||
conan install ${{ github.workspace }} librw/master@ -if build -o librw:platform=${{ matrix.platform }} -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib }} --build missing -pr:h ./host_profile -pr:b default
|
||||
env:
|
||||
CONAN_SYSREQUIRES_MODE: enabled
|
||||
- name: "Build librw (conan build)"
|
||||
run: |
|
||||
conan build ${{ github.workspace }} -if build -bf build -pf package
|
||||
- name: "Package librw (conan package)"
|
||||
run: |
|
||||
conan package ${{ github.workspace }} -if build -bf build -pf package
|
||||
- name: "Create binary package (cpack)"
|
||||
working-directory: ./build
|
||||
run: |
|
||||
cpack
|
||||
- name: "Archive binary package (github artifacts)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: "${{ matrix.os }}-${{ matrix.platform }}"
|
||||
path: build/*.tar.xz
|
||||
if-no-files-found: error
|
|
@ -1,29 +0,0 @@
|
|||
name: Playstation 2 (by ps2dev)
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
jobs:
|
||||
build-playstation-2:
|
||||
runs-on: ubuntu-latest
|
||||
container: ps2dev/ps2dev
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Install dependencies"
|
||||
run: |
|
||||
apk add build-base cmake
|
||||
- name: "Build files"
|
||||
run: |
|
||||
cmake -S. -Bbuild -DLIBRW_INSTALL=ON -DLIBRW_PLATFORM=PS2 -DCMAKE_TOOLCHAIN_FILE=cmake/ps2/cmaketoolchain/toolchain_ps2_ee.cmake
|
||||
cmake --build build --parallel
|
||||
- name: "Create binary package (cpack)"
|
||||
working-directory: ./build
|
||||
run: |
|
||||
cpack
|
||||
- name: "Archive binary package (github artifacts)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: "ps2"
|
||||
path: build/*.tar.xz
|
||||
if-no-files-found: error
|
|
@ -1,26 +0,0 @@
|
|||
name: Nintendo Switch (by devkitPro)
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
jobs:
|
||||
build-nintendo-switch:
|
||||
runs-on: ubuntu-latest
|
||||
container: devkitpro/devkita64:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Build files"
|
||||
run: |
|
||||
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -S. -Bbuild -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DLIBRW_INSTALL=True
|
||||
cmake --build build --parallel
|
||||
- name: "Create binary package (cpack)"
|
||||
working-directory: ./build
|
||||
run: |
|
||||
cpack
|
||||
- name: "Archive binary package (github artifacts)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: "switch-gl3"
|
||||
path: build/*.tar.xz
|
||||
if-no-files-found: error
|
|
@ -0,0 +1,77 @@
|
|||
name: Build
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
jobs:
|
||||
build-cmake:
|
||||
name: ${{ matrix.case.name }}
|
||||
runs-on: ${{ matrix.case.os }}
|
||||
container: ${{ matrix.case.container }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
case:
|
||||
- { name: 'Windows (DirectX 9)', os: 'windows-latest', platform: 'D3D9' }
|
||||
- { name: 'Windows (GL3, glfw)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
|
||||
- { name: 'Windows (GL3, SDL2)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
|
||||
- { name: 'Windows (null)', os: 'windows-latest', platform: 'NULL' }
|
||||
- { name: 'macOS (GL3, glfw)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
|
||||
- { name: 'macOS (GL3, SDL2)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
|
||||
- { name: 'macOS (null)', os: 'macos-latest', platform: 'NULL' }
|
||||
- { name: 'Ubuntu (GL3, glfw)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
|
||||
- { name: 'Ubuntu (GL3, SDL2)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
|
||||
- { name: 'Ubuntu (null)', os: 'ubuntu-latest', platform: 'NULL' }
|
||||
- { name: 'PlayStation 2', os: 'ubuntu-latest', platform: 'PS2', ps2: true, container: 'ps2dev/ps2dev:latest', cmake-toolchain-file: 'cmake/ps2/cmaketoolchain/toolchain_ps2_ee.cmake' }
|
||||
- { name: 'Nintendo Switch', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'GLFW', glfw-nobuild: true, container: 'devkitpro/devkita64:latest', cmake-toolchain-file: '/opt/devkitpro/cmake/Switch.cmake' }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: 'Install PS2 dependencies'
|
||||
if: ${{ matrix.case.ps2 }}
|
||||
run: |
|
||||
apk add cmake gmp mpc1 mpfr4 make pkgconf git
|
||||
- name: 'Setup SDL2'
|
||||
if: ${{ matrix.case.gl3_gfxlib == 'SDL2' }}
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
with:
|
||||
version: 2-latest
|
||||
install-linux-dependencies: true
|
||||
cmake-toolchain-file: ${{ matrix.case.cmake-toolchain-file }}
|
||||
- name: 'Setup GLFW'
|
||||
if: ${{ matrix.case.gl3_gfxlib == 'GLFW' && !matrix.case.glfw-nobuild }}
|
||||
shell: sh
|
||||
run: |
|
||||
${{ (runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install -y libwayland-dev libxkbcommon-dev xorg-dev') || '' }}
|
||||
git clone "https://github.com/glfw/glfw.git" glfw-source --depth 1
|
||||
cmake -S glfw-source -B glfw-build -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_INSTALL=ON -DCMAKE_INSTALL_PREFIX=glfw-prefix -DCMAKE_TOOLCHAIN_FILE="${{ matrix.case.cmake-toolchain-file }}" -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build glfw-build --config Release
|
||||
cmake --install glfw-build --config Release
|
||||
echo "glfw3_ROOT=${{ github.workspace}}/glfw-prefix" >${GITHUB_ENV}
|
||||
- name: 'Configure (CMake)'
|
||||
shell: sh
|
||||
run: |
|
||||
cmake -S . -B build \
|
||||
-DLIBRW_PLATFORM=${{ matrix.case.platform }} \
|
||||
-DLIBRW_GL3_GFXLIB=${{ matrix.case.gl3_gfxlib }} \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.case.cmake-toolchain-file }} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW
|
||||
- name: 'Build (CMake)'
|
||||
run: |
|
||||
cmake --build build --config Release --verbose
|
||||
- name: 'Create binary package (CPack)'
|
||||
run: |
|
||||
cd build
|
||||
cpack . -C Release
|
||||
- name: 'Archive binary package (GitHub artifacts)'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.case.os }}-${{ matrix.case.platform }}${{ (matrix.case.gl3_gfxlib != '' && format('-{0}', matrix.case.gl3_gfxlib)) || '' }}
|
||||
path: build/*.tar.xz
|
||||
if-no-files-found: error
|
132
conanfile.py
132
conanfile.py
|
@ -1,132 +0,0 @@
|
|||
from conans import ConanFile, CMake, tools
|
||||
from conans.errors import ConanException, ConanInvalidConfiguration
|
||||
import os
|
||||
import shutil
|
||||
import textwrap
|
||||
|
||||
|
||||
class LibrwConan(ConanFile):
|
||||
name = "librw"
|
||||
version = "master"
|
||||
license = "MIT"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package"
|
||||
options = {
|
||||
"platform": ["null", "gl3", "d3d9", "ps2"],
|
||||
"gl3_gfxlib": ["glfw", "sdl2"],
|
||||
}
|
||||
default_options = {
|
||||
"platform": "gl3",
|
||||
"gl3_gfxlib": "glfw",
|
||||
"openal:with_external_libs": False,
|
||||
"sdl2:vulkan": False,
|
||||
"sdl2:opengl": True,
|
||||
"sdl2:sdl2main": True,
|
||||
}
|
||||
no_copy_source = True
|
||||
|
||||
@property
|
||||
def _os_is_playstation2(self):
|
||||
try:
|
||||
return self.settings.os == "Playstation2"
|
||||
except ConanException:
|
||||
return False
|
||||
|
||||
def config_options(self):
|
||||
if self._os_is_playstation2:
|
||||
self.options.platform = "ps2"
|
||||
if self.settings.os == "Windows":
|
||||
self.options.platform = "d3d9"
|
||||
self.options["sdl2"].directx = False
|
||||
|
||||
def configure(self):
|
||||
if self.options.platform != "gl3":
|
||||
del self.options.gl3_gfxlib
|
||||
|
||||
def validate(self):
|
||||
if self.options.platform == "d3d9" and self.settings.os != "Windows":
|
||||
raise ConanInvalidConfiguration("platform=d3d9 can only be built for os=Windows")
|
||||
if self._os_is_playstation2:
|
||||
if self.options.platform not in ("null", "ps2"):
|
||||
raise ConanInvalidConfiguration("os=Playstation2 only supports platform=(null,ps2)")
|
||||
|
||||
def requirements(self):
|
||||
if self.options.platform == "gl3":
|
||||
if self.options.gl3_gfxlib == "glfw":
|
||||
self.requires("glfw/3.3.7")
|
||||
elif self.options.gl3_gfxlib == "sdl2":
|
||||
self.requires("sdl/2.0.20")
|
||||
|
||||
def export_sources(self):
|
||||
for d in ("cmake", "skeleton", "src", "tools"):
|
||||
shutil.copytree(src=d, dst=os.path.join(self.export_sources_folder, d))
|
||||
self.copy("args.h")
|
||||
self.copy("rw.h")
|
||||
self.copy("CMakeLists.txt")
|
||||
self.copy("LICENSE")
|
||||
|
||||
@property
|
||||
def _librw_platform(self):
|
||||
return {
|
||||
"null": "NULL",
|
||||
"gl3": "GL3",
|
||||
"d3d9": "D3D9",
|
||||
"ps2": "PS2",
|
||||
}[str(self.options.platform)]
|
||||
|
||||
def build(self):
|
||||
if self.source_folder == self.build_folder:
|
||||
raise Exception("cannot build with source_folder == build_folder")
|
||||
if self.options.platform == "gl3" and self.options.gl3_gfxlib == "glfw":
|
||||
tools.save("Findglfw3.cmake",
|
||||
textwrap.dedent(
|
||||
"""
|
||||
if(NOT TARGET glfw)
|
||||
message(STATUS "Creating glfw TARGET")
|
||||
add_library(glfw INTERFACE IMPORTED)
|
||||
set_target_properties(glfw PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES CONAN_PKG::glfw)
|
||||
endif()
|
||||
"""), append=True)
|
||||
tools.save("CMakeLists.txt",
|
||||
textwrap.dedent(
|
||||
"""
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(cmake_wrapper)
|
||||
|
||||
include("{}/conanbuildinfo.cmake")
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory("{}" librw)
|
||||
""").format(self.install_folder.replace("\\", "/"),
|
||||
self.source_folder.replace("\\", "/")))
|
||||
cmake = CMake(self)
|
||||
env = {}
|
||||
cmake.definitions["LIBRW_PLATFORM"] = self._librw_platform
|
||||
cmake.definitions["LIBRW_INSTALL"] = True
|
||||
cmake.definitions["LIBRW_TOOLS"] = True
|
||||
if self.options.platform == "gl3":
|
||||
cmake.definitions["LIBRW_GL3_GFXLIB"] = str(self.options.gl3_gfxlib).upper()
|
||||
if self._os_is_playstation2:
|
||||
env["PS2SDK"] = self.deps_cpp_info["ps2dev-ps2sdk"].rootpath
|
||||
with tools.environment_append(env):
|
||||
cmake.configure(source_folder=self.build_folder)
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.includedirs.append(os.path.join("include", "librw"))
|
||||
self.cpp_info.libs = ["librw" if self.settings.compiler == "Visual Studio" else "rw"]
|
||||
if self.options.platform == "null":
|
||||
self.cpp_info.defines.append("RW_NULL")
|
||||
elif self.options.platform == "gl3":
|
||||
self.cpp_info.defines.append("RW_GL3")
|
||||
if self.options.gl3_gfxlib == "sdl2":
|
||||
self.cpp_info.defines.append("LIBRW_SDL2")
|
||||
elif self.options.platform == "d3d9":
|
||||
self.cpp_info.defines.append("RW_D3D9")
|
||||
elif self.options.platform == "ps2":
|
||||
self.cpp_info.defines.append("RW_PS2")
|
Loading…
Reference in New Issue