Skip to content

Commit 895556f

Browse files
authored
Merge pull request #135 from madebr/update-202408
Get rid of conan, update imgui, and merge all workflows
2 parents a6139bc + a85292e commit 895556f

26 files changed

+22184
-9698
lines changed

.github/workflows/build-cmake-conan.yml

-57
This file was deleted.

.github/workflows/build-ps2.yml

-29
This file was deleted.

.github/workflows/build-switch.yml

-26
This file was deleted.

.github/workflows/build.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
push:
5+
release:
6+
types: published
7+
jobs:
8+
build-cmake:
9+
name: ${{ matrix.case.name }}
10+
runs-on: ${{ matrix.case.os }}
11+
container: ${{ matrix.case.container }}
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
case:
17+
- { name: 'Windows (DirectX 9)', os: 'windows-latest', platform: 'D3D9' }
18+
- { name: 'Windows (GL3, glfw)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
19+
- { name: 'Windows (GL3, SDL2)', os: 'windows-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
20+
- { name: 'Windows (null)', os: 'windows-latest', platform: 'NULL' }
21+
- { name: 'macOS (GL3, glfw)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
22+
- { name: 'macOS (GL3, SDL2)', os: 'macos-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
23+
- { name: 'macOS (null)', os: 'macos-latest', platform: 'NULL' }
24+
- { name: 'Ubuntu (GL3, glfw)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'GLFW' }
25+
- { name: 'Ubuntu (GL3, SDL2)', os: 'ubuntu-latest', platform: 'GL3', gl3_gfxlib: 'SDL2' }
26+
- { name: 'Ubuntu (null)', os: 'ubuntu-latest', platform: 'NULL' }
27+
- { name: 'PlayStation 2', os: 'ubuntu-latest', platform: 'PS2', ps2: true, container: 'ps2dev/ps2dev:latest', cmake-toolchain-file: 'cmake/ps2/cmaketoolchain/toolchain_ps2_ee.cmake' }
28+
- { 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' }
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v4
33+
with:
34+
python-version: '3.x'
35+
- name: 'Install PS2 dependencies'
36+
if: ${{ matrix.case.ps2 }}
37+
run: |
38+
apk add cmake gmp mpc1 mpfr4 make pkgconf git
39+
- name: 'Setup SDL2'
40+
if: ${{ matrix.case.gl3_gfxlib == 'SDL2' }}
41+
uses: libsdl-org/setup-sdl@main
42+
with:
43+
version: 2-latest
44+
install-linux-dependencies: true
45+
cmake-toolchain-file: ${{ matrix.case.cmake-toolchain-file }}
46+
- name: 'Setup GLFW'
47+
if: ${{ matrix.case.gl3_gfxlib == 'GLFW' && !matrix.case.glfw-nobuild }}
48+
shell: sh
49+
run: |
50+
${{ (runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install -y libwayland-dev libxkbcommon-dev xorg-dev') || '' }}
51+
git clone "https://github.com/glfw/glfw.git" glfw-source --depth 1
52+
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
53+
cmake --build glfw-build --config Release
54+
cmake --install glfw-build --config Release
55+
echo "glfw3_ROOT=${{ github.workspace}}/glfw-prefix" >${GITHUB_ENV}
56+
- name: 'Configure (CMake)'
57+
shell: sh
58+
run: |
59+
cmake -S . -B build \
60+
-DLIBRW_PLATFORM=${{ matrix.case.platform }} \
61+
-DLIBRW_GL3_GFXLIB=${{ matrix.case.gl3_gfxlib }} \
62+
-DCMAKE_TOOLCHAIN_FILE=${{ matrix.case.cmake-toolchain-file }} \
63+
-DCMAKE_BUILD_TYPE=Release \
64+
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW
65+
- name: 'Build (CMake)'
66+
run: |
67+
cmake --build build --config Release --verbose
68+
- name: 'Create binary package (CPack)'
69+
run: |
70+
cd build
71+
cpack . -C Release
72+
- name: 'Archive binary package (GitHub artifacts)'
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: ${{ matrix.case.os }}-${{ matrix.case.platform }}${{ (matrix.case.gl3_gfxlib != '' && format('-{0}', matrix.case.gl3_gfxlib)) || '' }}
76+
path: build/*.tar.xz
77+
if-no-files-found: error

CMakeLists.txt

+10-8
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,24 @@ else()
3030
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL ON)
3131
endif()
3232
list(GET LIBRW_PLATFORMS 0 LIBRW_PLATFORM_DEFAULT)
33-
set(LIBRW_PLATFORM "${LIBRW_PLATFORM_DEFAULT}" CACHE STRING "Platform")
33+
set(LIBRW_PLATFORM "${LIBRW_PLATFORM_DEFAULT}" CACHE STRING "Platform (choices=${LIBRW_PLATFORMS})")
3434
set_property(CACHE LIBRW_PLATFORM PROPERTY STRINGS ${LIBRW_PLATFORMS})
3535
message(STATUS "LIBRW_PLATFORM = ${LIBRW_PLATFORM} (choices=${LIBRW_PLATFORMS})")
3636
set("LIBRW_PLATFORM_${LIBRW_PLATFORM}" ON)
3737
if(NOT LIBRW_PLATFORM IN_LIST LIBRW_PLATFORMS)
3838
message(FATAL_ERROR "Illegal LIBRW_PLATFORM=${LIBRW_PLATFORM}")
3939
endif()
4040

41-
set(LIBRW_GL3_GFXLIBS "GLFW" "SDL2")
42-
set(LIBRW_GL3_GFXLIB "GLFW" CACHE STRING "gfxlib for gl3")
43-
set_property(CACHE LIBRW_GL3_GFXLIB PROPERTY STRINGS ${LIBRW_GL3_GFXLIBS})
4441
if(LIBRW_PLATFORM_GL3)
45-
message(STATUS "LIBRW_GL3_GFXLIB = ${LIBRW_GL3_GFXLIB} (choices=${LIBRW_GL3_GFXLIBS})")
46-
endif()
47-
if(NOT LIBRW_GL3_GFXLIB IN_LIST LIBRW_GL3_GFXLIBS)
48-
message(FATAL_ERROR "Illegal LIBRW_GL3_GFXLIB=${LIBRW_GL3_GFXLIB}")
42+
set(LIBRW_GL3_GFXLIBS "GLFW" "SDL2")
43+
set(LIBRW_GL3_GFXLIB "GLFW" CACHE STRING "gfxlib for gl3 (choices=${LIBRW_GL3_GFXLIBS})")
44+
set_property(CACHE LIBRW_GL3_GFXLIB PROPERTY STRINGS ${LIBRW_GL3_GFXLIBS})
45+
if(LIBRW_PLATFORM_GL3)
46+
message(STATUS "LIBRW_GL3_GFXLIB = ${LIBRW_GL3_GFXLIB} (choices=${LIBRW_GL3_GFXLIBS})")
47+
endif()
48+
if(NOT LIBRW_GL3_GFXLIB IN_LIST LIBRW_GL3_GFXLIBS)
49+
message(FATAL_ERROR "Illegal LIBRW_GL3_GFXLIB=${LIBRW_GL3_GFXLIB}")
50+
endif()
4951
endif()
5052

5153
if(LIBRW_PLATFORM_PS2)

cmake/librw-config.cmake.in

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ if(LIBRW_PLATFORM_GL3)
2020
endif()
2121
elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2")
2222
if (NOT TARGET SDL2::SDL2)
23-
find_package(SDL2 REQUIRED)
23+
find_package(SDL2 CONFIG)
24+
if (NOT TARGET SDL2::SDL2)
25+
find_package(SDL2 MODULE REQUIRED)
26+
endif()
2427
endif()
2528
endif()
2629
endif()

conanfile.py

-132
This file was deleted.

skeleton/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_library(librw_skeleton
2424
imgui/ImGuizmo.h
2525
)
2626
add_library(librw::skeleton ALIAS librw_skeleton)
27+
target_compile_features(librw_skeleton PUBLIC cxx_std_11)
2728

2829
set_target_properties(librw_skeleton
2930
PROPERTIES
@@ -37,6 +38,10 @@ target_link_libraries(librw_skeleton
3738
librw
3839
)
3940

41+
if (LIBRW_GL3_GFXLIB STREQUAL "SDL2")
42+
target_compile_definitions(librw_skeleton PRIVATE SDL_MAIN_HANDLED)
43+
endif()
44+
4045
target_include_directories(librw_skeleton
4146
PUBLIC
4247
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

0 commit comments

Comments
 (0)