Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
647ee0d
Use proper pointer for addr in DRAW_GLYPH
mlt Jan 18, 2025
5f6ec41
Use intptr_t for _findfirst handle
mlt Feb 12, 2025
faca9ab
Fix some types to match Win API
pedro-w Feb 25, 2021
47202ce
Backport Allegro version info and exports
mlt Feb 19, 2025
e36ce1d
wip
mlt Sep 25, 2025
9068eba
GH workflow
mlt Oct 27, 2025
5cd34fb
Do not mangle main for logg examples
mlt Oct 28, 2025
1d57ce3
Set scr suffix directly as CMake target property for scrsave
mlt Oct 28, 2025
1b1ad4d
Bump required CMake version to match a5
mlt Oct 28, 2025
e200e54
Compile definitions to produce & consume addon DLLs
mlt Oct 28, 2025
7b4b413
Rename some addons/loadpng/examples to prevent Ninja conflicts
mlt Oct 28, 2025
2d55f65
Add STRICT for callback pointer casts
mlt Oct 28, 2025
e53eaaa
Move OpenGL detection higher and use imported CMake target
mlt Oct 28, 2025
e2d6ff6
Fix pointer truncation in title.c of shooter demo
mlt Nov 26, 2025
70ca753
Explicit pointer widening on x86 in unicode.c
mlt Nov 26, 2025
4fa0dac
Fix pointer truncation in datitype.c grabber plugin
mlt Nov 26, 2025
3eb8b0e
Explicit widening w/ SystemParametersInfo in allegrogl/src/win.c
mlt Nov 26, 2025
4fbdb68
Fix pointer truncation in grabber.c
mlt Nov 26, 2025
8c52be0
Cross compilation test on GH w/ vcpkg
mlt Nov 27, 2025
deb17f8
fixup! wip
mlt Nov 28, 2025
7d25139
Proper cases in CMake find_package helpers to reduce noise
mlt Nov 28, 2025
0083a07
test
mlt Nov 28, 2025
c3706e7
fixup! xc
mlt Nov 28, 2025
944e6da
fixup! GH
mlt Nov 30, 2025
505be6f
PSP toolchain repeats itself 3 times
mlt Nov 30, 2025
1d7d649
more
mlt Nov 30, 2025
1dff6fa
fixup! more
mlt Nov 30, 2025
dce55f0
[psp] define ALLEGRO_NO_STRICMP
mlt Nov 30, 2025
1908987
[psp] Use AL_VAR for displayed_video_bitmap
mlt Nov 30, 2025
0960b4d
fixup! more
mlt Nov 30, 2025
4da21a3
fixup! more
mlt Dec 2, 2025
c153d42
[psp] CMake somehow fails to emit -L flag. Why???
mlt Dec 2, 2025
4c398a6
Haiku OS fixups
mlt Dec 2, 2025
79073d7
fixup! more
mlt Dec 2, 2025
8547365
fixup! GH workflow
mlt Dec 2, 2025
aa03843
fixup! more
mlt Dec 2, 2025
c6c095f
[psp] Change libraries order
mlt Dec 2, 2025
7215741
[psp] -G0 is not used anymore
mlt Dec 2, 2025
23d1d66
[psp] Implement SYSTEM_DRIVER methods for mutex
mlt Dec 3, 2025
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
21 changes: 21 additions & 0 deletions .github/workflows/haiku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Haiku

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 💳 Check out repository code
uses: actions/checkout@v4
- name: ⚒️ Build on Haiku
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: haiku
version: r1beta5
sync_files: runner-to-vm
memory: 2G
run: |
pkgman install -y cmake ninja glu_devel libvorbis_devel
cmake . -B build --preset=ci-gcc
cmake --build build --preset ninja-quiet
20 changes: 20 additions & 0 deletions .github/workflows/psp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PSP

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
container:
image: pspdev/pspdev:latest
volumes:
- ${{ github.workspace }}:/src
steps:
- name: 🎮 Setup tools
run: apk add ninja-build
- name: 💳 Check out repository code
uses: actions/checkout@v4
- name: ⚒️ Build with gcc
run: |
cmake . -B build --preset=ci-psp
cmake --build build --preset ninja-quiet
89 changes: 89 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Tests

