diff --git a/SConstruct b/SConstruct index 3f2f1e5b23..19c62a9d15 100644 --- a/SConstruct +++ b/SConstruct @@ -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"); diff --git a/modules/enet/SCsub b/modules/enet/SCsub index d2bc8801e4..79231c63e5 100644 --- a/modules/enet/SCsub +++ b/modules/enet/SCsub @@ -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') diff --git a/modules/enet/config.py b/modules/enet/config.py index ea7e83378a..368e97e152 100644 --- a/modules/enet/config.py +++ b/modules/enet/config.py @@ -1,11 +1,6 @@ - def can_build(platform): - return True - + return True def configure(env): pass - - - diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index ac89c0e9e9..b4dfa9c62e 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -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" diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index f64db4561e..3db318c96a 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -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 diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 98774e8555..10e44976ca 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -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']) diff --git a/thirdparty/README.md b/thirdparty/README.md index 0e512fb867..5c8208b9a5 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -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 diff --git a/thirdparty/enet/LICENSE b/thirdparty/enet/LICENSE new file mode 100644 index 0000000000..39af84a8f6 --- /dev/null +++ b/thirdparty/enet/LICENSE @@ -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. diff --git a/modules/enet/callbacks.c b/thirdparty/enet/callbacks.c similarity index 100% rename from modules/enet/callbacks.c rename to thirdparty/enet/callbacks.c diff --git a/modules/enet/compress.c b/thirdparty/enet/compress.c similarity index 100% rename from modules/enet/compress.c rename to thirdparty/enet/compress.c diff --git a/modules/enet/enet/callbacks.h b/thirdparty/enet/enet/callbacks.h similarity index 100% rename from modules/enet/enet/callbacks.h rename to thirdparty/enet/enet/callbacks.h diff --git a/modules/enet/enet/enet.h b/thirdparty/enet/enet/enet.h similarity index 100% rename from modules/enet/enet/enet.h rename to thirdparty/enet/enet/enet.h diff --git a/modules/enet/enet/list.h b/thirdparty/enet/enet/list.h similarity index 100% rename from modules/enet/enet/list.h rename to thirdparty/enet/enet/list.h diff --git a/modules/enet/enet/protocol.h b/thirdparty/enet/enet/protocol.h similarity index 100% rename from modules/enet/enet/protocol.h rename to thirdparty/enet/enet/protocol.h diff --git a/modules/enet/enet/time.h b/thirdparty/enet/enet/time.h similarity index 100% rename from modules/enet/enet/time.h rename to thirdparty/enet/enet/time.h diff --git a/modules/enet/enet/types.h b/thirdparty/enet/enet/types.h similarity index 100% rename from modules/enet/enet/types.h rename to thirdparty/enet/enet/types.h diff --git a/modules/enet/enet/unix.h b/thirdparty/enet/enet/unix.h similarity index 100% rename from modules/enet/enet/unix.h rename to thirdparty/enet/enet/unix.h diff --git a/modules/enet/enet/utility.h b/thirdparty/enet/enet/utility.h similarity index 100% rename from modules/enet/enet/utility.h rename to thirdparty/enet/enet/utility.h diff --git a/modules/enet/enet/win32.h b/thirdparty/enet/enet/win32.h similarity index 100% rename from modules/enet/enet/win32.h rename to thirdparty/enet/enet/win32.h diff --git a/modules/enet/host.c b/thirdparty/enet/host.c similarity index 100% rename from modules/enet/host.c rename to thirdparty/enet/host.c diff --git a/modules/enet/list.c b/thirdparty/enet/list.c similarity index 100% rename from modules/enet/list.c rename to thirdparty/enet/list.c diff --git a/modules/enet/packet.c b/thirdparty/enet/packet.c similarity index 100% rename from modules/enet/packet.c rename to thirdparty/enet/packet.c diff --git a/modules/enet/peer.c b/thirdparty/enet/peer.c similarity index 100% rename from modules/enet/peer.c rename to thirdparty/enet/peer.c diff --git a/modules/enet/protocol.c b/thirdparty/enet/protocol.c similarity index 100% rename from modules/enet/protocol.c rename to thirdparty/enet/protocol.c diff --git a/modules/enet/unix.c b/thirdparty/enet/unix.c similarity index 100% rename from modules/enet/unix.c rename to thirdparty/enet/unix.c diff --git a/modules/enet/win32.c b/thirdparty/enet/win32.c similarity index 100% rename from modules/enet/win32.c rename to thirdparty/enet/win32.c