Skip to content

Commit

Permalink
Added gradle task buildFixes for faster building.
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jul 17, 2016
1 parent 8914b84 commit 1e8180f
Show file tree
Hide file tree
Showing 23 changed files with 562 additions and 232 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ icc (ICC) 15.0.1 20141023
### Building
On Windows:
<pre>gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation:
<pre>gradlew --max-workers=1 clean buildFixes</pre>

On Linux:
<pre>./gradlew --max-workers=1 clean buildRelease</pre>

* For faster building without unit tests use this:exclamation:
<pre>./gradlew --max-workers=1 clean buildFixes</pre>

Compiled binaries will be placed in the build/binaries/ directory

### Credits
Expand Down
18 changes: 18 additions & 0 deletions regamedll/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,24 @@ task buildRelease {
}
}

task buildFixes {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll'
}
}

gradle.taskGraph.whenReady { graph ->
if (!graph.hasTask(buildFixes)) {
return;
}

// skip all tasks with the matched substrings in the name like "test"
def tasks = graph.getAllTasks();
tasks.findAll { it.name.toLowerCase().contains("test") }.each { task ->
task.enabled = false;
}
}

task prepareDevEnvTests {
def regamedllTests = new File(project.projectDir, '_dev/testDemos')

Expand Down
51 changes: 43 additions & 8 deletions regamedll/common/mathlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
*
*/

#ifndef MATHLIB_H
#define MATHLIB_H
#ifdef _WIN32
#pragma once
#endif

#ifdef PLAY_GAMEDLL

Expand Down Expand Up @@ -59,15 +55,41 @@ typedef union DLONG_u

#define M_PI 3.14159265358979323846

#ifdef __cplusplus
#ifdef min
#undef min
#endif

#ifdef max
#undef max
#endif

#ifdef clamp
#undef clamp
#endif

template <typename T>
T Q_min(T a, T b) { return (a < b) ? a : b; }
T min(T a, T b) { return (a < b) ? a : b; }

template <typename T>
T Q_max(T a, T b) { return (a > b) ? a : b; }
T max(T a, T b) { return (a > b) ? a : b; }

template <typename T>
T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; }

#else // __cplusplus

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus

// bitwise operators templates
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator~ (T a) { return (T)~(type)a; }
Expand All @@ -84,9 +106,22 @@ inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }

inline double M_sqrt(int value) {
return sqrt(value);
}

inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}

inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}

#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}

#endif // MATHLIB_H
39 changes: 39 additions & 0 deletions regamedll/common/qlimits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ==========
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================

#ifndef QLIMITS_H
#define QLIMITS_H

#if defined( _WIN32 )
#pragma once
#endif

// DATA STRUCTURE INFO

#define MAX_NUM_ARGVS 50

// SYSTEM INFO
#define MAX_QPATH 64 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname

#define ON_EPSILON 0.1 // point on plane side epsilon

#define MAX_LIGHTSTYLE_INDEX_BITS 6
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)

// Resource counts;
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_SOUND_INDEX_BITS 9
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)

#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)

#endif // QLIMITS_H
12 changes: 3 additions & 9 deletions regamedll/dlls/extdll.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
*
*/

#ifndef EXTDLL_H
#define EXTDLL_H
#ifdef _WIN32
#pragma once
#endif

#pragma warning(disable:4244) // int or float down-conversion
#pragma warning(disable:4305) // int or float data truncation
Expand All @@ -39,9 +35,10 @@
#pragma warning(disable:4100) // unreferenced formal parameter

#include "archtypes.h"
#include "maintypes.h"
#include "regamedll_common.h"

#ifdef _WIN32

#define WIN32_LEAN_AND_MEAN
#define NOWINRES
#define NOSERVICE
Expand All @@ -52,11 +49,9 @@
#include "winsani_out.h"
#undef PlaySound
#else

#include <limits.h>
#include <stdarg.h>
#include <string.h>

#endif // _WIN32

// Misc C-runtime library headers
Expand All @@ -82,5 +77,4 @@ typedef float vec_t; // needed before including progdefs.h
#include "eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"

#endif // EXTDLL_H
#include "extdef.h"
2 changes: 1 addition & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch
Place playerPlace = TheNavAreaGrid.GetPlace(&pev->origin);
const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();

for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter)
for (auto iter = placeList->begin(); iter != placeList->end(); ++iter)
{
if ((*iter)->GetID() == playerPlace)
{
Expand Down
108 changes: 9 additions & 99 deletions regamedll/engine/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,38 @@
*
*/

#ifndef COMMON_H
#define COMMON_H
#ifdef _WIN32
#pragma once
#endif

#include "maintypes.h"
#include "bspfile.h"
#include "FileSystem.h"
#include "info.h"
#include "const.h"
#include "qlimits.h"

// Don't allow overflow
#define SIZEBUF_CHECK_OVERFLOW 0
#define SIZEBUF_ALLOW_OVERFLOW BIT(0)
#define SIZEBUF_OVERFLOWED BIT(1)

/* <6ae> ../common/common.h:82 */
#define MAX_NUM_ARGVS 50
#define NUM_SAFE_ARGVS 7

#define COM_COPY_CHUNK_SIZE 1024
#define COM_MAX_CMD_LINE 256

typedef struct sizebuf_s
{
const char *buffername;
uint16_t flags;
uint16 flags;
byte *data;
int maxsize;
int cursize;
} sizebuf_t;

/* <270aa> ../common/common.h:297 */
typedef struct downloadtime_s
{
qboolean bUsed;
float fTime;
int nBytesRemaining;
} downloadtime_t;

/* <19fa2> ../common/common.h:303 */
typedef struct incomingtransfer_s
{
qboolean doneregistering;
Expand All @@ -74,90 +71,3 @@ typedef struct incomingtransfer_s
float fLastStatusUpdate;
qboolean custom;
} incomingtransfer_t;

#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif // _WIN32

inline double M_sqrt(int value) {
return sqrt(value);
}

inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}

inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}

#define printf2 _printf2
#define chatf _print_chat

#define Q_isspace isspace
#define Q_isalnum isalnum
#define Q_isalpha isalpha

#define Q_malloc malloc
#define Q_calloc calloc
#define Q_alloca alloca
#define Q_free free

#define Q_access _access
#define Q_close _close
#define Q_write _write
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_strlen strlen
#define Q_memcmp memcmp
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
//#define Q_strcasecmp _stricmp // Use Q_stricmp
//#define Q_strncasecmp _strnicmp // Use Q_strnicmp
#define Q_sscanf sscanf
#define Q_strdup _strdup
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr _strlwr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_toupper toupper
#define Q_memmove memmove
//#define Q_strtoull strtoull
//#define Q_FileNameCmp FileNameCmp
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_sqrt sqrt
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fprintf fprintf
#define Q_fclose fclose

#ifdef REGAMEDLL_FIXES
#undef Q_sqrt
#define Q_sqrt M_sqrt
#endif

#endif // COMMON_H
Loading

0 comments on commit 1e8180f

Please sign in to comment.