on: [push, pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
arch: [x64, x86]
include:
- os: ubuntu-latest
arch: x64
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- name: 💳 Check out repository code
uses: actions/checkout@v4
- name: 💾 Cache dependencies on Windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
C:\msys64\var\cache\pacman\pkg
C:\vcpkg\installed
key: build-dep-windows-${{ matrix.arch }}
- name: 🐧 Install dependencies on Linux
if: runner.os == 'Linux'
run: >-
sudo apt-get install -qq -y -o=Dpkg::Use-Pty=0
cmake
pkgconf
libx11-dev
libasound2-dev
libxxf86dga-dev
libjack-dev
libgl-dev
libglu-dev
libpng-dev
zlib1g-dev
libvorbis-dev
- name: 🪟 Set up environment variables on Windows
env:
MSYSTEM: ${{ matrix.arch == 'x64' && 'MINGW64' || 'MINGW32' }}
if: runner.os == 'Windows'
run: |
echo "VCPKG_ROOT=C:/vcpkg" >> $GITHUB_ENV
echo "MSYSTEM=${{ env.MSYSTEM }}" >> $GITHUB_ENV
- name: 🪟 Install dependencies on Windows
if: runner.os == 'Windows'
shell: pwsh
run: vcpkg install --triplet ${{ matrix.arch }}-windows libvorbis libpng
- name: ⚒️ Build with Visual Studio on Windows
env:
sdkPath: "C:/Program Files (x86)/Windows Kits/10"
sdkVer: "10.0.26100.0"
arch: ${{ matrix.arch }}
shell: pwsh
if: ${{ runner.os == 'Windows' && !cancelled() }}
run: |
cmake . -B build_vs -A ${{ matrix.arch == 'x64' && 'x64' || 'Win32' }} --preset=ci-vs
cmake --build build_vs --config Debug -- /verbosity:quiet
- name: 🔍 Add MSYS2 to path on Windows
if: ${{ runner.os == 'Windows' && !cancelled() }}
shell: pwsh
run: |
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\${{ matrix.arch == 'x64' && 'mingw64' || 'mingw32' }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: 🪟 Install msys2 dependencies on Windows
env:
arch: ${{ matrix.arch == 'x64' && 'x86_64' || 'i686' }}
if: ${{ runner.os == 'Windows' && !cancelled() }}
run: >-
pacman --noconfirm -S
mingw-w64-${{ env.arch }}-gcc
mingw-w64-${{ env.arch }}-ninja
mingw-w64-${{ env.arch }}-cmake
mingw-w64-${{ env.arch }}-libpng
mingw-w64-${{ env.arch }}-libvorbis
- name: ⚒️ Build with gcc
env:
MINGDIR: "C:/msys64/${{ matrix.arch == 'x64' && 'mingw64' || 'mingw32' }}"
if: ${{ !cancelled() }}
run: |
cmake . -B build --preset=ci-gcc
cmake --build build --preset=ninja-quiet
30 changes: 30 additions & 0 deletions .github/workflows/xc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Cross compilation

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 💳 Check out repository code
uses: actions/checkout@v4
- name: 🐧 Setup
run: >-
sudo apt-get install -qq -y -o=Dpkg::Use-Pty=0
mingw-w64-x86-64-dev
binutils-mingw-w64-x86-64
gcc-mingw-w64-x86-64-win32
g++-mingw-w64-x86-64-win32
- name: 💾 Cache vcpkg dependencies
uses: actions/cache@v4
with:
path: /usr/local/share/vcpkg/installed
key: vcpkg-installed
- name: 🌳 Install dependencies
run: |
echo VCPKG_ROOT=/usr/local/share/vcpkg >> $GITHUB_ENV
vcpkg install --triplet=x64-mingw-dynamic libpng libvorbis
- name: ⚒️ Build with gcc
run: |
cmake . -B build --preset=ci-xc
cmake --build build --preset ninja-quiet
113 changes: 95 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# CMake setup
#

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12...4.0)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0048 NEW)
endif(COMMAND cmake_policy)

