Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Oct 28, 2023
2 parents ea87681 + d53b373 commit 057b6cd
Show file tree
Hide file tree
Showing 43 changed files with 1,059 additions and 119 deletions.
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# https://EditorConfig.org

root = true

[*]
trim_trailing_whitespace = true
insert_final_newline = true

[{CMakeLists.txt,*.cmake,Makefile}]
indent_style = tab
indent_size = 4

[{*.cpp,*.h}]
indent_style = tab
indent_size = 4

[ext/**/{*.cpp,*.h}]
indent_style = ignore
indent_size = ignore

[*.json,*.yml,*.rc,*.adoc]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4

[*.xml]
indent_style = tab
indent_size = 4
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
* text=auto

# source files
*.txt text
*.cpp text
*.h text
CMakeLists.txt text
*.cmake text
*.json text

# distribution archives
/.github export-ignore
24 changes: 7 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -95,19 +94,17 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Build OpenJazz
run: |
cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --workflow --preset release
- name: Prepare artifact
run: |
cmake --install build --prefix $PWD
cmake --install build-release --prefix $PWD
cp /mingw64/bin/SDL2.dll dist/
asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc
w3m -dump -cols 2147483647 -s OpenJazzManual.html > dist/Manual.txt
Expand Down Expand Up @@ -136,15 +133,13 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Build OpenJazz
run: |
export CXXFLAGS="-Wall -g -O2"
$DEVKITPRO/portlibs/wii/bin/powerpc-eabi-cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release
$DEVKITPRO/portlibs/wii/bin/powerpc-eabi-cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
- name: Prepare artifact
Expand Down Expand Up @@ -177,15 +172,13 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Build OpenJazz
run: |
export CXXFLAGS="-Wall -g -O2"
$DEVKITPRO/portlibs/3ds/bin/arm-none-eabi-cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release
$DEVKITPRO/portlibs/3ds/bin/arm-none-eabi-cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
- name: Prepare artifact
Expand Down Expand Up @@ -218,7 +211,6 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Prepare GCCSDK autobuilder and build SDL
run: |
Expand Down Expand Up @@ -263,20 +255,18 @@ jobs:
- name: Prepare Environment
run: |
echo "SHORT_SHA=${GITHUB_SHA:0:10}" >> $GITHUB_ENV
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Build OpenJazz
run: |
export CXXFLAGS="-Wall -g -O2"
psp-cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release -DNETWORK=OFF
cmake --build build
cmake --preset=psp-release -DNETWORK=OFF
cmake --build --preset=psp-release
- name: Prepare artifact
run: |
cmake --install build --prefix $PWD
cmake --install build-psp-release --prefix $PWD
asciidoctor -o OpenJazzManual.html -a oj_version=${SHORT_SHA} res/unix/OpenJazz.6.adoc
w3m -dump -cols 2147483647 -s OpenJazzManual.html > OpenJazz/Manual.txt
cp README.md OpenJazz/README.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CMakeFiles/
!/builds/cmake/*.cmake
ext/Makefile
build.ninja
CMakeUserPresets.json

# homebrew
*.elf
Expand Down
84 changes: 69 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16...3.27)
project(OpenJazz
VERSION 20231027
LANGUAGES CXX
HOMEPAGE_URL http://www.alister.eu/jazz/oj/)
HOMEPAGE_URL http://alister.eu/jazz/oj/)

# Extra CMake Module files

Expand Down Expand Up @@ -71,6 +71,8 @@ add_executable(OpenJazz
src/setup.h
src/util.cpp
src/util.h
src/version.cpp
src/version.h
# episode 1
src/jj1/bonuslevel/jj1bonuslevel.cpp
src/jj1/bonuslevel/jj1bonuslevel.h
Expand Down Expand Up @@ -98,19 +100,7 @@ add_executable(OpenJazz
src/jj1/planet/jj1planet.h
src/jj1/scene/jj1scene.cpp
src/jj1/scene/jj1scene.h
src/jj1/scene/jj1sceneload.cpp
# episode 2
src/jj2/level/event/jj2event.cpp
src/jj2/level/event/jj2event.h
src/jj2/level/event/jj2eventframe.cpp
src/jj2/level/jj2layer.cpp
src/jj2/level/jj2level.cpp
src/jj2/level/jj2level.h
src/jj2/level/jj2levelframe.cpp
src/jj2/level/jj2levelload.cpp
src/jj2/level/jj2levelplayer.cpp
src/jj2/level/jj2levelplayer.h
src/jj2/level/jj2levelplayerframe.cpp)
src/jj1/scene/jj1sceneload.cpp)
target_include_directories(OpenJazz PUBLIC src)

# portable mode
Expand Down Expand Up @@ -192,6 +182,66 @@ elseif(NOT LEGACY_SDL)
set(SCALE_STATUS "Disabled (currently broken in SDL2 port)")
endif()

option(ENABLE_JJ2 "Enable experimental Episode 2 support (not recommended)" OFF)
if(ENABLE_JJ2)
target_sources(OpenJazz PRIVATE
src/jj2/level/event/jj2event.cpp
src/jj2/level/event/jj2event.h
src/jj2/level/event/jj2eventframe.cpp
src/jj2/level/jj2layer.cpp
src/jj2/level/jj2level.cpp
src/jj2/level/jj2level.h
src/jj2/level/jj2levelframe.cpp
src/jj2/level/jj2levelload.cpp
src/jj2/level/jj2levelplayer.cpp
src/jj2/level/jj2levelplayer.h
src/jj2/level/jj2levelplayerframe.cpp)
target_compile_definitions(OpenJazz PRIVATE ENABLE_JJ2)
endif()

# version

string(TIMESTAMP OJ_DATE "%Y-%m-%d")
include(GetGitRevisionDescription)
git_get_exact_tag(GIT_TAG)
# Do not include a hash, if we are building a release tag
if(NOT GIT_TAG)
# otherwise concatenate a version with hash
git_describe(GIT_DESCRIPTION)
if(GIT_DESCRIPTION)
string(REPLACE "-" ";" GIT_DESCRIPTION ${GIT_DESCRIPTION})
list(LENGTH GIT_DESCRIPTION GIT_DESCRIPTION_PARTS)
if(GIT_DESCRIPTION_PARTS EQUAL 3)
list(GET GIT_DESCRIPTION 0 GIT_TAG)
list(GET GIT_DESCRIPTION 1 GIT_COMMITS)
list(GET GIT_DESCRIPTION 2 GIT_HASH)
set(GIT_STATUS "${GIT_COMMITS} commits since tag \"${GIT_TAG}\", ")
string(PREPEND GIT_COMMITS "+")
else()
# no tags found, only hash
list(GET GIT_DESCRIPTION 0 GIT_HASH)
endif()
# strip the g prefix
string(SUBSTRING ${GIT_HASH} 1 -1 GIT_HASH)
set(OJ_VERSION_GIT "git${GIT_COMMITS}@${GIT_HASH}")
string(APPEND GIT_STATUS "object hash is ${GIT_HASH}")
git_local_changes(GIT_DIRTY)
if(GIT_DIRTY STREQUAL "DIRTY")
string(APPEND OJ_VERSION_GIT "-dirty")
string(APPEND GIT_STATUS ", with uncommitted changes")
endif()
endif()
endif()
set_property(SOURCE src/version.cpp PROPERTY COMPILE_DEFINITIONS
OJ_VERSION="${PROJECT_VERSION}"; OJ_DATE="${OJ_DATE}";
$<$<BOOL:${OJ_VERSION_GIT}>:OJ_VERSION_GIT="${OJ_VERSION_GIT}">)

# project links

set(OJ_BUGREPORT "https://github.com/AlisterT/openjazz/issues")
set_property(SOURCE src/main.cpp PROPERTY COMPILE_DEFINITIONS
OJ_URL="${PROJECT_HOMEPAGE_URL}"; OJ_BUGREPORT="${OJ_BUGREPORT}")

target_link_libraries(OpenJazz
argparse miniz psmplug ${OJ_LIBS_SCALE} ${OJ_LIBS_SDL} ${OJ_LIBS_NET} ${OJ_LIBS_HOST})

Expand Down Expand Up @@ -354,6 +404,10 @@ unset(MAN_PATH)
message(STATUS "")
message(STATUS "OpenJazz")
message(STATUS "========")
message(STATUS "Version: ${PROJECT_VERSION}")
if(GIT_STATUS)
message(STATUS "Git status: ${GIT_STATUS}")
endif()
message(STATUS "Target system: ${OJ_HOST}")
message(STATUS "Platform abstraction: ${SDL_STATUS}")
if(ROMFS)
Expand All @@ -367,5 +421,5 @@ endif()
message(STATUS "Manual page: ${MANUAL_STATUS}")
message(STATUS "Portable Engine: ${PORTABLE_STATUS}")
message(STATUS "")
message(STATUS "In case something goes wrong, report bugs to https://github.com/AlisterT/openjazz/issues")
message(STATUS "In case something goes wrong, report bugs to ${OJ_BUGREPORT}")
message(STATUS "")
Loading

0 comments on commit 057b6cd

Please sign in to comment.