enet: Split enet thirdparty files and allow unbundling

Building against shared libraries only implemented for Linux X11 so far.
TODO: Document Godot's modifications of upstream enet.
This commit is contained in:
Rémi Verschelde 2016-10-10 19:50:51 +02:00
parent 16ba665db6
commit c31ad71f10
26 changed files with 107 additions and 11 deletions

View File

@ -135,6 +135,7 @@ opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes')
opts.Add('enet','ENet library (system/builtin)','builtin')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");

View File

@ -1,8 +1,27 @@
Import('env')
Import('env_modules')
env.add_source_files(env.modules_sources,"*.cpp")
env.add_source_files(env.modules_sources,"*.c")
#TODO: Make it possible to build against system enet
env.Append(CPPPATH = ["#modules/enet"])
# Thirdparty source files
if (env["enet"] != "system"): # builtin
thirdparty_dir = "#thirdparty/enet/"
thirdparty_enet_sources = [
"callbacks.c",
"compress.c",
"host.c",
"list.c",
"packet.c",
"peer.c",
"protocol.c",
"unix.c",
"win32.c",
]
thirdparty_enet_sources = [thirdparty_dir + file for file in thirdparty_enet_sources]
env_modules.add_source_files(env.modules_sources, thirdparty_enet_sources)
env_modules.Append(CPPPATH = [thirdparty_dir])
env_modules.add_source_files(env.modules_sources, "*.cpp")
Export('env_modules')
Export('env')

View File

@ -1,11 +1,6 @@
def can_build(platform):
return True
def configure(env):
pass

View File

@ -1,3 +1,31 @@
/*************************************************************************/
/* networked_multiplayer_enet.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "os/os.h"
#include "io/marshalls.h"
#include "networked_multiplayer_enet.h"

View File

@ -1,3 +1,31 @@
/*************************************************************************/
/* networked_multiplayer_enet.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef NETWORKED_MULTIPLAYER_ENET_H
#define NETWORKED_MULTIPLAYER_ENET_H

View File

@ -149,7 +149,8 @@ def configure(env):
if (env["freetype"]=="yes"):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if (env["enet"] == "system"):
env.ParseConfig('pkg-config libenet --cflags --libs')
env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])

17
thirdparty/README.md vendored
View File

@ -1,6 +1,23 @@
# Third party libraries
## enet
- Upstream: http://enet.bespin.org
- Version: 1.3.13
- License: MIT
Files extracted from upstream source:
- all *.c files in the main directory
- the include/enet/ folder as enet/
- LICENSE file
Important: Some files have been modified by Godot developers so that they work
for all platforms (especially WinRT). Check the diff with the 1.3.13 tarball
before the next update.
## jpeg-compressor
- Upstream: https://github.com/richgel999/jpeg-compressor

7
thirdparty/enet/LICENSE vendored Normal file
View File

@ -0,0 +1,7 @@
Copyright (c) 2002-2016 Lee Salzman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.