Bundle glew instead

This commit is contained in:
Dennis Felsing 2017-10-20 11:12:27 +02:00
parent 02ccc03bea
commit 88c0778b21
12 changed files with 52547 additions and 83 deletions

View file

@ -106,7 +106,6 @@ find_package(Opus)
find_package(Opusfile)
find_package(PythonInterp)
find_package(SDL2)
find_package(GLEW)
find_package(Threads)
if(NOT PREFER_BUNDLED_LIBS)
find_package(ZLIB)
@ -144,7 +143,6 @@ show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_INCLUDEDIR}")
show_dependency_status("Opusfile" ${OPUSFILE_FOUND} "${OPUSFILE_LIBRARY}")
show_dependency_status("PythonInterp" ${PYTHONINTERP_FOUND} "")
show_dependency_status("SDL2" ${SDL2_FOUND} "${SDL2_LIBRARY}")
show_dependency_status("GLEW" ${GLEW_FOUND} "${GLEW_LIBRARY}")
if(ZLIB_FOUND)
message(STATUS " * Zlib found")
else()
@ -177,9 +175,6 @@ endif()
if(CLIENT AND NOT(SDL2_FOUND))
message(SEND_ERROR "You must install SDL2 to compile the DDNet client")
endif()
if(CLIENT AND NOT(GLEW_FOUND))
message(SEND_ERROR "You must install GLEW to compile the DDNet client")
endif()
if(NOT(GTEST_FOUND))
if(DOWNLOAD_GTEST)
message(STATUS "Automatically downloading GTest to be able to run tests")
@ -366,6 +361,12 @@ target_include_directories(png PRIVATE ${ZLIB_INCLUDEDIR})
set(DEP_PNG $<TARGET_OBJECTS:png>)
list(APPEND TARGETS_DEP png)
set_glob(DEP_GLEW_SRC GLOB src/engine/external/glew glew.c glew.h)
add_library(glew OBJECT EXCLUDE_FROM_ALL ${DEP_GLEW_SRC})
set(DEP_GLEW $<TARGET_OBJECTS:glew>)
list(APPEND TARGETS_DEP glew)
if(CLIENT)
# Static dependencies
set_glob(DEP_JSON_SRC GLOB src/engine/external/json-parser json.c json.h)
@ -396,7 +397,6 @@ file(COPY ${CURL_COPY_FILES} DESTINATION .)
file(COPY ${FREETYPE_COPY_FILES} DESTINATION .)
file(COPY ${OPUSFILE_COPY_FILES} DESTINATION .)
file(COPY ${SDL2_COPY_FILES} DESTINATION .)
file(COPY ${GLEW_COPY_FILES} DESTINATION .)
set(COPY_FILES
${CURL_COPY_FILES}
${FREETYPE_COPY_FILES}
@ -736,7 +736,7 @@ if(CLIENT)
)
set(CLIENT_SRC ${ENGINE_CLIENT} ${PLATFORM_CLIENT} ${GAME_CLIENT} ${GAME_EDITOR} ${GAME_GENERATED_CLIENT})
set(DEPS_CLIENT ${DEPS} ${DEP_JSON} ${DEP_PNG} ${DEP_WAV})
set(DEPS_CLIENT ${DEPS} ${DEP_JSON} ${DEP_PNG} ${DEP_WAV} ${DEP_GLEW})
# Libraries
set(LIBS_CLIENT
@ -744,7 +744,6 @@ if(CLIENT)
${CURL_LIBRARIES}
${FREETYPE_LIBRARIES}
${SDL2_LIBRARIES}
${GLEW_LIBRARIES}
# Order of these three is important.
${OPUSFILE_LIBRARIES}
@ -778,7 +777,6 @@ if(CLIENT)
${OPUSFILE_INCLUDE_DIRS}
${OPUS_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
)
list(APPEND TARGETS_OWN ${TARGET_CLIENT})
list(APPEND TARGETS_LINK ${TARGET_CLIENT})

11
bam.lua
View file

@ -18,7 +18,6 @@ Import("other/freetype.lua")
Import("other/curl.lua")
Import("other/opusfile.lua")
Import("other/mysql.lua")
Import("other/glew.lua")
--- Setup Config -------
config = NewConfig()
@ -32,7 +31,6 @@ config:Add(FreeType.OptFind("freetype", true))
config:Add(Curl.OptFind("curl", true))
config:Add(Opusfile.OptFind("opusfile", true))
config:Add(Mysql.OptFind("mysql", false))
config:Add(Glew.OptFind("glew", true))
config:Add(OptString("websockets", false))
config:Finalize("config.lua")
@ -146,7 +144,6 @@ if family == "windows" then
if platform == "win32" then
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/freetype/windows/lib32/libfreetype.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/sdl/windows/lib32/SDL2.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/glew/windows/lib32/glew32.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/curl/windows/lib32/libcurl.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/opus/windows/lib32/libwinpthread-1.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/opus/windows/lib32/libgcc_s_sjlj-1.dll"))
@ -156,7 +153,6 @@ if family == "windows" then
else
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/freetype/windows/lib64/libfreetype.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/sdl/windows/lib64/SDL2.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/glew/windows/lib64/glew32.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/curl/windows/lib64/libcurl.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/opus/windows/lib64/libwinpthread-1.dll"))
table.insert(client_depends, CopyToDirectory(".", "ddnet-libs/opus/windows/lib64/libogg.dll"))
@ -296,6 +292,10 @@ function build(settings)
if config.websockets.value then
libwebsockets = Compile(external_settings, Collect("src/engine/external/libwebsockets/*.c"))
end
if platform ~= "macosx" then
external_settings.cc.defines:Add("GLEW_STATIC")
glew = Compile(external_settings, Collect("src/engine/external/glew/*.c"))
end
-- build game components
engine_settings = settings:Copy()
@ -335,7 +335,6 @@ function build(settings)
end
config.sdl:Apply(client_settings)
config.glew:Apply(client_settings)
config.freetype:Apply(client_settings)
config.curl:Apply(client_settings)
config.opusfile:Apply(client_settings)
@ -381,7 +380,7 @@ function build(settings)
-- build client, server, version server and master server
client_exe = Link(client_settings, "DDNet", game_shared, game_client,
engine, client, game_editor, zlib, pnglite, wavpack,
engine, client, game_editor, zlib, pnglite, wavpack, glew,
client_link_other, client_osxlaunch, jsonparser, libwebsockets, md5, client_notification)
server_exe = Link(server_settings, "DDNet-Server", engine, server,

@ -1 +1 @@
Subproject commit b2bbd8830a44ef1dbc232a4f778e5b9fd67da44e
Subproject commit 9abb67a94170fbf177b1d22ca180c96bd065cab1

View file

@ -1,64 +0,0 @@
Glew = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.use_winlib = 0
if platform == "win32" then
option.value = true
option.use_winlib = 32
elseif platform == "win64" then
option.value = true
option.use_winlib = 64
elseif platform == "linux" and arch == "ia32" then
option.value = true
elseif platform == "linux" and arch == "amd64" then
option.value = true
end
end
local apply = function(option, settings)
settings.cc.includes:Add("ddnet-libs/glew/include")
if option.use_winlib > 0 then
if option.use_winlib == 32 then
settings.link.libpath:Add("ddnet-libs/glew/windows/lib32")
elseif option.use_winlib == 64 then
settings.link.libpath:Add("ddnet-libs/glew/windows/lib64")
end
settings.link.libs:Add("glew32")
elseif platform == "macosx" then
-- no glew
else
settings.link.libs:Add("GLEW")
end
end
local save = function(option, output)
output:option(option, "value")
output:option(option, "use_winlib")
end
local display = function(option)
if option.value == true then
if option.use_winlib == 32 then return "using supplied win32 libraries" end
if option.use_winlib == 64 then return "using supplied win64 libraries" end
return "using value"
else
if option.required then
return "not found (required)"
else
return "not found (optional)"
end
end
end
local o = MakeOption(name, 0, check, save, display)
o.Apply = apply
o.include_path = nil
o.lib_path = nil
o.required = required
return o
end
}

View file

@ -10,7 +10,7 @@
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#else
#include "GL/glew.h"
#include "engine/external/glew/glew.h"
#endif
#include <base/detect.h>

View file

@ -5,7 +5,7 @@
#if defined(CONF_PLATFORM_MACOSX)
#include <OpenGL/gl3.h>
#else
#include "GL/glew.h"
#include "engine/external/glew/glew.h"
#endif
class CGLSL {

View file

@ -5,7 +5,7 @@
#if defined(CONF_PLATFORM_MACOSX)
#include <OpenGL/gl3.h>
#else
#include "GL/glew.h"
#include "engine/external/glew/glew.h"
#endif
class CGLSL;

73
src/engine/external/glew/LICENSE.txt vendored Normal file
View file

@ -0,0 +1,73 @@
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
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
BRIAN PAUL 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.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are 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 Materials.
THE MATERIALS ARE 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
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

190
src/engine/external/glew/README.md vendored Normal file
View file

@ -0,0 +1,190 @@
# GLEW - The OpenGL Extension Wrangler Library
![](http://glew.sourceforge.net/glew.png)
http://glew.sourceforge.net/
https://github.com/nigels-com/glew
[![Build Status](https://travis-ci.org/nigels-com/glew.svg?branch=master)](https://travis-ci.org/nigels-com/glew)
[![Gitter](https://badges.gitter.im/nigels-com/glew.svg)](https://gitter.im/nigels-com/glew?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Download](https://img.shields.io/sourceforge/dm/glew.svg)](https://sourceforge.net/projects/glew/files/latest/download)
## Downloads
Current release is [2.1.0](https://sourceforge.net/projects/glew/files/glew/2.1.0/).
[(Change Log)](http://glew.sourceforge.net/log.html)
Sources available as
[ZIP](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip/download) or
[TGZ](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.tgz/download).
Windows binaries for [32-bit and 64-bit](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0-win32.zip/download).
### Recent snapshots
Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases.
## Build
It is highly recommended to build from a tgz or zip release snapshot.
The code generation workflow is a complex brew of gnu make, perl and python, that works best on Linux or Mac.
For most end-users of GLEW the official releases are the best choice, with first class support.
### Linux and Mac
#### Using GNU Make
##### Install build tools
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev libosmesa-dev`
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel`
##### Build
$ make
$ sudo make install
$ make clean
Targets: `all, glew.lib (sub-targets: glew.lib.shared, glew.lib.static), glew.bin, clean, install, uninstall`
Variables: `SYSTEM=linux-clang, GLEW_DEST=/usr/local, STRIP=`
_Note: may need to make **auto** folder_
#### Using cmake
*CMake 2.8.12 or higher is required.*
##### Install build tools
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libXmu-dev libXi-dev libgl-dev cmake`
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel cmake`
##### Build
$ cd build
$ cmake ./cmake
$ make -j4
| Target | Description |
| ---------- | ----------- |
| glew | Build the glew shared library. |
| glew_s | Build the glew static library. |
| glewinfo | Build the `glewinfo` executable (requires `BUILD_UTILS` to be `ON`). |
| visualinfo | Build the `visualinfo` executable (requires `BUILD_UTILS` to be `ON`). |
| install | Install all enabled targets into `CMAKE_INSTALL_PREFIX`. |
| clean | Clean up build artifacts. |
| all | Build all enabled targets (default target). |
| Variables | Description |
| --------------- | ----------- |
| BUILD_UTILS | Build the `glewinfo` and `visualinfo` executables. |
| GLEW_REGAL | Build in Regal mode. |
| GLEW_OSMESA | Build in off-screen Mesa mode. |
| BUILD_FRAMEWORK | Build as MacOSX Framework. Setting `CMAKE_INSTALL_PREFIX` to `/Library/Frameworks` is recommended. |
### Windows
#### Visual Studio
Use the provided Visual Studio project file in build/vc12/
Projects for vc6 and vc10 are also provided
#### MSYS/Mingw
Available from [Mingw](http://www.mingw.org/)
Requirements: bash, make, gcc
$ mingw32-make
$ mingw32-make install
$ mingw32-make install.all
Alternative toolchain: `SYSTEM=mingw-win32`
#### MSYS2/Mingw-w64
Available from [Msys2](http://msys2.github.io/) and/or [Mingw-w64](http://mingw-w64.org/)
Requirements: bash, make, gcc
$ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc
$ make
$ make install
$ make install.all
Alternative toolchain: `SYSTEM=msys, SYSTEM=msys-win32, SYSTEM=msys-win64`
## glewinfo
`glewinfo` is a command-line tool useful for inspecting the capabilities of an
OpenGL implementation and GLEW support for that. Please include `glewinfo.txt`
with bug reports, as appropriate.
---------------------------
GLEW Extension Info
---------------------------
GLEW version 2.0.0
Reporting capabilities of pixelformat 3
Running on a Intel(R) HD Graphics 3000 from Intel
OpenGL version 3.1.0 - Build 9.17.10.4229 is supported
GL_VERSION_1_1: OK
---------------
GL_VERSION_1_2: OK
---------------
glCopyTexSubImage3D: OK
glDrawRangeElements: OK
glTexImage3D: OK
glTexSubImage3D: OK
...
## Code Generation
A Unix or Mac environment is needed for building GLEW from scratch to
include new extensions, or customize the code generation. The extension
data is regenerated from the top level source directory with:
make extensions
An alternative to generating the GLEW sources from scratch is to
download a pre-generated (unsupported) snapshot:
https://sourceforge.net/projects/glew/files/glew/snapshots/
Travis-built snapshots are also available:
https://glew.s3.amazonaws.com/index.html
## Authors
GLEW is currently maintained by [Nigel Stewart](https://github.com/nigels-com)
with bug fixes, new OpenGL extension support and new releases.
GLEW was developed by [Milan Ikits](http://www.cs.utah.edu/~ikits/)
and [Marcelo Magallon](http://wwwvis.informatik.uni-stuttgart.de/~magallon/).
Aaron Lefohn, Joe Kniss, and Chris Wyman were the first users and also
assisted with the design and debugging process.
The acronym GLEW originates from Aaron Lefohn.
Pasi K&auml;rkk&auml;inen identified and fixed several problems with
GLX and SDL. Nate Robins created the `wglinfo` utility, to
which modifications were made by Michael Wimmer.
## Copyright and Licensing
GLEW is originally derived from the EXTGL project by Lev Povalahev.
The source code is licensed under the
[Modified BSD License](http://glew.sourceforge.net/glew.txt), the
[Mesa 3-D License](http://glew.sourceforge.net/mesa.txt) (MIT) and the
[Khronos License](http://glew.sourceforge.net/khronos.txt) (MIT).
The automatic code generation scripts are released under the
[GNU GPL](http://glew.sourceforge.net/gpl.txt).

1
src/engine/external/glew/VERSION vendored Normal file
View file

@ -0,0 +1 @@
2.1.0

28581
src/engine/external/glew/glew.c vendored Normal file

File diff suppressed because it is too large Load diff

23686
src/engine/external/glew/glew.h vendored Normal file

File diff suppressed because it is too large Load diff