Skip to content

Commit

Permalink
Merge pull request #204 from WhiteCloud0123/develop
Browse files Browse the repository at this point in the history
升级到C++17标准
  • Loading branch information
WhiteCloud0123 authored Jul 15, 2023
2 parents a568a5c + d191668 commit 88069f1
Show file tree
Hide file tree
Showing 25 changed files with 185 additions and 493 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ readability-*,\
-modernize-pass-by-value,\
-modernize-return-braced-init-list,\
-modernize-use-default-member-init,\
-modernize-use-nodiscard,\
-readability-convert-member-functions-to-static,\
-readability-else-after-return,\
-readability-function-cognitive-complexity,\
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: '11'
distribution: 'adopt'
- name: Setup Build and Dependencies (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
endif ()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ else
endif

ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
OTHERS += -std=gnu++14
OTHERS += -std=gnu++17
else
OTHERS += -std=c++14
OTHERS += -std=c++17
endif

ifeq ($(CYGWIN),1)
Expand Down
1 change: 0 additions & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.DS_Store
.externalNativeBuild
.gradle
.keystore
/.idea/libraries
/.idea/workspace.xml
/app/jni/SDL2
Expand Down
22 changes: 15 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ if (localProperties.getProperty('override_ndkBuildAppPlatform') != null) {
override_ndkBuildAppPlatform = localProperties.getProperty("override_ndkBuildAppPlatform")
}

def override_ndkVersion = getProperty("override_ndkVersion")
if (localProperties.getProperty('override_ndkVersion') != null) {
override_ndkVersion = localProperties.getProperty('override_ndkVersion')
}

println("Using [ njobs]: $njobs")
println("Using [ localize]: $localize")
println("Using [ deps]: $deps")
Expand All @@ -108,6 +113,7 @@ println("Using [ compileSdkVersion]: $override_compileSdkVersion")
println("Using [ minSdkVersion]: $override_minSdkVersion")
println("Using [ targetSdkVersion]: $override_targetSdkVersion")
println("Using [ndkBuildAppPlatform]: $override_ndkBuildAppPlatform")
println("Using [ ndkVersion]: $override_ndkVersion")
println("Using [ abi_arm_32]: $abi_arm_32")
println("Using [ abi_arm_64]: $abi_arm_64")
println("Using [ abi_x86_32]: $abi_x86_32")
Expand Down Expand Up @@ -232,18 +238,20 @@ preBuild.dependsOn createWindowsJunctionLinks
createWindowsJunctionLinks.dependsOn makeLocalization

android {
namespace "com.cleverraven.cataclysmdda"
compileSdkVersion override_compileSdkVersion
ndkVersion override_ndkVersion

defaultConfig {
minSdkVersion override_minSdkVersion
targetSdkVersion override_targetSdkVersion
versionCode 11
versionName "3.1"
if (buildAsApplication) {
applicationId "WhiteCloud.CddaBreeze"
setProperty("archivesBaseName", "CDDA-Breeze" + versionName)
applicationId "WhiteCloud.CDDA_Breeze"
setProperty("archivesBaseName", "CDDA-Breeze-" + versionName)
}
resValue "string", "app_name", "CDDA Breeze"
resValue "string", "app_name", "CDDA Breeze "

splits {
// Configures multiple APKs based on ABI.
Expand Down Expand Up @@ -283,13 +291,13 @@ android {
productFlavors {
stable {
dimension "version"
resValue "string", "app_name", " CDDA Breeze"
resValue "string", "app_name", "CDDA Breeze"
}

}

signingConfigs {

if (keystoreProperties.getProperty('storeFile') != null) {
if (file(keystoreProperties.getProperty('storeFile')).exists()) {
release {
storeFile file(keystoreProperties.getProperty("storeFile"))
Expand All @@ -300,7 +308,7 @@ android {
} else {
throw new GradleException("Keystore file " + keystoreProperties.getProperty("storeFile") + " was not found.\n")
}

}
if (keystoreProperties.getProperty('debug_storeFile') != null) {
if (file(keystoreProperties.getProperty('debug_storeFile')).exists()) {
debug {
Expand Down
4 changes: 2 additions & 2 deletions android/app/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
APP_STL := c++_shared
APP_CPPFLAGS += -std=c++14
APP_CPPFLAGS += -std=c++17
ifneq ($(OS),Windows_NT)
APP_LDFLAGS += -fuse-ld=gold
APP_LDFLAGS += -fuse-ld=lld
endif

# Do not specify APP_OPTIM here, it is done through ndk-build NDK_DEBUG=0/1 setting instead
Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
com.gamemaker.game
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cleverraven.cataclysmdda"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void onResume() {

Context context = getApplicationContext();
String service_names = CataclysmDDA_Helpers.getEnabledAccessibilityServiceNames(context);
accessibilityServicesAlert.setMessage( String.format( getString(R.string.accessibilityServicesMessage), service_names ) );
//accessibilityServicesAlert.setMessage( String.format( getString(R.string.accessibilityServicesMessage), service_names ) );
if (false) {
accessibilityServicesAlert.show();
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

accessibilityServicesAlert = new AlertDialog.Builder(SplashScreen.this)
.setTitle(getString(R.string.accessibilityServicesTitle))
//.setTitle(getString(R.string.accessibilityServicesTitle))
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Expand Down
2 changes: 0 additions & 2 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<string name="upgradeTitle">Upgrading game data...</string>
<string name="helpTitle">Help &amp; Controls</string>
<string name="helpMessage">"Swipe" for directional movement (hold for virtual joystick). "Tap" to confirm selection in menu or Pause one turn in-game (hold to Pause several turns in-game). "Double tap" to cancel or go back in menus (works like Escape key). "Pinch" to zoom in/out (in-game). Use hardware "Back" button to toggle virtual keyboard (hold to toggle keyboard shortcuts).</string>
<string name="accessibilityServicesTitle">Accessibility Services Warning</string>
<string name="accessibilityServicesMessage">If swipe commands and shortcuts menus are not working in game, you might want to disable one of the following accessibility services/software that interact with touchscreen (swipe assists, auto-clickers, one-handed mode, etc.):\n%1$s</string>
<string name="softwareRendering">Software rendering</string>
<string name="forceFullscreen">Force fullscreen</string>
<string name="trapBackButton">Trap Back button</string>
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,7 +15,7 @@ buildscript {

allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
Expand Down
10 changes: 7 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ deps=./deps.zip

# This property controls which override version number to use
# You can override this from the command line by passing "-Poverride_version=#"
override_version=CDDA-Breeze-3.1
override_version=

# This property controls path where overridden version number header should be generated
# You can override this from the command line by passing "-Pversion_header_path=#"
Expand All @@ -58,12 +58,16 @@ override_compileSdkVersion=31

# This property controls which minSdkVersion should be used
# You can override this from the command line by passing "-Poverride_minSdkVersion=#"
override_minSdkVersion=14
override_minSdkVersion=21

# This property controls which targetSdkVersion should be used
# You can override this from the command line by passing "-Poverride_targetSdkVersion=#"
override_targetSdkVersion=31

# This property controls which ndkBuildAppPlatform should be used
# You can override this from the command line by passing "-Poverride_ndkBuildAppPlatform=#"
override_ndkBuildAppPlatform=android-16
override_ndkBuildAppPlatform=android-21

# This property controls which ndkVersion should be used
# You can override this from the command line by passing "-Poverride_ndkVersion=#"
override_ndkVersion=25.2.9519653
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Aug 27 13:00:00 UTC 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
111 changes: 68 additions & 43 deletions android/gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,59 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,28 +75,14 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand All @@ -85,7 +106,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand All @@ -105,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -134,27 +156,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
Loading

0 comments on commit 88069f1

Please sign in to comment.