Skip to content

Commit

Permalink
Merge pull request #3 from leo60228/chaos-build-fixes
Browse files Browse the repository at this point in the history
Cherry-pick more build fixes from upstream
  • Loading branch information
NyakoFox authored Oct 10, 2024
2 parents be002ff + ac54b2d commit 45dddc6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
- uses: actions/checkout@v4
with:
repository: libsdl-org/SDL
ref: release-2.28.5
ref: release-2.30.8
path: 'SDL'

- name: Build SDL
run: |
sudo apt-get -y install ninja-build
cd SDL
./build-scripts/android-prefab.sh
mvn install:install-file -Dfile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.aar -DpomFile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.pom
mvn install:install-file -Dfile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.aar -DpomFile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.pom
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- if: ${{ steps.cache-windows-sdl.outputs.cache-hit != 'true' }}
name: Download SDL if not cached
run: |
Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -o C:\SDL.zip
Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$env:SDL_VERSION/SDL2-devel-$env:SDL_VERSION-VC.zip" -OutFile C:\SDL.zip
Expand-Archive C:\SDL.zip -DestinationPath C:\
- name: Cache build folder for this CMakeLists.txt
Expand Down
18 changes: 7 additions & 11 deletions desktop_version/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,30 +285,26 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(VVVVVV PRIVATE -Wno-c99-extensions)
endif()

# Set standards version, disable exceptions and RTTI
if(MSVC)
# MSVC doesn't have /std:c99 or /std:c++98 switches!

# Disable exceptions
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS /EHsc)

# Disable RTTI
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS /GR-)
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS "/EHsc /GR-")
else()
string(REGEX REPLACE "-std=[a-z0-9]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set_source_files_properties(${VVV_C_SRC} PROPERTIES COMPILE_FLAGS -std=c99)

string(REGEX REPLACE "-std=[a-z0-9+]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -std=c++11)

# Disable exceptions
string(REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -fno-exceptions)

# Disable RTTI
string(REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -fno-rtti)
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS "-std=c++11 -fno-exceptions -fno-rtti")

# Dependencies (as needed)
set_source_files_properties(${FAUDIO_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
set_source_files_properties(${CHM_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
endif()

# Unfortunately, it doesn't seem like distros package LodePNG
Expand Down
10 changes: 5 additions & 5 deletions desktop_version/VVVVVV-android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ How to Build
------------

The recommended way is to install Android Studio and Maven. These instructions are for
SDL 2.28.5; adapt your SDL version accordingly.
SDL 2.30.8; adapt your SDL version accordingly.

1. Place a copy of `data.zip` in `desktop_version/VVVVVV-android/app/src/main/assets/`.
(If the `assets/` folder doesn't exist, then create it.)
2. Obtain the SDL 2.28.5 Maven package. As of writing, SDL currently does not publish
2. Obtain the SDL 2.30.8 Maven package. As of writing, SDL currently does not publish
Maven packages, so here is one way to obtain them (other methods are possible):

1. Download the SDL 2.28.5 source code.
1. Download the SDL 2.30.8 source code.
2. Run the `build-scripts/android-prefab.sh` script in the SDL repository.
3. After building, run `mvn install:install-file
-Dfile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.aar
-DpomFile=build-android-prefab/prefab-2.28.5/SDL2-2.28.5.pom` to install it to
-Dfile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.aar
-DpomFile=build-android-prefab/prefab-2.30.8/SDL2-2.30.8.pom` to install it to
Maven Local.

3. Open the `desktop_version/VVVVVV-android/` folder in Android Studio.
Expand Down
2 changes: 1 addition & 1 deletion desktop_version/VVVVVV-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ dependencies {
implementation 'org.jetbrains:annotations:15.0'
implementation 'androidx.core:core:1.10.1'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'org.libsdl.android:SDL2:2.28.5'
implementation 'org.libsdl.android:SDL2:2.30.8'
}

0 comments on commit 45dddc6

Please sign in to comment.