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
8 changes: 7 additions & 1 deletion .github/workflows/cmakeAndroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ jobs:
sudo apt-get update
sudo apt-get install g++ libcurl4-gnutls-dev libfreetype6-dev libgif-dev libjpeg-dev libpixman-1-dev libpng-dev libsdl2-dev libsdl2-image-dev libtinyxml2-dev libx11-dev libxcursor-dev ninja-build zlib1g-dev libarchive-dev
pip install cmake
SHORT_HASH=$(git rev-parse --short HEAD)
sed -i "s/\"local build\"/\"$SHORT_HASH\"/g" src/config.h
mkdir build
cd build
cmake -G Ninja -DGEN_ONLY=ON ..
if git describe --exact-match --tags 2>/dev/null; then
cmake -G Ninja -DGEN_ONLY=ON -DRELEASE_TAG=ON ..
else
cmake -G Ninja -DGEN_ONLY=ON ..
fi
ninja
cd ..
- name: Setup Submodule
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/cmakeLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,31 @@ jobs:
run: git submodule update --init --recursive
- name: mkdir
run: mkdir build
- name: check for git tag
id: check_tag
run: |
if git describe --exact-match --tags 2>/dev/null; then
echo "has_tag=true" >> $GITHUB_OUTPUT
else
echo "has_tag=false" >> $GITHUB_OUTPUT
fi
- name: Get short commit hash
id: commit
run: |
SHORT_HASH=$(git rev-parse --short HEAD)
echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT
- name: Update config.h with commit hash
run: |
sed -i 's/"local build"/"${{ steps.commit.outputs.short_hash }}"/g' src/config.h
- name: cmake
run: cd build && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. && ninja besprited
run: |
cd build
if [ "${{ steps.check_tag.outputs.has_tag }}" = "true" ]; then
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DRELEASE_TAG=ON ..
else
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
fi
ninja besprited
- name: appimage
run: |
cd build/bin
Expand Down
32 changes: 28 additions & 4 deletions .github/workflows/cmakeMacOs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,36 @@ jobs:
- name: Download & Lint Info.plist
run: |
plutil desktop/Info.plist
- name: Check for git tag
id: check_tag
run: |
if git describe --exact-match --tags 2>/dev/null; then
echo "has_tag=true" >> $GITHUB_OUTPUT
else
echo "has_tag=false" >> $GITHUB_OUTPUT
fi
- name: Get short commit hash
id: commit
run: |
SHORT_HASH=$(git rev-parse --short HEAD)
echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT
- name: Update config.h with commit hash
run: |
sed -i '' 's/"local build"/"${{ steps.commit.outputs.short_hash }}"/g' src/config.h
- name: Generate Makefiles
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DUSE_V8_SANDBOX=ON \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
if [ "${{ steps.check_tag.outputs.has_tag }}" = "true" ]; then
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DUSE_V8_SANDBOX=ON \
-DRELEASE_TAG=ON \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
else
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DUSE_V8_SANDBOX=ON \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
fi
- name: Build
run: |
cmake --build build/ --parallel 3
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/cmakeWin64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,34 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Check for git tag
id: check_tag
shell: bash
run: |
if git describe --exact-match --tags 2>/dev/null; then
echo "has_tag=true" >> $GITHUB_OUTPUT
else
echo "has_tag=false" >> $GITHUB_OUTPUT
fi
- name: Get short commit hash
id: commit
shell: bash
run: |
SHORT_HASH=$(git rev-parse --short HEAD)
echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT
- name: Update config.h with commit hash
shell: bash
run: |
sed -i 's/#define COMMIT "local build"/#define COMMIT "${{ steps.commit.outputs.short_hash }}"/g' src/config.h
- shell: msys2 {0}
run: |
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_V8_SANDBOX=ON ..
if [ "${{ steps.check_tag.outputs.has_tag }}" = "true" ]; then
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_V8_SANDBOX=ON -DRELEASE_TAG=ON ..
else
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_V8_SANDBOX=ON ..
fi
make -j 4
cd ..
rm build/bin/gen.exe
Expand Down
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Put libraries into "lib".
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

######################################################################
# Check if current commit has a git tag (for release builds)

option(RELEASE_TAG "Mark as release build (set VERSION to stable)" off)

if(NOT RELEASE_TAG)
# Try to detect if current commit has a tag
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
RESULT_VARIABLE GIT_TAG_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(GIT_TAG_RESULT EQUAL 0 AND GIT_TAG)
message(STATUS "Git tag found: ${GIT_TAG}")
set(RELEASE_TAG ON CACHE BOOL "Mark as release build (set VERSION to stable)" FORCE)
endif()
endif()
endif()

if(RELEASE_TAG)
message(STATUS "Building as RELEASE version")
add_definitions(-DRELEASE_TAG)
else()
message(STATUS "Building as DEVELOPMENT version")
endif()

######################################################################
# Common definitions to compile all sources (app code and third party)

Expand Down
11 changes: 9 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@

// General information
#define PACKAGE "Besprited"
#define VERSION "1.0-dev"
#define COMMIT "local build"
#ifndef RELEASE_TAG
#define VERSION "1.0-dev (" COMMIT ")"
#else
#define VERSION "1.0"
#endif
#define PACKAGE_AND_VERSION PACKAGE " " VERSION

#define WEBSITE "https://github.com/Veritaware/Besprited/"
#define WEBSITE_DOWNLOAD WEBSITE "releases/"
#define WEBSITE_CONTRIBUTORS WEBSITE "graphs/contributors/"
#define COPYRIGHT "Copyright (C) 2001-2016 David Capello, 2016-2025 LibreSprite contributors, 2026 Veritaware"
#define COPYRIGHT "Copyright © 2001-2016 David Capello, "\
"2016-2026 LibreSprite contributors, "\
"2026 Veritaware"

#include "base/base.h"
#include "base/debug.h"
Expand Down
Loading