2
0
mirror of https://github.com/s1lentq/reapi.git synced 2024-10-16 15:27:06 +03:00

Add workflows/build.yml (Migrate to Github CI)

Add CMakeLists.txt build system
Update README.md
Fixed compiler warnings
This commit is contained in:
s1lentq 2021-04-22 22:19:14 +07:00
parent 9f5b521f5e
commit 31eae943bd
27 changed files with 1246 additions and 54 deletions

155
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,155 @@
name: C/C++ CI
on:
push:
branches: [master]
paths-ignore:
- '**.md'
pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]
jobs:
windows:
name: 'Windows'
runs-on: windows-latest
env:
solution: 'msvc/reapi.sln'
buildPlatform: 'Win32'
buildRelease: 'Release'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
- name: Build
run: |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
- name: Move files
run: |
mkdir publish\debug
mkdir publish\addons\amxmodx\modules
move msvc\${{ env.buildRelease }}\reapi_amxx.dll publish\addons\amxmodx\modules\reapi_amxx.dll
move msvc\${{ env.buildRelease }}\reapi_amxx.pdb publish\debug\reapi_amxx.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v2
with:
name: win32
path: publish/*
linux:
name: 'Linux'
runs-on: ubuntu-latest
container: s1lentq/linux86buildtools:latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build using Intel C++ Compiler 19.0
run: |
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8
- name: Prepare AMXX
run: |
mkdir -p publish/addons/amxmodx/modules
rsync -a reapi/extra/amxmodx/ publish/addons/amxmodx/
rsync -a reapi/version/reapi_version.inc publish/addons/amxmodx/scripting/include/
- name: Move files
run: |
mv build/reapi/reapi_amxx_i386.so publish/addons/amxmodx/modules/reapi_amxx_i386.so
mv reapi/version/appversion.h publish/appversion.h
- name: Run GLIBC/ABI version compat test
run: |
binaries=(
"publish/addons/amxmodx/modules/reapi_amxx_i386.so"
)
bash ./reapi/version/glibc_test.sh ${binaries[@]}
if [[ $? -ne 0 ]]; then
exit 1 # Assertion failed
fi
shell: bash
- name: Deploy artifacts
uses: actions/upload-artifact@v2
id: upload-job
with:
name: linux32
path: publish/*
- name: Cleanup temporary artifacts
if: success() && steps.upload-job.outcome == 'success'
run: |
rm -f appversion.h
publish:
name: 'Publish'
runs-on: ubuntu-latest
needs: [windows, linux]
steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v2
with:
name: linux32
- name: Deploying windows artifacts
uses: actions/download-artifact@v2
with:
name: win32
- name: Reading appversion.h
run: |
if [ -e appversion.h ]; then
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
APP_VERSION=""
else
# Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs)
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
fi
fi
rm -f appversion.h
- name: Packaging binaries
id: packaging-job
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
run: |
7z a -tzip reapi-bin-${{ env.APP_VERSION }}.zip addons/
- name: Publish artifacts
uses: softprops/action-gh-release@v1
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&
steps.packaging-job.outcome == 'success'
with:
files: |
*.zip
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
- name: Cleanup temporary artifacts
if: success() && steps.publish-job.outcome == 'success'
run: |
rm -rf addons debug
rm -f *.zip appversion.h

13
CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.1)
project(reapi CXX)
if (WIN32)
message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/reapi.sln instead it!")
endif()
add_custom_target(appversion DEPENDS
COMMAND "${PROJECT_SOURCE_DIR}/reapi/version/appversion.sh" "${PROJECT_SOURCE_DIR}" "reapi"
)
add_subdirectory(reapi)

View File

@ -1,45 +1,74 @@
# Reapi [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Reapi_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Reapi_Publish&guest=1) [![Download](https://camo.githubusercontent.com/1e445db0afba4545403a7600f1d51624c50cefc9be27417125a4eddfb6099f24/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73316c656e74712f72656170692e737667)](https://github.com/s1lentq/reapi/releases/latest) [![Percentage of issues still open](http://isitmaintained.com/badge/open/s1lentq/reapi.svg)](http://isitmaintained.com/project/s1lentq/reapi "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
# Reapi [![Download](https://camo.githubusercontent.com/131d02663845c3c56678ac169696fa702504c4534453ced50f4935d762a3b814/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73316c656e74712f72656170692e737667)](https://github.com/s1lentq/reapi/releases/latest) [![Downloads](https://camo.githubusercontent.com/1f2c6ef35aa9a7e845ca73cb4bba4b29730e30d1056917758a501d7497739519/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f73316c656e74712f72656170692f746f74616c3f636f6c6f723d696d706f7274616e74)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/s1lentq/reapi.svg)](http://isitmaintained.com/project/s1lentq/reapi "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
AMX Mod X module, using API regamedll & rehlds
## Build instructions
There are several software requirements for building ReAPI:
<ol>
<li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li>
<li>For Windows: Visual Studio 2015 and later</li>
<li>For Linux: Intel C++ Compiler 15 and later</li>
</ol>
### Checking requirements
#### JDK version
Windows<pre>&gt; %JAVA_HOME%\bin\javac -version
javac 1.8.0_25
There are several software requirements for building ReAPI:
#### Windows
<pre>
Visual Studio 2015 (C++14 standard) and later
</pre>
Linux
<pre>$ javac -version
javac 1.7.0_65
</pre>
#### Visual Studio
Help -> About
#### ICC
<pre>$ icc --version
icc (ICC) 15.0.1 20141023
#### Linux
<pre>
git >= 1.8.5
cmake >= 3.10
GCC >= 4.9.2 (Optional)
ICC >= 15.0.1 20141023 (Optional)
LLVM (Clang) >= 6.0 (Optional)
</pre>
### Building
On Windows:
<pre>gradlew clean buildRelease</pre>
On Linux (ICC):
<pre>./gradlew clean buildRelease</pre>
#### Windows
Use `Visual Studio` to build, open `msvc/reapi.sln` and just select from the solution configurations list `Release` or `Debug`
On Linux (GCC):
<pre>./gradlew clean -PuseGcc buildRelease</pre>
#### Linux
Compiled binaries will be placed in the build/binaries/ directory
* Optional options using `build.sh --compiler=[gcc] --jobs=[N] -D[option]=[ON or OFF]` (without square brackets)
<pre>
-c=|--compiler=[icc|gcc|clang] - Select preferred C/C++ compiler to build
-j=|--jobs=[N] - Specifies the number of jobs (commands) to run simultaneously (For faster building)
<sub>Definitions (-D)</sub>
DEBUG - Enables debugging mode
USE_STATIC_LIBSTDC - Enables static linking library libstdc++
</pre>
* ICC <pre>./build.sh --compiler=intel</pre>
* LLVM (Clang) <pre>./build.sh --compiler=clang</pre>
* GCC <pre>./build.sh --compiler=gcc</pre>
##### Checking build environment (Debian / Ubuntu)
<details>
<summary>Click to expand</summary>
<ul>
<li>
Installing required packages
<pre>
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
sudo apt-get install -y build-essential
sudo apt-get install -y libc6-dev libc6-dev-i386
</pre>
</li>
<li>
Select the preferred C/C++ Compiler installation
<pre>
1) sudo apt-get install -y gcc g++
2) sudo apt-get install -y clang
</pre>
</li>
</ul>
</details>
## How can I help the project?
Just install it on your game server and report problems you faced.<br />

60
build.sh Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
main()
{
CC=gcc
CXX=g++
if [[ "$*" =~ "--help" ]]; then
help
exit 0;
fi
n=0
args=()
for i in "$@"
do
case $i in
-j=*|--jobs=*)
jobs="-j${i#*=}"
shift
;;
-c=*|--compiler=*)
C="${i#*=}"
shift
;;
*)
args[$n]="$i"
((++n))
;;
esac
done
case "$C" in
("intel"|"icc") CC=icc CXX=icpc ;;
("gcc"|"g++") CC=gcc CXX=g++ ;;
("clang|llvm") CC=clang CXX=clang++ ;;
*)
;;
esac
rm -rf build
mkdir build
pushd build &> /dev/null
CC=$CC CXX=$CXX cmake ${args[@]} ..
make ${jobs}
popd > /dev/null
}
help()
{
printf "Usage: ./build.sh <options>\n\n"
printf " -c= | --compiler=<icc|gcc|clang> - Select preferred C/C++ compiler to build\n"
printf " -j= | --jobs=<N> - Specifies the number of jobs (commands) to run simultaneously (For faster building)\n\n"
}
# Initialize
main $*
# Exit normally
exit 0

View File

@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
# Visual Studio Version 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reapi", "..\reapi\msvc\reapi.vcxproj", "{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "version", "..\reapi\version\msvc\version.vcxproj", "{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -15,8 +17,15 @@ Global
{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Debug|Win32.Build.0 = Debug|Win32
{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Release|Win32.ActiveCfg = Release|Win32
{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}.Release|Win32.Build.0 = Release|Win32
{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}.Debug|Win32.ActiveCfg = Debug|Win32
{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}.Debug|Win32.Build.0 = Debug|Win32
{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}.Release|Win32.ActiveCfg = Release|Win32
{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ED60E017-84B1-4D63-8802-644D7E6B4EA8}
EndGlobalSection
EndGlobal

198
reapi/CMakeLists.txt Normal file
View File

@ -0,0 +1,198 @@
#----------------------------------------
# 1. Preparing build:
# rm -rf build
# mkdir build && cd build
#
# 2. Select compiler and build it
# - Compile with Clang:
# CC="clang" CXX="clang++" cmake ..
# make
#
# - Compile with Intel C++ Compiler:
# CC="icc" CXX="icpc" cmake ..
# make
#
# - Compile with GCC Compiler:
# cmake ..
# make
#----------------------------------------
cmake_minimum_required(VERSION 3.1)
project(reapi CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32 -s")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-builtin -Wno-unknown-pragmas")
# Remove noxref code and data
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ffunction-sections -fdata-sections")
if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else()
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
# Check Intel C++ compiler
if ("$ENV{CXX}" MATCHES "icpc")
#
# -fp-model=precise
# ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations
# https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html#fp-model-fp_GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5
#
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
-fp-model=precise\
-Qoption,cpp,--treat_func_as_string_literal_cpp\
-inline-forceinline\
-no-ansi-alias")
set(LINK_FLAGS "${LINK_FLAGS} \
-static-intel\
-no-intel-extensions")
if (NOT DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
-mtune=generic -msse3\
-fno-sized-deallocation -Wno-strict-aliasing")
endif()
# GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
endif()
if (NOT DEBUG)
set(LINK_FLAGS "${LINK_FLAGS} \
-Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/common"
"${PROJECT_SOURCE_DIR}/src/mods"
"${PROJECT_SOURCE_DIR}/src/natives"
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_SOURCE_DIR}/version"
)
set(PROJECT_CSSDK_DIR
"${PROJECT_SOURCE_DIR}/include/cssdk/common"
"${PROJECT_SOURCE_DIR}/include/cssdk/dlls"
"${PROJECT_SOURCE_DIR}/include/cssdk/engine"
"${PROJECT_SOURCE_DIR}/include/cssdk/game_shared"
"${PROJECT_SOURCE_DIR}/include/cssdk/pm_shared"
"${PROJECT_SOURCE_DIR}/include/cssdk/public"
)
set(PROJECT_METAMOD_DIR
"${PROJECT_SOURCE_DIR}/include/metamod"
)
set(REAPI_SRCS
"src/main.cpp"
"src/amx_hook.cpp"
"src/amxxmodule.cpp"
"src/h_export.cpp"
"src/dllapi.cpp"
"src/entity_callback.cpp"
"src/hook_callback.cpp"
"src/hook_list.cpp"
"src/hook_manager.cpp"
"src/api_config.cpp"
"src/member_list.cpp"
"src/meta_api.cpp"
"src/reapi_utils.cpp"
"src/sdk_util.cpp"
"src/natives/natives_common.cpp"
"src/natives/natives_hookchains.cpp"
"src/natives/natives_members.cpp"
"src/natives/natives_misc.cpp"
"src/natives/natives_rechecker.cpp"
"src/natives/natives_reunion.cpp"
"src/natives/natives_vtc.cpp"
"src/mods/mod_rechecker_api.cpp"
"src/mods/mod_regamedll_api.cpp"
"src/mods/mod_rehlds_api.cpp"
"src/mods/mod_reunion_api.cpp"
"src/mods/mod_vtc_api.cpp"
"src/mods/queryfile_handler.cpp"
)
set(COMMON_SRCS
"common/info.cpp"
"common/stdc++compat.cpp"
)
set(PUBLIC_SRCS
"include/cssdk/public/interface.cpp"
)
add_library(reapi SHARED ${appversion.sh})
if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/.." "reapi")
endif()
add_dependencies(reapi appversion)
target_include_directories(reapi PRIVATE
${PROJECT_SRC_DIR}
${PROJECT_CSSDK_DIR}
${PROJECT_METAMOD_DIR}
)
target_compile_definitions(reapi PRIVATE
_LINUX
LINUX
NDEBUG
_GLIBCXX_USE_CXX11_ABI=0
HAVE_STRONG_TYPEDEF
_stricmp=strcasecmp
_strnicmp=strncasecmp
_vsnprintf=vsnprintf
_snprintf=snprintf
)
target_sources(reapi PRIVATE
${REAPI_SRCS}
${COMMON_SRCS}
${PUBLIC_SRCS}
)
target_link_libraries(reapi PRIVATE
dl
)
if (USE_STATIC_LIBSTDC)
target_compile_definitions(reapi PRIVATE BUILD_STATIC_LIBSTDC)
set(LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
endif()
set(LINK_FLAGS "${LINK_FLAGS} \
-Wl,-rpath,'$ORIGIN/.' \
-L${PROJECT_SOURCE_DIR}/lib/linux32")
set_target_properties(reapi PROPERTIES
OUTPUT_NAME reapi_amxx_i386
PREFIX ""
COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF
)

View File

@ -0,0 +1,68 @@
#include <stdio.h>
#include <stdlib.h>
#if !defined(_WIN32) && !defined(BUILD_STATIC_LIBSTDC) // if build with static libstdc++ then ignore
// This file adds the necessary compatibility tricks to avoid symbols with
// version GLIBCXX_3.4.16 and bigger, keeping binary compatibility with libstdc++ 4.6.1.
namespace std
{
#if __cpp_exceptions
logic_error::logic_error(const char *__arg) : exception(), _M_msg(__arg) {}
out_of_range::out_of_range(const char *__arg) : logic_error(__arg) {}
out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {}
#endif // #if __cpp_exceptions
// We shouldn't be throwing exceptions at all, but it sadly turns out we call STL (inline) functions that do.
void __throw_out_of_range_fmt(const char *fmt, ...)
{
#if __cpp_exceptions
va_list ap;
char buf[1024]; // That should be big enough.
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
buf[sizeof(buf) - 1] = '\0';
va_end(ap);
throw std::out_of_range(buf);
#else
abort();
#endif
}
}; // namespace std
// Was added in GCC 4.9
// Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, but that's equivalent, version-wise.
// Those calls are added by the compiler
// itself on `new Class[n]` calls.
extern "C"
void __cxa_throw_bad_array_new_length()
{
#if __cpp_exceptions
throw std::bad_array_new_length();
#else
abort();
#endif
}
#if defined(__INTEL_COMPILER) && __cplusplus >= 201402L
// This operator delete sized deallocations was added in c++14
// and required at least not less than CXXABI_1.3.9
// we should to keep CXXABI_1.3.8 for binary compatibility with oldest libstdc++.
// GCC and Clang allow to compile C++14 code with -fno-sized-deallocation to disable the new feature, but ICC isn't allow
// so that our C++14 library code would never call that version of operator delete,
// for ICC compiler we must override those operators for static linking to the library.
void operator delete[](void *ptr, std::size_t size) noexcept
{
::operator delete(ptr);
}
void operator delete(void *ptr, std::size_t size) noexcept
{
::operator delete(ptr);
}
#endif
#endif // !defined(_WIN32)

View File

@ -40,12 +40,6 @@
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
extern globalvars_t *gpGlobals;
// Use this instead of ALLOC_STRING on constant strings
#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset)))
#define MAKE_STRING(str) ((uint64)(str) - (uint64)(STRING(0)))
// Dot products for view cone checking
#define VIEW_FIELD_FULL -1.0 // +-180 degrees
#define VIEW_FIELD_WIDE -0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks

Binary file not shown.

BIN
reapi/lib/linux32/libm.so Normal file

Binary file not shown.

BIN
reapi/lib/linux32/librt.so Normal file

Binary file not shown.

Binary file not shown.

View File

@ -285,7 +285,6 @@
</ClCompile>
<ClCompile Include="..\src\reapi_utils.cpp" />
<ClCompile Include="..\src\sdk_util.cpp" />
<ClCompile Include="..\version\version.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="reapi.rc" />
@ -305,6 +304,11 @@
<None Include="..\version\reapi_version.inc" />
<None Include="reapi.def" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\version\msvc\version.vcxproj">
<Project>{8520b2ec-8de2-4b76-8fa7-02f156c79c04}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{74E2532F-BE55-4B2B-8C34-C9A4B5EC11AC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>

View File

@ -800,9 +800,6 @@
<ClCompile Include="..\src\mods\mod_reunion_api.cpp">
<Filter>src\mods</Filter>
</ClCompile>
<ClCompile Include="..\version\version.cpp">
<Filter>version</Filter>
</ClCompile>
<ClCompile Include="..\src\natives\natives_common.cpp">
<Filter>src\natives</Filter>
</ClCompile>

View File

@ -93,7 +93,7 @@ typedef int64 cell;
#define UNLIMITED (~1u >> 1)
struct tagAMX;
typedef cell(AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef cell(/*AMX_NATIVE_CALL*/ *AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index, cell *result, cell *params);
typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
#if !defined _FAR

