• Stars
    star
    108
  • Rank 319,655 (Top 7 %)
  • Language
    C++
  • License
    Other
  • Created almost 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A repository of common bits for compilation projects based on Garry's Mod.

garrysmod_common

A repository of common bits for compilation projects based on Garry's Mod.

The include directory has all the required headers for building modules for Garry's Mod (LuaJIT and Garry's Mod headers) with C++.

There's common code for premake on the premake directory for faster development. premake5 is required to generate projects.

Warning

As a rule of thumb, avoid diverging too much from these rules:

  • On Windows, compile with Visual Studio 2015, Visual Studio 2017 or Visual Studio 2019.
  • On Linux, use GCC (the more up to date, the better, tested up to GCC 9, older versions like GCC 4 and GCC 5 might throw C++ compilation errors).
  • On macOS, any Xcode (using the GCC compiler) version MIGHT work.

Do not use internal classes/structures (like the GameDepot::System class or the IGamemodeSystem::Information structure) unless (these rules are in addition to the previous ones):

  • On Windows and Linux, compile in release mode.
  • On macOS, use the Mac OSX 10.7 SDK, in release mode.

These restrictions are not random; they exist because of ABI compatibility reasons.

If stuff starts erroring or fails to work, be sure to check the correct line endings (\n and such) are present in the files for each OS.

Usage

In your project's premake5.lua (or whatever you named it) you should include your local copy of this repository, for example:

PROJECT_GENERATOR_VERSION = 2

newoption({
    trigger = "gmcommon",
    description = "Sets the path to the garrysmod_common (https://github.com/danielga/garrysmod_common) directory",
    value = "path to garrysmod_common directory"
})

local gmcommon = assert(_OPTIONS.gmcommon or os.getenv("GARRYSMOD_COMMON"),
    "you didn't provide a path to your garrysmod_common (https://github.com/danielga/garrysmod_common) directory")
include(gmcommon)

Creates the workspace with the provided workspace_name, optional workspace_add_debug for including a debug compilation mode (default is true) and optional workspace_path for files (can also be set by premake option (--workspace=path) and by default uses the value in the config file). Must be called at least once before the following functions.

CreateWorkspace({
    name = workspace_name,
    allow_debug = workspace_add_debug, -- optional
    path = workspace_path -- optional
})

Creates the project for the provided state on project_serverside (it's a boolean), optional project_manual_files (allows you to add the source/header files manually through the function files and default is false) and optional project_source_path for source files path (can also be set by premake option --source=path and by default uses the value in the config file, but beware it will be used by all projects).

CreateProject({
    serverside = project_serverside,
    manual_files = project_manual_files, -- optional
    source_path = project_source_path -- optional
})

Call the following functions as needed. The Source SDK based projects do not need a path to the SDK anymore, as it is provided through this git repository as a submodule.

IncludeHelpersExtended() -- uses this repo path
IncludeLuaShared() -- uses this repo path
IncludeDetouring() -- uses this repo detouring submodule
IncludeScanning() -- uses this repo scanning submodule

IncludeSDKCommon()
IncludeSDKTier0()
IncludeSDKTier1()
IncludeSDKTier2()
IncludeSDKTier3()
IncludeSDKMathlib()
IncludeSDKRaytrace()
IncludeSteamAPI()

You can also request the project to auto-install the compiled files to a directory selected by you or automatically found on your system. Use one of the following:

  • Append the --autoinstall flag to your command to either use the GARRYSMOD_LUA_BIN environment var, automatic path finder or the DEFAULT_GARRYSMOD_LUA_BIN_DIRECTORY config (which you have to define yourself in config.lua).
  • Append the --autoinstall=path config to your command to use the path you want.

Using specific MacOSX SDKs is also supported, by using either the premake config --macosx_sdkroot or the preferred SDKROOT environment variable when calling make.

To generate projects with the ability to compile x86-64 binaries, you need to change the project generator version:

  • Either in your premake5.lua config, before including garrysmod_common:

    PROJECT_GENERATOR_VERSION = 3
  • Or in your environment variables, for example:

    PROJECT_GENERATOR_VERSION=3 premake5 gmake

Relevant URLs

https://github.com/ValveSoftware/source-sdk-2013
https://github.com/danielga/sourcesdk-minimal

More Repositories

1

gmsv_serversecure

A module for Garry's Mod that mitigates exploits on the Source engine.
C++
124
star
2

gm_sourcenet

A module for Garry's Mod that provides interfaces to many systems of VALVe's engine, based on gm_sourcenet3.
C++
72
star
3

sourcesdk-minimal

A compact and Garry's Mod compatible SourceSDK (don't use in other Source engine games).
C++
71
star
4

gm_luaerror

A module for Garry's Mod that adds hooks for obtaining errors that happen on the client and server (if activated on server, it also pushes errors from clients).
C++
53
star
5

