mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-03-01 22:29:15 +01:00
Merge branch 'master' of https://github.com/alliedmodders/metamod-source
This commit is contained in:
commit
4973e233d7
21
.travis.yml
Normal file
21
.travis.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
language: cpp
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
before_script:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -y python-software-properties
|
||||||
|
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/ppa
|
||||||
|
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -qq g++-4.8
|
||||||
|
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
|
||||||
|
- echo "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main" | sudo tee --append /etc/apt/sources.list
|
||||||
|
- echo "deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main" | sudo tee --append /etc/apt/sources.list
|
||||||
|
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -y g++-multilib libc6-dev-i386 lib32stdc++6 lib32z1-dev clang-3.5
|
||||||
|
- CHECKOUT_DIR=$PWD && cd .. && $CHECKOUT_DIR/support/checkout-deps.sh && cd $CHECKOUT_DIR
|
||||||
|
script:
|
||||||
|
- mkdir build && cd build
|
||||||
|
- CC=clang-3.5 CXX=clang-3.5 python ../configure.py --enable-optimize
|
||||||
|
- ambuild
|
@ -131,6 +131,7 @@ class MMSConfig(object):
|
|||||||
'-msse',
|
'-msse',
|
||||||
'-m32',
|
'-m32',
|
||||||
]
|
]
|
||||||
|
cfg.cxxflags += [ '-std=c++11' ]
|
||||||
if (cxx.name == 'gcc' and cxx.majorVersion >= 4) or cxx.name == 'clang':
|
if (cxx.name == 'gcc' and cxx.majorVersion >= 4) or cxx.name == 'clang':
|
||||||
cfg.cflags += ['-fvisibility=hidden']
|
cfg.cflags += ['-fvisibility=hidden']
|
||||||
cfg.cxxflags += ['-fvisibility-inlines-hidden']
|
cfg.cxxflags += ['-fvisibility-inlines-hidden']
|
||||||
|
@ -178,8 +178,8 @@ inline OutputClass horrible_cast(const InputClass input){
|
|||||||
// Cause a compile-time error if in, out and u are not the same size.
|
// Cause a compile-time error if in, out and u are not the same size.
|
||||||
// If the compile fails here, it means the compiler has peculiar
|
// If the compile fails here, it means the compiler has peculiar
|
||||||
// unions which would prevent the cast from working.
|
// unions which would prevent the cast from working.
|
||||||
typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
|
static_assert(sizeof(InputClass)==sizeof(u) && sizeof(InputClass)==sizeof(OutputClass),
|
||||||
&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
|
"Can't use horrible cast");
|
||||||
u.in = input;
|
u.in = input;
|
||||||
return u.out;
|
return u.out;
|
||||||
}
|
}
|
||||||
@ -294,8 +294,7 @@ struct SimplifyMemFunc {
|
|||||||
inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
|
inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
|
||||||
GenericMemFuncType &bound_func) {
|
GenericMemFuncType &bound_func) {
|
||||||
// Unsupported member function type -- force a compile failure.
|
// Unsupported member function type -- force a compile failure.
|
||||||
// (it's illegal to have a array with negative size).
|
static_assert(N >= 100, "Unsupported memeber function pointer on this compiler");
|
||||||
typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -352,7 +351,7 @@ struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
|
|||||||
}s;
|
}s;
|
||||||
} u;
|
} u;
|
||||||
// Check that the horrible_cast will work
|
// Check that the horrible_cast will work
|
||||||
typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
|
static_assert(sizeof(function_to_bind)==sizeof(u.s), "Can't use horrible cast");
|
||||||
u.func = function_to_bind;
|
u.func = function_to_bind;
|
||||||
bound_func = u.s.funcaddress;
|
bound_func = u.s.funcaddress;
|
||||||
return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
|
return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
|
||||||
@ -409,9 +408,10 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*sizeof(int) >
|
|||||||
MicrosoftVirtualMFP s;
|
MicrosoftVirtualMFP s;
|
||||||
} u2;
|
} u2;
|
||||||
// Check that the horrible_cast<>s will work
|
// Check that the horrible_cast<>s will work
|
||||||
typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
|
static_assert(sizeof(function_to_bind)==sizeof(u.s)
|
||||||
&& sizeof(function_to_bind)==sizeof(u.ProbeFunc)
|
&& sizeof(function_to_bind)==sizeof(u.ProbeFunc)
|
||||||
&& sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1];
|
&& sizeof(u2.virtfunc)==sizeof(u2.s),
|
||||||
|
"Can't use horrible cast.");
|
||||||
// Unfortunately, taking the address of a MF prevents it from being inlined, so
|
// Unfortunately, taking the address of a MF prevents it from being inlined, so
|
||||||
// this next line can't be completely optimised away by the compiler.
|
// this next line can't be completely optimised away by the compiler.
|
||||||
u2.virtfunc = &GenericVirtualClass::GetThis;
|
u2.virtfunc = &GenericVirtualClass::GetThis;
|
||||||
@ -455,7 +455,7 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
|
|||||||
// We can generate correct code in this case. To prevent an incorrect call from
|
// We can generate correct code in this case. To prevent an incorrect call from
|
||||||
// ever being made, on MSVC6 we generate a warning, and call a function to
|
// ever being made, on MSVC6 we generate a warning, and call a function to
|
||||||
// make the program crash instantly.
|
// make the program crash instantly.
|
||||||
typedef char ERROR_VC6CompilerBug[-100];
|
static_assert(true, "VC6 Compiler Bug");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -487,7 +487,7 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
|
|||||||
} s;
|
} s;
|
||||||
} u;
|
} u;
|
||||||
// Check that the horrible_cast will work
|
// Check that the horrible_cast will work
|
||||||
typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
|
static_assert(sizeof(XFuncType)==sizeof(u.s), "Can't use horrible cast.");
|
||||||
u.func = function_to_bind;
|
u.func = function_to_bind;
|
||||||
bound_func = u.s.funcaddress;
|
bound_func = u.s.funcaddress;
|
||||||
int virtual_delta = 0;
|
int virtual_delta = 0;
|
||||||
@ -781,7 +781,7 @@ public:
|
|||||||
// Ensure that there's a compilation failure if function pointers
|
// Ensure that there's a compilation failure if function pointers
|
||||||
// and data pointers have different sizes.
|
// and data pointers have different sizes.
|
||||||
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
|
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
|
||||||
typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
|
static_assert(sizeof(GenericClass *)==sizeof(function_to_bind), "Can't use evil method.");
|
||||||
m_pthis = horrible_cast<GenericClass *>(function_to_bind);
|
m_pthis = horrible_cast<GenericClass *>(function_to_bind);
|
||||||
// MSVC, SunC++ and DMC accept the following (non-standard) code:
|
// MSVC, SunC++ and DMC accept the following (non-standard) code:
|
||||||
// m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
|
// m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
|
||||||
@ -796,7 +796,7 @@ public:
|
|||||||
// Ensure that there's a compilation failure if function pointers
|
// Ensure that there's a compilation failure if function pointers
|
||||||
// and data pointers have different sizes.
|
// and data pointers have different sizes.
|
||||||
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
|
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
|
||||||
typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
|
static_assert(sizeof(UnvoidStaticFuncPtr)==sizeof(this), "Can't use evil method.");
|
||||||
return horrible_cast<UnvoidStaticFuncPtr>(this);
|
return horrible_cast<UnvoidStaticFuncPtr>(this);
|
||||||
}
|
}
|
||||||
#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
|
#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
|
||||||
|
89
support/checkout-deps.sh
Executable file
89
support/checkout-deps.sh
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# This should be run inside a folder that contains MM:S, otherwise, it will checkout things into "mms-dependencies".
|
||||||
|
|
||||||
|
trap "exit" INT
|
||||||
|
|
||||||
|
ismac=0
|
||||||
|
iswin=0
|
||||||
|
|
||||||
|
archive_ext=tar.gz
|
||||||
|
decomp="tar zxf"
|
||||||
|
|
||||||
|
if [ `uname` = "Darwin" ]; then
|
||||||
|
ismac=1
|
||||||
|
elif [ `uname` != "Linux" ] && [ -n "${COMSPEC:+1}" ]; then
|
||||||
|
iswin=1
|
||||||
|
archive_ext=zip
|
||||||
|
decomp=unzip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "metamod-source" ]; then
|
||||||
|
echo "Could not find a Metamod:Source repository; make sure you aren't running this script inside it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
checkout ()
|
||||||
|
{
|
||||||
|
if [ ! -d "$name" ]; then
|
||||||
|
git clone $repo -b $branch $name
|
||||||
|
if [ -n "$origin" ]; then
|
||||||
|
cd $name
|
||||||
|
git remote rm origin
|
||||||
|
git remote add origin $origin
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cd $name
|
||||||
|
git checkout $branch
|
||||||
|
git pull origin $branch
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sdks=( csgo hl2dm nucleardawn l4d2 dods l4d css tf2 insurgency sdk2013 dota )
|
||||||
|
|
||||||
|
if [ $ismac -eq 0 ]; then
|
||||||
|
# Add these SDKs for Windows or Linux
|
||||||
|
sdks+=( orangebox blade episode1 )
|
||||||
|
|
||||||
|
# Add more SDKs for Windows only
|
||||||
|
if [ $iswin -eq 1 ]; then
|
||||||
|
sdks+=( darkm swarm bgt eye contagion )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check out a local copy as a proxy.
|
||||||
|
if [ ! -d "hl2sdk-proxy-repo" ]; then
|
||||||
|
git clone --mirror https://github.com/alliedmodders/hl2sdk hl2sdk-proxy-repo
|
||||||
|
else
|
||||||
|
cd hl2sdk-proxy-repo
|
||||||
|
git fetch
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
for sdk in "${sdks[@]}"
|
||||||
|
do
|
||||||
|
repo=hl2sdk-proxy-repo
|
||||||
|
origin="https://github.com/alliedmodders/hl2sdk"
|
||||||
|
name=hl2sdk-$sdk
|
||||||
|
branch=$sdk
|
||||||
|
checkout
|
||||||
|
done
|
||||||
|
|
||||||
|
`python -c "import ambuild2"`
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
repo="https://github.com/alliedmodders/ambuild"
|
||||||
|
origin=
|
||||||
|
branch=master
|
||||||
|
name=ambuild
|
||||||
|
checkout
|
||||||
|
|
||||||
|
cd ambuild
|
||||||
|
if [ $iswin -eq 1 ]; then
|
||||||
|
python setup.py install
|
||||||
|
else
|
||||||
|
python setup.py build
|
||||||
|
echo "About to install AMBuild - press Ctrl+C to abort, otherwise enter your password for sudo."
|
||||||
|
sudo python setup.py install
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user