View File

@ -141,7 +141,7 @@ struct hookctx_t
};
size_t args_count = 0;
args_t args[MAX_HOOKCHAIN_ARGS] = {0u, ATYPE_INTEGER};
args_t args[MAX_HOOKCHAIN_ARGS] = {};
static CTempStrings s_temp_strings;
};
@ -282,7 +282,7 @@ NOINLINE R DLLEXPORT _callForward(hook_t* hook, original_t original, f_args&&...
break;
}
}
hook->wasCalled = false;
return *(R *)&hookCtx->retVal._integer;

View File

@ -15,8 +15,8 @@ private:
CQueryFileHandler(AMX *amx, const char *funcname);
~CQueryFileHandler();
const int GetAmxxID() const { return m_amxId; };
const int GetUniqueID() const { return m_uniqueId; };
int GetAmxxID() const { return m_amxId; };
int GetUniqueID() const { return m_uniqueId; };
private:
int m_amxId;

View File

@ -117,7 +117,7 @@ string_t getAmxStringAlloc(AMX* amx, cell addr, char (&dest)[N], size_t* len = n
return (pszDest && pszDest[0] != '\0') ? ALLOC_STRING(pszDest) : iStringNull;
}
inline void fillNatives(AMX_NATIVE_INFO* table, cell (AMX_NATIVE_CALL with)(AMX *, cell *))
inline void fillNatives(AMX_NATIVE_INFO* table, cell (with)(AMX *, cell *))
{
for (size_t i = 0; table[i].name; i++)
table[i].func = with;

View File

@ -359,7 +359,7 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params)
CHECK_ISENTITY(arg_index);
edict_t *pEdict = edictByIndexAmx(params[arg_index]);
if (unlikely(pEdict == nullptr || &pEdict->v == nullptr)) {
if (unlikely(pEdict == nullptr)) {
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE;
}

View File

@ -1055,7 +1055,7 @@ cell AMX_NATIVE_CALL rg_set_user_bpammo(AMX *amx, cell *params)
return FALSE;
}
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>([pPlayer, pInfo](CBasePlayerWeapon *pWeapon) {
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>([pInfo](CBasePlayerWeapon *pWeapon) {
return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id);
});
@ -1091,7 +1091,7 @@ cell AMX_NATIVE_CALL rg_get_user_bpammo(AMX *amx, cell *params)
return FALSE;
}
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>([pPlayer, pInfo](CBasePlayerWeapon *pWeapon) {
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>([pInfo](CBasePlayerWeapon *pWeapon) {
return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id);
});
@ -1127,7 +1127,7 @@ cell AMX_NATIVE_CALL rg_set_user_ammo(AMX *amx, cell *params)
return FALSE;
}
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>(pInfo->slot, [pPlayer, pInfo](CBasePlayerWeapon *pWeapon) {
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>(pInfo->slot, [pInfo](CBasePlayerWeapon *pWeapon) {
return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id);
});
@ -1163,7 +1163,7 @@ cell AMX_NATIVE_CALL rg_get_user_ammo(AMX *amx, cell *params)
return FALSE;
}
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>(pInfo->slot, [pPlayer, pInfo](CBasePlayerWeapon *pWeapon) {
auto pWeapon = pPlayer->ForEachItem<CBasePlayerWeapon>(pInfo->slot, [pInfo](CBasePlayerWeapon *pWeapon) {
return (pWeapon->IsWeapon() && pWeapon->m_iId == pInfo->id);
});

View File

@ -13,8 +13,9 @@ void NORETURN UTIL_SysError(const char *fmt, ...)
//TerminateProcess(GetCurrentProcess(), 1);
*((int *)NULL) = 0;
while (true);
volatile int *null = 0;
*null = 0;
exit(-1);
}
char *UTIL_VarArgs(char *format, ...)

View File

@ -0,0 +1,275 @@
@setlocal enableextensions enabledelayedexpansion
@echo off
::
:: Pre-build auto-versioning script
::
chcp 65001
set srcdir=%~1
set repodir=%~2
set fileinc=%~3
set old_version=
set old_version_inc=
set version_major=0
set version_minor=0
set version_maintenance=0
set version_modifed=
set genereate_inc=0
set commitSHA=
set commitURL=
set commitCount=0
set branch_name=master
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "hour=%dt:~8,2%"
set "min=%dt:~10,2%"
set "sec=%dt:~12,2%"
::
:: Remove leading zero from MM (e.g 09 > 9)
::
for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I
::
:: Index into array to get month name
::
for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I"
::
:: Check for git.exe presence
::
CALL git.exe describe >NUL 2>&1
set errlvl="%ERRORLEVEL%"
::
:: Read old appversion.h, if present
::
IF EXIST "%srcdir%\appversion.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do (
IF %%i==#define (
IF %%j==APP_VERSION (
:: Remove quotes
set v=%%k
set old_version=!v:"=!
)
)
)
)
::
:: Check %fileinc% if present to generate
::
IF NOT [%fileinc%]==[] (
set genereate_inc=1
)
::
:: Read old %fileinc%, if present
::
IF [%genereate_inc%]==[1] (
IF EXIST "%srcdir%\%fileinc%" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\%fileinc%") do (
IF %%i==#define (
IF %%j==REAPI_VERSION (
:: Remove quotes
set v=%%k
set old_version_inc=!v:"=!
)
)
)
)
)
IF %errlvl% == "1" (
echo can't locate git.exe - auto-versioning step won't be performed
:: if we haven't appversion.h, we need to create it
IF NOT "%old_version%" == "" (
set commitCount=0
)
)
::
:: Read major, minor and maintenance version components from Version.h
::
IF EXIST "%srcdir%\version.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
IF %%i==#define (
IF %%j==VERSION_MAJOR set version_major=%%k
IF %%j==VERSION_MINOR set version_minor=%%k
IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k
)
)
)
::
:: Read revision and release date from it
::
IF NOT %errlvl% == "1" (
:: Get current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
set branch_name=%%i
)
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO (
IF NOT [%%i] == [] (
set commitCount=%%i
)
)
)
::
:: Get remote url repository
::
IF NOT %errlvl% == "1" (
set branch_remote=origin
:: Get remote name by current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
set branch_remote=%%i
)
:: Get remote url
FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: Get commit id
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO (
set shafull=%%i
set commitSHA=!shafull:~0,+7!
)
IF [!commitURL!] == [] (
FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: append extra string
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=!commitURL!/commits/
) ELSE (
set commitURL=!commitURL!/commit/
)
) ELSE (
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: replace : to /
set commitURL=!commitURL::=/!
:: append extra string
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=https://!commitURL!/commit/
) ELSE (
set commitURL=https://!commitURL!/commits/
)
)
)
::
:: Detect local modifications
::
set localChanged=0
IF NOT %errlvl% == "1" (
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO (
set localChanged=1
)
)
IF [%localChanged%]==[1] (
set version_modifed=+m
)
::
:: Now form full version string like 1.0.0.1
::
set new_version_inc=%version_major%%version_minor%%commitCount%
set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed%
::
:: Update appversion.h if version has changed or modifications/mixed revisions detected
::
IF NOT "%new_version%"=="%old_version%" (
goto _update
)
::
:: Update %fileinc% if version has changed or modifications/mixed revisions detected
::
IF [%genereate_inc%]==[1] (
IF NOT "%new_version_inc%"=="%old_version_inc%" (
goto _update
)
)
goto _exit
:_update
::
:: Write %fileinc%
::
IF [%genereate_inc%]==[1] (
echo Updating %fileinc%, new version is "%new_version_inc%", the old one was %old_version_inc%
echo #if defined _reapi_version_included>"%srcdir%\%fileinc%"
echo #endinput>>"%srcdir%\%fileinc%"
echo #endif>>"%srcdir%\%fileinc%"
echo #define _reapi_version_included>>"%srcdir%\%fileinc%"
echo.>>"%srcdir%\%fileinc%"
>>"%srcdir%\%fileinc%" echo // REAPI version
>>"%srcdir%\%fileinc%" echo #define REAPI_VERSION %version_major%%version_minor%%commitCount%
>>"%srcdir%\%fileinc%" echo #define REAPI_VERSION_MAJOR %version_major%
>>"%srcdir%\%fileinc%" echo #define REAPI_VERSION_MINOR %version_minor%
)
::
:: Write appversion.h
::
echo Updating appversion.h, new version is "%new_version%", the old one was %old_version%
echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h"
echo #define __APPVERSION_H__>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo //>>"%srcdir%\appversion.h"
echo // This file is generated automatically.>>"%srcdir%\appversion.h"
echo // Don't edit it.>>"%srcdir%\appversion.h"
echo //>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo // Version defines>>"%srcdir%\appversion.h"
echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h"
>>"%srcdir%\appversion.h" echo #define APP_VERSION_C %version_major%,%version_minor%,%version_maintenance%,%commitCount%
echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_maintenance%.%commitCount%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_FLAGS 0x0L>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h"
echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h"
echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
:_exit
exit /B 0