luapack

A system for Garry's Mod that provides Lua files to clients in a more efficient way. WIP
Lua
34
star
6

gmod_luasocket

Modules for Garry's Mod that add bindings for OS sockets through luasocket.
Lua
27
star
7

detouring

Tools for detouring functions in C/C++.
C++
25
star
8

gmod_lanes

Modules for Garry's Mod that add threads through Lua Lanes.
Lua
24
star
9

gmsv_luapack_internal

Internal binary module for the luapack project.
C++
17
star
10

gm_rdb

A Garry's Mod module that creates a Remote DeBugger server
C++
14
star
11

gm_crypt

A cryptography module for the game Garry's Mod that uses Crypto++.
C++
13
star
12

gm_redis

A Garry's Mod module that adds Redis client capabilities.
C++
13
star
13

gm_concommandx

A module for Garry's Mod that interfaces to interact with concommands from VALVe's engine.
C++
12
star
14

gm_cvarsx

A module for Garry's Mod that interfaces to interact with convars from VALVe's engine.
C++
11
star
15

gmod_require

Modules for Garry's Mod for obtaining pointers to functions inside of modules (specially useful for loading Lua only modules).
C++
10
star
16

gm_spew

A Garry's Mod module that intercepts the engine's messages and passes them to Lua. Also able to prevent them from printing.
C++
10
star
17

gm_stringtable

A module for Garry's Mod that provides interfaces to interact with stringtables from VALVe's engine.
C++
9
star
18

scanning

Tools for symbol/signature scanning in C/C++.
C++
8
star
19

gmsv_xconsole

A Garry's Mod module that provides an interface for external consoles.
C++
8
star
20

gm_logging

A Garry's Mod module that copies the log messages and passes them to Lua. Also able to manipulate logging channels.
C++
7
star
21

gm_process

A Garry's Mod module to create asynchronous child processes. It also allows you to use its error, input and output handles to retrieve or push data to the process.
C++
6
star
22

websocket

A Garry's Mod library that allows the creation of websocket servers and clients.
Lua
6
star
23

eventsystem

A Garry's Mod addon that facilitates the creation of events.
Lua
5
star
24

gm_ffi

A module for Garry's Mod that adds an FFI library similar to LuaJIT's FFI.
C
5
star
25

gm_template

Garry's Mod native modules template (not ready, requires changes to garrysmod_common repository)
Lua
4
star
26

gm_filesystem

A Garry's Mod module that adds an advanced filesystem interface.
C++
3
star
27

luaffisocket

A Lua module that makes use of the FFI library to provide bindings to sockets, in a luasocket compatible interface.
Lua
3
star
28

gmcl_achievementsx

A module for Garry's Mod that provides interfaces to interact with achievements from VALVe's engine.
C++
3
star
29

enet-java

A JNI wrapper for ENet.
C
2
star
30

luainterface

A C++ wrapper for the Lua C API.
C
2
star
31

luabitbuffer

A Lua library for reading and writing bit buffers.
Lua
2
star
32

halloween

A Garry's Mod addon with Halloween spooks.
Lua
2
star
33

garryware

GarryWare - Do what she says
Lua
2
star
34

gmod_luasec

Modules for Garry's Mod that add bindings for OS sockets through luasec.
Lua
2
star
35

uac

A Garry's Mod administration addon.
Lua
2
star
36

gmcl_speech

A module for Garry's Mod that provides speech recognition interfaces to developers.
C++
2
star
37

xconsole

An implementation of an external console for gmsv_xconsole.
C#
2
star
38

gmcl_tts

A module for Garry's Mod that provides text-to-speech interfaces to developers.
C++
2
star
39

mgn

A Garry's Mod secret project.
Lua
2
star
40

sourcequery

A Source engine (VALVe) and respective masterservers querying library.
C++
1
star
41

Author

A 2FA cross-platform application.
C#
1
star
42

c0subset_compiler

A C0 subset compiler that uses Flex and Bison.
C++
1
star
43

multilibrary

A C++ library that covers multiple low level systems.
C++
1
star
44

gm_vararg

A Garry's Mod module for manipulation of variable arguments of functions. Based on lua-vararg which is an unofficial repository of vararg.
Lua
1
star
45

metalgearsolid

This addon brings some fun elements of the Metal Gear games series to Garry's Mod
1
star
46

gframework

A gamemode framework for Garry's Mod.
Lua
1
star
47

http_cache

A Garry's Mod library that allows developers to easily manage caching of resources obtained through the HTTP protocol.
Lua
1
star
48

passepartout

An application that provides two-factor authentication facilities to store secrets and generate OTPs.
Lua
1
star
49

gm_matrix

An extension to Garry's Mod Matrix Lua metatable.
C++
1
star