mirror of https://github.com/FWGS/hlsdk-xash3d
Merge branch 'master' into opfor
This commit is contained in:
commit
f2ab36c049
|
@ -52,13 +52,13 @@ jobs:
|
|||
- name: Build on Linux
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
|
||||
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
|
||||
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
|
||||
- name: Build on Linux with vgui
|
||||
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc')
|
||||
run: |
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
|
||||
cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll
|
||||
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all
|
||||
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install
|
||||
|
|
|
@ -29,3 +29,13 @@ CMakeSettings.json
|
|||
CMakeFiles
|
||||
CMakeCache.txt
|
||||
Makefile
|
||||
|
||||
# Android Studio/Gradle
|
||||
.gradle/
|
||||
.externalNativeBuild
|
||||
.cxx/
|
||||
.idea/
|
||||
local.properties
|
||||
.project
|
||||
.classpath
|
||||
.settings
|
|
@ -33,6 +33,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
|||
include(CheckIncludeFile)
|
||||
include(CheckCSourceCompiles)
|
||||
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
|
||||
include(CheckIPOSupported)
|
||||
|
||||
project (HLSDK-PORTABLE)
|
||||
|
||||
|
@ -46,16 +47,37 @@ option(USE_NOVGUI_SCOREBOARD "Prefer non-VGUI Scoreboard when USE_VGUI is enable
|
|||
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
|
||||
option(BUILD_CLIENT "Build client dll" ON)
|
||||
option(BUILD_SERVER "Build server dll" ON)
|
||||
option(POLLY "Enable pollyhedral optimization" OFF)
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4 OR
|
||||
((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")))
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86_64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "EM64T")))
|
||||
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
|
||||
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON)
|
||||
else()
|
||||
option(64BIT "Disable auto -m32 appending to compiler flags" ON)
|
||||
endif()
|
||||
|
||||
# It seems CMAKE_SYSTEM_PROCESSOR parameter completely useless for APPLE platform,
|
||||
# so may need to set options here manually.
|
||||
if((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
AND (((CMAKE_SYSTEM_PROCESSOR STREQUAL "x64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86_64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "EM64T") AND NOT 64BIT)
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X86"
|
||||
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i386"))
|
||||
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON)
|
||||
else()
|
||||
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
|
||||
endif()
|
||||
|
||||
|
@ -131,6 +153,13 @@ if(VITA)
|
|||
add_compile_options(-fno-use-cxa-atexit)
|
||||
endif()
|
||||
|
||||
check_ipo_supported(RESULT HAVE_LTO OUTPUT LTO_ERROR)
|
||||
if(HAVE_LTO)
|
||||
message(STATUS "IPO / LTO enabled")
|
||||
else()
|
||||
message(STATUS "IPO / LTO not supported: <${LTO_ERROR}>")
|
||||
endif()
|
||||
|
||||
check_include_file("tgmath.h" HAVE_TGMATH_H)
|
||||
if(HAVE_TGMATH_H)
|
||||
if(NOT MSVC)
|
||||
|
@ -157,3 +186,11 @@ endif()
|
|||
if(NOT BUILD_SERVER AND NOT BUILD_CLIENT)
|
||||
message(FATAL_ERROR "Nothing to build")
|
||||
endif()
|
||||
|
||||
if(POLLY)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-mllvm -polly)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-fgraphite-identity -floop-interchange -floop-block)
|
||||
endif()
|
||||
endif()
|
||||
|
|
61
README.md
61
README.md
|
@ -164,7 +164,7 @@ sudo ./setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i38
|
|||
|
||||
Now you can use cmake and make prepending the commands with `schroot --chroot steamrt_scout_i386 --`:
|
||||
```
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -B build-in-steamrt -S .
|
||||
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -B build-in-steamrt -S .
|
||||
schroot --chroot steamrt_scout_i386 -- cmake --build build-in-steamrt
|
||||
```
|
||||
|
||||
|
@ -180,13 +180,20 @@ sudo apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i38
|
|||
### Building
|
||||
|
||||
```
|
||||
cmake -B build -S .
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -B build -S .
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Note that the libraries built this way might be not compatible with Steam Half-Life. If you have such issue you can configure it to build statically with c++ and gcc libraries:
|
||||
```
|
||||
cmake .. -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc" -B build -S .
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Alternatively, you can avoid libstdc++/libgcc_s linking using small libsupc++ library and optimization build flags instead(Really just set Release build type and set C compiler as C++ compiler):
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=cc -B build -S .
|
||||
cmake --build build
|
||||
```
|
||||
To ensure portability it's still better to build using Steam Runtime or another chroot of some older distro.
|
||||
|
||||
|
@ -229,13 +236,36 @@ Insert your actual user name in place of `yourusername`.
|
|||
|
||||
Prepend any make or cmake call with `schroot -c jessie --`:
|
||||
```
|
||||
schroot --chroot jessie -- cmake -B build-in-chroot -S .
|
||||
schroot --chroot jessie -- cmake -DCMAKE_BUILD_TYPE=Release -B build-in-chroot -S .
|
||||
schroot --chroot jessie -- cmake --build build-in-chroot
|
||||
```
|
||||
|
||||
## Android
|
||||
1. Set up [Android Studio/Android SDK](https://developer.android.com/studio).
|
||||
|
||||
TODO
|
||||
### Android Studio
|
||||
Open the project located in the `android` folder and build.
|
||||
|
||||
### Command-line
|
||||
```
|
||||
cd android
|
||||
./gradlew assembleRelease
|
||||
```
|
||||
|
||||
### Customizing the build
|
||||
settings.gradle:
|
||||
* **rootProject.name** - project name displayed in Android Studio (optional).
|
||||
|
||||
app/build.gradle:
|
||||
* **android->namespace** and **android->defaultConfig->applicationId** - set both to desired package name.
|
||||
* **getBuildNum** function - set **releaseDate** variable as desired.
|
||||
|
||||
app/java/su/xash/hlsdk/MainActivity.java:
|
||||
* **.putExtra("gamedir", ...)** - set desired gamedir.
|
||||
|
||||
src/main/AndroidManifest.xml:
|
||||
* **application->android:label** - set desired application name.
|
||||
* **su.xash.engine.gamedir** value - set to same as above.
|
||||
|
||||
## Nintendo Switch
|
||||
|
||||
|
@ -307,7 +337,13 @@ Install C and C++ compilers (like gcc or clang), cmake and make.
|
|||
### Building
|
||||
|
||||
```
|
||||
cmake -B build -S .
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -B build -S .
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Force 64-bit build:
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -D64BIT=1 -B build -S .
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
|
@ -316,15 +352,22 @@ cmake --build build
|
|||
To use waf, you need to install python (2.7 minimum)
|
||||
|
||||
```
|
||||
(./waf configure -T release)
|
||||
(./waf)
|
||||
./waf configure -T release
|
||||
./waf
|
||||
```
|
||||
|
||||
Force 64-bit build:
|
||||
```
|
||||
./waf configure -T release -8
|
||||
./waf
|
||||
```
|
||||
|
||||
## Build options
|
||||
|
||||
Some useful build options that can be set during the cmake step.
|
||||
|
||||
* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on Windows and Linux, **OFF** on other platforms.
|
||||
* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on x86 Windows and x86 Linux, **OFF** on other platforms.
|
||||
* **64BIT** - allows to turn off/on 64-bit build. Set to **OFF** by default on x86_64 Windows, x86_64 Linux and 32-bit platforms, **ON** on other 64-bit platforms.
|
||||
* **USE_VGUI** - whether to use VGUI library. **OFF** by default. You need to init `vgui_support` submodule in order to build with VGUI.
|
||||
|
||||
This list is incomplete. Look at `CMakeLists.txt` to see all available options.
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
import java.time.LocalDateTime
|
||||
import java.time.Month
|
||||
import java.time.temporal.ChronoUnit
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
ndkVersion '26.1.10909125'
|
||||
namespace 'com.example.hlsdk'
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'com.example.hlsdk'
|
||||
versionName '1.0'
|
||||
versionCode getBuildNum()
|
||||
minSdkVersion 3
|
||||
targetSdk 34
|
||||
compileSdk 34
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DPOLLY=ON'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version '3.22.1'
|
||||
path file('../../CMakeLists.txt')
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
debuggable true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
androidResources {
|
||||
noCompress += ''
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static def getBuildNum() {
|
||||
LocalDateTime now = LocalDateTime.now()
|
||||
LocalDateTime releaseDate = LocalDateTime.of(2023, Month.DECEMBER, 28, 0, 0, 0)
|
||||
int qBuildNum = releaseDate.until(now, ChronoUnit.DAYS)
|
||||
int minuteOfDay = now.getHour() * 60 + now.getMinute()
|
||||
return qBuildNum * 10000 + minuteOfDay
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:forceQueryable="true"
|
||||
android:icon="@android:mipmap/sym_def_app_icon"
|
||||
android:label="hlsdk-portable"
|
||||
tools:targetApi="r">
|
||||
|
||||
<meta-data
|
||||
android:name="su.xash.engine.gamedir"
|
||||
android:value="valve" />
|
||||
|
||||
<activity
|
||||
android:name="su.xash.hlsdk.MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="su.xash.engine.MOD" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<package android:name="su.xash.engine" />
|
||||
<package android:name="su.xash.engine.test" />
|
||||
</queries>
|
||||
</manifest>
|
|
@ -0,0 +1,37 @@
|
|||
package su.xash.hlsdk;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String pkg = "su.xash.engine.test";
|
||||
|
||||
try {
|
||||
getPackageManager().getPackageInfo(pkg, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
try {
|
||||
pkg = "su.xash.engine";
|
||||
getPackageManager().getPackageInfo(pkg, 0);
|
||||
} catch (PackageManager.NameNotFoundException ex) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=su.xash.engine")).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
startActivity(new Intent().setComponent(new ComponentName(pkg, "su.xash.engine.XashActivity"))
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
.putExtra("gamedir", "valve")
|
||||
.putExtra("gamelibdir", getApplicationInfo().nativeLibraryDir)
|
||||
.putExtra("package", getPackageName()));
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.2.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=384m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# android.useDeprecatedNdk=true
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
#Thu Dec 28 14:36:02 EET 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,160 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## 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=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=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
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
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
|
||||
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
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((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" ;;
|
||||
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=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -0,0 +1,90 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1,3 @@
|
|||
include ':app'
|
||||
|
||||
rootProject.name = 'hlsdk-portable'
|
|
@ -20,7 +20,7 @@
|
|||
# SOFTWARE.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project (CLDLL)
|
||||
|
||||
set (CLDLL_LIBRARY client)
|
||||
|
@ -29,13 +29,25 @@ add_definitions(-DCLIENT_DLL)
|
|||
|
||||
if(NOT MSVC)
|
||||
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||
add_compile_options(-Wno-write-strings) # GCC/Clang flag
|
||||
add_compile_options(-fno-rtti) # GCC/Clang flag
|
||||
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
|
||||
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
|
||||
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp)
|
||||
if(NOT MINGW)
|
||||
add_definitions(-D_snprintf=snprintf -D_vsnprintf=vsnprintf)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Release"
|
||||
OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"
|
||||
AND CMAKE_SYSTEM_NAME STREQUAL "Android"))
|
||||
add_compile_options(-fno-unwind-tables -fno-asynchronous-unwind-tables) # GCC/Clang flag
|
||||
add_compile_options(-fomit-frame-pointer) # GCC/Clang flag
|
||||
add_compile_options(-ftree-vectorize) # GCC/Clang flag
|
||||
add_compile_options(-funsafe-math-optimizations) # GCC/Clang flag
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
add_compile_options(-O3 -DNDEBUG) # gradle compiles release builds with RelWithDebInfo(-O2 -g) and strips debug symbols.
|
||||
target_link_options(${CLDLL_LIBRARY} PUBLIC "LINKER:-O3")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
@ -219,8 +231,16 @@ if(MSVC)
|
|||
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
||||
if(HAVE_LTO)
|
||||
set_property(TARGET ${CLDLL_LIBRARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
install( TARGETS ${CLDLL_LIBRARY}
|
||||
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE )
|
||||
|
||||
add_custom_command(TARGET ${CLDLL_LIBRARY}
|
||||
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
|
||||
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${CLDLL_LIBRARY}>)
|
||||
|
|
|
@ -166,7 +166,8 @@ void VectorScale( const float *in, float scale, float *out );
|
|||
float VectorNormalize( float *v );
|
||||
void VectorInverse( float *v );
|
||||
|
||||
extern vec3_t vec3_origin;
|
||||
// extern vec3_t vec3_origin;
|
||||
extern float vec3_origin[3];
|
||||
|
||||
// disable 'possible loss of data converting float to int' warning message
|
||||
#pragma warning( disable: 4244 )
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
#if !defined(M_PI_F)
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
extern vec3_t vec3_origin;
|
||||
// extern vec3_t vec3_origin;
|
||||
|
||||
// if C++ mangling differs from C symbol name
|
||||
#if _MSC_VER || __WATCOMC__
|
||||
vec3_t vec3_origin;
|
||||
float vec3_origin[3];
|
||||
#endif
|
||||
|
||||
float Length( const float *v )
|
||||
|
|
|
@ -20,17 +20,30 @@
|
|||
# SOFTWARE.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project (SVDLL)
|
||||
|
||||
set (SVDLL_LIBRARY server)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||
add_compile_options(-fno-rtti) # GCC/Clang flag
|
||||
add_compile_options(-Wno-invalid-offsetof) # GCC/Clang flag
|
||||
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
|
||||
add_definitions(-D_LINUX) # It seems enough for all non-Win32 systems
|
||||
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf )
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Release"
|
||||
OR (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo"
|
||||
AND CMAKE_SYSTEM_NAME STREQUAL "Android"))
|
||||
add_compile_options(-fno-unwind-tables -fno-asynchronous-unwind-tables) # GCC/Clang flag
|
||||
add_compile_options(-fomit-frame-pointer) # GCC/Clang flag
|
||||
add_compile_options(-ftree-vectorize) # GCC/Clang flag
|
||||
add_compile_options(-funsafe-math-optimizations) # GCC/Clang flag
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
add_compile_options(-O3 -DNDEBUG) # gradle compiles release builds with RelWithDebInfo(-O2 -g) and strips debug symbols.
|
||||
target_link_options(${SVDLL_LIBRARY} PUBLIC "LINKER:-O3")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
@ -223,8 +236,16 @@ if(MSVC)
|
|||
set_property(TARGET ${SVDLL_LIBRARY} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
||||
if(HAVE_LTO)
|
||||
set_property(TARGET ${SVDLL_LIBRARY} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
install( TARGETS ${SVDLL_LIBRARY}
|
||||
DESTINATION "${GAMEDIR}/${SERVER_INSTALL_DIR}/"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
add_custom_command(TARGET ${SVDLL_LIBRARY}
|
||||
POST_BUILD DEPENDS ${SVDLL_LIBRARY}
|
||||
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${SVDLL_LIBRARY}>)
|
||||
|
|
|
@ -726,7 +726,7 @@ cvar_t sk_plr_spore3 = { "sk_plr_spore3", "0" };
|
|||
void GameDLLInit( void )
|
||||
{
|
||||
// Register cvars here:
|
||||
if( CVAR_GET_POINTER( "build" ) )
|
||||
if( !CVAR_GET_POINTER( "sv_language" ) )
|
||||
g_fIsXash3D = TRUE;
|
||||
|
||||
g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" );
|
||||
|
|
|
@ -2,7 +2,7 @@ BARNACLE_FIX_VISIBILITY=OFF # Barnacle tongue length fix
|
|||
CLIENT_WEAPONS=ON # Client local weapons prediction
|
||||
CROWBAR_IDLE_ANIM=OFF # Crowbar idle animation
|
||||
CROWBAR_DELAY_FIX=OFF # Crowbar attack delay fix
|
||||
CROWBAR_FIX_RAPID_CROWBAR=OFF # Rapid crowbar fix
|
||||
CROWBAR_FIX_RAPID_CROWBAR=ON # Rapid crowbar fix
|
||||
GAUSS_OVERCHARGE_FIX=OFF # Gauss overcharge fix
|
||||
TRIPMINE_BEAM_DUPLICATION_FIX=OFF # Fix of tripmine beam duplication on level transition
|
||||
HANDGRENADE_DEPLOY_FIX=OFF # Handgrenade deploy animation fix after finishing a throw
|
||||
|
|
6
wscript
6
wscript
|
@ -211,7 +211,7 @@ def configure(conf):
|
|||
|
||||
conf.msg(msg='-> processing mod options', result='...', color='BLUE')
|
||||
regex = re.compile('^([A-Za-z0-9_]+)=([A-Za-z0-9_]+)\ \#\ (.*)$')
|
||||
with open('mod_options.txt') as fd:
|
||||
with open(str(conf.path.make_node('mod_options.txt'))) as fd:
|
||||
lines = fd.readlines()
|
||||
for line in lines:
|
||||
m = regex.match(line.strip())
|
||||
|
@ -230,6 +230,10 @@ def configure(conf):
|
|||
if conf.env.HLDEMO_BUILD and conf.env.OEM_BUILD:
|
||||
conf.fatal('Don\'t mix Demo and OEM builds!')
|
||||
|
||||
# force to use server library name
|
||||
if conf.env.DEST_OS == 'android':
|
||||
conf.env.SERVER_LIBRARY_NAME = 'server' # can't be any other name, until specified
|
||||
|
||||
# strip lib from pattern
|
||||
if conf.env.DEST_OS not in ['android']:
|
||||
if conf.env.cxxshlib_PATTERN.startswith('lib'):
|
||||
|
|
Loading…
Reference in New Issue