202
reapi/version/appversion.sh Executable file
View File

@ -0,0 +1,202 @@
#!/bin/bash
init()
{
SOURCE_DIR=$1
GIT_DIR=$SOURCE_DIR
VERSION_FILE=$SOURCE_DIR/reapi/version/version.h
APPVERSION_FILE=$SOURCE_DIR/reapi/version/appversion.h
APPVERSION_FILE_INC=$2
GENERATE_INC=0
PREFIX_INC_LOWER=${APPVERSION_FILE_INC,,}
PREFIX_INC_UPPER=${APPVERSION_FILE_INC^^}
DEFINE_PREFIXINC="#define ${PREFIX_INC_UPPER}_VERSION"
if test -z "`git --version`"; then
echo "Please install git client"
echo "sudo apt-get install git"
exit -1
fi
#
# Read old version from $APPVERSION_FILE_INC, if present
#
if [ $? -ne 0 -o "$APPVERSION_FILE_INC" != "" ] && [ $? -ne 0 -o "$PREFIX_INC_UPPER" != "" ]; then
APPVERSION_FILE_INC=$SOURCE_DIR/reapi/version/${APPVERSION_FILE_INC}_version.inc
if [ $? -ne 0 -o "$APPVERSION_FILE_INC" != "" ] && [ $? -ne 0 -o "$PREFIX_INC_UPPER" != "" ]; then
if test -f $APPVERSION_FILE_INC ; then
OLD_VERSION_INC=$(cat $APPVERSION_FILE_INC | grep -wi "$DEFINE_PREFIXINC" | sed -e "s/$DEFINE_PREFIXINC.*[^0-9]\([0-9][0-9]*\).*/\1/i" -e "s/\r//g")
fi
GENERATE_INC=1
fi
fi
# Read old version
if [ -e $APPVERSION_FILE ]; then
OLD_VERSION=$(cat $APPVERSION_FILE | grep -wi '#define APP_VERSION' | sed -e 's/#define APP_VERSION[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
OLD_VERSION=""
else
# Remove quotes
OLD_VERSION=$(echo $OLD_VERSION | xargs)
fi
fi
# Get major, minor and maintenance information from gradle.properties
MAJOR=$(cat "$VERSION_FILE" | grep -wi 'VERSION_MAJOR' | sed -e 's/.*VERSION_MAJOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g')
if [ $? -ne 0 -o "$MAJOR" = "" ]; then
MAJOR=0
fi
MINOR=$(cat "$VERSION_FILE" | grep -wi 'VERSION_MINOR' | sed -e 's/.*VERSION_MINOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g')
if [ $? -ne 0 -o "$MINOR" = "" ]; then
MINOR=0
fi
MAINTENANCE=$(cat "$VERSION_FILE" | grep -i 'VERSION_MAINTENANCE' | sed -e 's/.*VERSION_MAINTENANCE.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g')
if [ $? -ne 0 -o "$MAINTENANCE" = "" ]; then
MAINTENANCE=0
fi
BRANCH_NAME=$(git -C "$GIT_DIR/" rev-parse --abbrev-ref HEAD)
if [ $? -ne 0 -o "$BRANCH_NAME" = "" ]; then
BRANCH_NAME=master
fi
COMMIT_COUNT=$(git -C "$GIT_DIR/" rev-list --count $BRANCH_NAME)
if [ $? -ne 0 -o "$COMMIT_COUNT" = "" ]; then
COMMIT_COUNT=0
fi
#
# Configure remote url repository
#
# Get remote name by current branch
BRANCH_REMOTE=$(git -C "$GIT_DIR/" config branch.$BRANCH_NAME.remote)
if [ $? -ne 0 -o "$BRANCH_REMOTE" = "" ]; then
BRANCH_REMOTE=origin
fi
# Get commit id
COMMIT_SHA=$(git -C "$GIT_DIR/" rev-parse --verify HEAD)
COMMIT_SHA=${COMMIT_SHA:0:7}
# Get remote url
COMMIT_URL=$(git -C "$GIT_DIR/" config remote.$BRANCH_REMOTE.url)
URL_CONSTRUCT=0
if [[ "$COMMIT_URL" == *"git@"* ]]; then
URL_CONSTRUCT=1
# Strip prefix 'git@'
COMMIT_URL=${COMMIT_URL#git@}
# Strip postfix '.git'
COMMIT_URL=${COMMIT_URL%.git}
# Replace ':' to '/'
COMMIT_URL=${COMMIT_URL/:/\/}
elif [[ "$COMMIT_URL" == *"https://"* ]]; then
URL_CONSTRUCT=1
# Strip prefix 'https://'
COMMIT_URL=${COMMIT_URL#https://}
# Strip postfix '.git'
COMMIT_URL=${COMMIT_URL%.git}
fi
if test "$URL_CONSTRUCT" -eq 1; then
# Append extra string
if [[ "$COMMIT_URL" == *"bitbucket.org"* ]]; then
COMMIT_URL=$(echo https://$COMMIT_URL/commits/)
else
COMMIT_URL=$(echo https://$COMMIT_URL/commit/)
fi
fi
#
# Detect local modifications
#
if [ `git -C "$GIT_DIR/" ls-files -m | wc -l` = 0 ]; then
MODIFIED=
else
MODIFIED=+m
fi
NEW_VERSION_INC="$MAJOR$MINOR$COMMIT_COUNT"
NEW_VERSION="$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT-dev$MODIFIED"
# Update appversion.h if version has changed or modifications/mixed revisions detected
if [ "$NEW_VERSION" != "$OLD_VERSION" ] || [ "$NEW_VERSION_INC" != "$OLD_VERSION_INC" ]; then
update_appversion
fi
}
update_appversion()
{
if test "$GENERATE_INC" -eq 1; then
update_appversion_inc
fi
day=$(date +%d)
year=$(date +%Y)
hours=$(date +%H:%M:%S)
month=$(LANG=en_us_88591; date +"%b")
# Write appversion.h
echo Updating appversion.h, new version is '"'$NEW_VERSION'"', the old one was $OLD_VERSION
echo -e "#ifndef __APPVERSION_H__\r">$APPVERSION_FILE
echo -e "#define __APPVERSION_H__\r">>$APPVERSION_FILE
echo -e "\r">>$APPVERSION_FILE
echo -e "//\r">>$APPVERSION_FILE
echo -e "// This file is generated automatically.\r">>$APPVERSION_FILE
echo -e "// Don't edit it.\r">>$APPVERSION_FILE
echo -e "//\r">>$APPVERSION_FILE
echo -e "\r">>$APPVERSION_FILE
echo -e "// Version defines\r">>$APPVERSION_FILE
echo -e '#define APP_VERSION "'$NEW_VERSION'"\r'>>$APPVERSION_FILE
echo -e "#define APP_VERSION_C $MAJOR,$MINOR,$MAINTENANCE,$COMMIT_COUNT\r">>$APPVERSION_FILE
echo -e '#define APP_VERSION_STRD "'$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT'"\r'>>$APPVERSION_FILE
echo -e "#define APP_VERSION_FLAGS 0x0L\r">>$APPVERSION_FILE
echo -e "\r">>$APPVERSION_FILE
echo -e '#define APP_COMMIT_DATE "'$month $day $year'"\r'>>$APPVERSION_FILE
echo -e '#define APP_COMMIT_TIME "'$hours'"\r'>>$APPVERSION_FILE
echo -e "\r">>$APPVERSION_FILE
echo -e '#define APP_COMMIT_SHA "'$COMMIT_SHA'"\r'>>$APPVERSION_FILE
echo -e '#define APP_COMMIT_URL "'$COMMIT_URL'"\r'>>$APPVERSION_FILE
echo -e "\r">>$APPVERSION_FILE
echo -e "#endif //__APPVERSION_H__\r">>$APPVERSION_FILE
}
update_appversion_inc()
{
echo Updating $APPVERSION_FILE_INC, new version is '"'$NEW_VERSION_INC'"', the old one was $OLD_VERSION_INC
echo -e "#if defined _${PREFIX_INC_LOWER}_version_included\r">$APPVERSION_FILE_INC
echo -e " #endinput\r">>$APPVERSION_FILE_INC
echo -e "#endif\r">>$APPVERSION_FILE_INC
echo -e "#define _${PREFIX_INC_LOWER}_version_included\r">>$APPVERSION_FILE_INC
echo -e "\r">>$APPVERSION_FILE_INC
echo -e "// $PREFIX_INC_LOWER version\r">>$APPVERSION_FILE_INC
echo -e "#define ${PREFIX_INC_UPPER}_VERSION $NEW_VERSION_INC\r">>$APPVERSION_FILE_INC
echo -e "#define ${PREFIX_INC_UPPER}_VERSION_MAJOR $MAJOR\r">>$APPVERSION_FILE_INC
echo -e "#define ${PREFIX_INC_UPPER}_VERSION_MINOR $MINOR\r">>$APPVERSION_FILE_INC
}
# Initialise
init $*
# Exit normally
exit 0

83
reapi/version/glibc_test.sh Executable file
View File

@ -0,0 +1,83 @@
#!/bin/bash
main()
{
files=($@)
declare -A threshold_version
threshold_version[CXXABI]="1.3.5"
threshold_version[GLIBCXX]="3.4.15"
threshold_version[GLIBC]="2.11"
for k in "${!threshold_version[@]}"; do
for f in "${files[@]}"
do
:
version=$(readelf -sV $f | sed -n 's/.*@'$k'_//p' | sort -u -V | tail -1 | cut -d ' ' -f 1)
# version no present - skipped
if [[ -z "$version" ]]; then
version="UND"
# version is private - skipped
elif [ "$version" = "PRIVATE" ]; then
version="PRV"
# ensure numeric
elif [[ $version =~ ^([0-9]+\.){0,2}(\*|[0-9]+)$ ]]; then
check_version_greater $version ${threshold_version[$k]}
if [[ $? -eq 1 ]]; then
echo -e "\033[0;31mAssertion failed:\033[0m Binary \033[0;32m${f}\033[0m has ${k}_\033[0;33m$version\033[0m greater than max version ${k}_\033[0;33m${threshold_version[$k]}\033[0m"
exit -1
fi
fi
done
if [[ "$version" = "PRV" || "$version" = "UND" ]]; then
echo -e "[\033[0;90mSKIP\033[0m] \033[0;33m${version}\033[0m < ${k}_\033[0;33m${threshold_version[$k]}\033[0m"
else
echo -e "[\033[0;32mOK\033[0m] \033[0;33m${version}\033[0m < ${k}_\033[0;33m${threshold_version[$k]}\033[0m"
fi
done
}
check_version_greater()
{
if [[ -z "$1" || $1 == $2 ]]; then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i = 0; i < ${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
break
fi
done
return 0
}
# Initialize
main $*
# Exit normally
exit 0

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\appversion.h" />
<ClInclude Include="..\version.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\reapi_version.inc" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8520B2EC-8DE2-4B76-8FA7-02F156C79C04}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
<ProjectName>version</ProjectName>
<RootNamespace>version</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeBuildCommandLine>ECHO Setup version from Git revision
IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\" "reapi_version.inc")</NMakeBuildCommandLine>
<NMakeOutput>
</NMakeOutput>
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeCleanCommandLine>echo ON
del /s "$(ProjectDir)..\appversion.h" "$(ProjectDir)..\reapi_version.inc" &gt;nul 2&gt;&amp;1</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>ECHO Setup version from Git revision
IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\" "reapi_version.inc")</NMakeReBuildCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<NMakeBuildCommandLine>ECHO Setup version from Git revision
IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\" "reapi_version.inc")</NMakeBuildCommandLine>
<NMakeOutput>
</NMakeOutput>
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeCleanCommandLine>echo ON
del /s "$(ProjectDir)..\appversion.h" "$(ProjectDir)..\reapi_version.inc" &gt;nul 2&gt;&amp;1</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>ECHO Setup version from Git revision
IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\" "reapi_version.inc")</NMakeReBuildCommandLine>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="..\appversion.h" />
<ClInclude Include="..\version.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\reapi_version.inc" />
</ItemGroup>
</Project>

10
reapi/version/version.h Normal file
View File

@ -0,0 +1,10 @@
/*
* Version declaration dependency file
*
*/
#pragma once
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_MAINTENANCE 0