if(NOT CMAKE_BUILD_TYPE)
Expand All @@ -37,13 +38,41 @@ endif()
# Note: This needs to be done before the project command
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE INTERNAL "internal")

#-----------------------------------------------------------------------------#
#
# Version
#
#-----------------------------------------------------------------------------#

set(ALLEGRO_VERSION_REGEX_PATTERN "#define ALLEGRO_VERSION_STR[ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"")
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/allegro/base.h" ALLEGRO_VERSION_MATCH
REGEX ${ALLEGRO_VERSION_REGEX_PATTERN}
LIMIT_COUNT 1
)
string(REGEX REPLACE ${ALLEGRO_VERSION_REGEX_PATTERN} "\\1" ALLEGRO_VERSION "${ALLEGRO_VERSION_MATCH}")
if("${ALLEGRO_VERSION}" VERSION_LESS 5.0.0)
message(STATUS "[Allegro] Allegro Version: [${ALLEGRO_VERSION}]")
else()
message(FATAL_ERROR "[Allegro] Invalid Allegro Version: [${ALLEGRO_VERSION}]")
endif()

#-----------------------------------------------------------------------------#
#
# Build options
#

# Set the project name.
project(ALLEGRO C CXX)

# Allow generating custom project name via command-line arguments (#1174)
set(ALLEGRO_PROJECT_NAME "ALLEGRO" CACHE STRING "Project default name")
set(ALLEGRO_PROJECT_SUFFIX "" CACHE STRING "Project suffix")

project(${ALLEGRO_PROJECT_NAME}${ALLEGRO_PROJECT_SUFFIX}
VERSION ${ALLEGRO_VERSION}
LANGUAGES C CXX
DESCRIPTION "Allegro project"
HOMEPAGE_URL "https://github.com/liballeg/allegro4"
)

if(WIN32)
if(MINGW)
Expand Down Expand Up @@ -291,12 +320,14 @@ if(APPLE)
endif(COMPILER_GCC)
endif(APPLE)

if(CMAKE_SYSTEM_NAME STREQUAL Haiku)
set(ALLEGRO_HAIKU 1)
set(BEOS 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL BeOS)
set(ALLEGRO_BEOS 1)
set(BEOS 1)
endif(CMAKE_SYSTEM_NAME STREQUAL Haiku)
if(BEOS)
if(CMAKE_SYSTEM_NAME STREQUAL Haiku)
set(ALLEGRO_HAIKU 1)
else(CMAKE_SYSTEM_NAME STREQUAL Haiku)
set(ALLEGRO_BEOS 1)
endif(CMAKE_SYSTEM_NAME STREQUAL Haiku)
set(WFLAGS "-W -Wall -Wno-unused -Wno-multichar")
set(WFLAGS_C_ONLY "")
set(WFLAGS_CXX_ONLY "-Wno-ctor-dtor-privacy")
Expand All @@ -308,8 +339,7 @@ endif()

if(PSP)
set(ALLEGRO_PSP 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -G0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -G0 -fno-exceptions -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif(PSP)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WFLAGS} ${WFLAGS_C_ONLY}")
Expand Down Expand Up @@ -695,10 +725,8 @@ endif(ALLEGRO_MACOSX)

if(PSP)
include_directories(SYSTEM ${PSPSDK_PATH}/include)
link_directories(${PSPSDK_PATH}/lib)
add_link_options("-L${PSPSDK_PATH}/lib")
list(APPEND PLATFORM_SOURCES ${ALLEGRO_SRC_PSP_FILES})
list(APPEND PLATFORM_LIBS
m pspaudio pspgu psprtc pspdebug pspdisplay pspge pspctrl pspsdk c pspnet pspnet_inet pspnet_resolver psputility pspuser pspkernel)
endif(PSP)

#-----------------------------------------------------------------------------#
Expand Down Expand Up @@ -844,6 +872,8 @@ set_target_properties(allegro
static_link_with "${static_link_with}"
)

set(PKG_TARGETS_NAME "${PKG_NAME}Targets")

install_our_library(allegro)
if(NOT WANT_FRAMEWORKS)
install_our_headers(${ALLEGRO_PUBLIC_HEADERS})
Expand Down Expand Up @@ -871,7 +901,7 @@ if(PSP)
OUTPUT_NAME alleg-main${BUILD_TYPE_SUFFIX}
COMPILE_FLAGS -DALLEGRO_SRC
)
target_link_libraries(alleg-main pspuser pspkernel)
target_link_libraries(alleg-main INTERFACE c pspaudio pspdisplay pspctrl pspdebug pspgu pspge)
target_link_libraries(allegro alleg-main)
install_our_library(alleg-main)
endif(PSP)
Expand All @@ -881,15 +911,15 @@ endif(PSP)
# allegro-config script
#

if(UNIX) # including MACOSX
if(UNIX OR MSYS OR MINGW) # including MACOSX
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(INCLUDE_PREFIX "${CMAKE_INSTALL_PREFIX}") # not sure what this is
if(BUILD_SHARED_LIBS)
set(LINK_WITH_STATIC_LIBS no)
else()
set(LINK_WITH_STATIC_LIBS yes)
endif()
set(LIB_TO_LINK alleg${BUILD_TYPE_SUFFIX})
set(LIB_TO_LINK ${allegro_OUTPUT_NAME}${BUILD_TYPE_SUFFIX})
if(APPLE)
set(LDFLAGS "-framework Cocoa -lalleg-main")
else(APPLE)
Expand Down Expand Up @@ -923,7 +953,7 @@ if(UNIX) # including MACOSX
install(PROGRAMS ${CMAKE_BINARY_DIR}/allegro-config
DESTINATION bin
)
endif(UNIX)
endif(UNIX OR MSYS OR MINGW)

#-----------------------------------------------------------------------------#
#
Expand All @@ -947,6 +977,7 @@ endif()


if(WANT_ALLEGROGL)
find_package(OpenGL)
add_subdirectory(addons/allegrogl)
endif()
if(WANT_LOADPNG)
Expand All @@ -972,7 +1003,7 @@ set(PKG_CONFIG_FILES
logg
)

if(UNIX)
if(UNIX OR MSYS)
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(INCLUDE_PREFIX "\${prefix}")
set(bindir "\${exec_prefix}/bin")
Expand All @@ -997,7 +1028,53 @@ if(UNIX)
DESTINATION "lib${LIB_SUFFIX}/pkgconfig"
)
endforeach(name)
endif(UNIX)
endif(UNIX OR MSYS)

set(ALLEGRO_TARGETS ${PKG_CONFIG_FILES})
# Generate CMake package-config files
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

set(PKG_NAME "Allegro")
string(TOLOWER ${PKG_NAME} PKG_NAME_LOWER)

set(PKG_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PKG_NAME_LOWER}4")
set(PKG_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake")
set(PKG_CONFIG_FILE "${PKG_GENERATED_DIR}/${PKG_NAME}Config.cmake")
set(PKG_VERSION_FILE "${PKG_GENERATED_DIR}/${PKG_NAME}ConfigVersion.cmake")

configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/cmake/${PKG_NAME}Config.cmake.in"
${PKG_CONFIG_FILE}
INSTALL_DESTINATION ${PKG_CONFIG_INSTALL_DIR}
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(${PKG_VERSION_FILE}
VERSION ${ALLEGRO_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
EXPORT ${PKG_TARGETS_NAME}
NAMESPACE ${PKG_NAME}::
DESTINATION ${PKG_CONFIG_INSTALL_DIR}
)
install(
FILES ${PKG_CONFIG_FILE} ${PKG_VERSION_FILE}
DESTINATION ${PKG_CONFIG_INSTALL_DIR}
)

# Export build tree for debugging

target_include_directories(allegro INTERFACE
$<BUILD_INTERFACE:include;${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)

export(EXPORT ${PKG_TARGETS_NAME}
FILE "${PKG_GENERATED_DIR}/${PKG_NAME}Targets.cmake"
NAMESPACE ${PKG_NAME}::
)

#-----------------------------------------------------------------------------#
#
Expand Down
Loading