Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
third-party
glew
Commits
32b2ea52
Commit
32b2ea52
authored
Feb 06, 2016
by
Wes Tarro
Browse files
Fixed building with GCC - needed different options and had to create a dummy
DLL entry to avoid crashes.
parent
969faeaf
Changes
3
Show whitespace changes
Inline
Side-by-side
auto/src/glew_init_gl.c
View file @
32b2ea52
...
...
@@ -124,7 +124,9 @@ static GLenum GLEWAPIENTRY glewContextInit ()
GLEW_VERSION_1_1
=
GLEW_VERSION_1_2
==
GL_TRUE
||
(
major
==
1
&&
minor
>=
1
)
?
GL_TRUE
:
GL_FALSE
;
}
for
(
size_t
i
=
0
;
i
<
sizeof
(
_glewExtensionLookup
)
/
sizeof
(
char
*
);
++
i
)
_glewExtensionString
[
i
]
=
GL_FALSE
;
size_t
n
;
for
(
n
=
0
;
n
<
sizeof
(
_glewExtensionString
)
/
sizeof
(
_glewExtensionString
[
0
]);
++
n
)
_glewExtensionString
[
n
]
=
GL_FALSE
;
if
(
GLEW_VERSION_3_0
)
{
...
...
build/cmake/CMakeLists.txt
View file @
32b2ea52
...
...
@@ -78,6 +78,10 @@ set (GLEW_SRC_FILES ${GLEW_DIR}/src/glew.c)
if
(
WIN32
)
list
(
APPEND GLEW_SRC_FILES
${
GLEW_DIR
}
/build/glew.rc
)
if
((
CMAKE_C_COMPILER_ID MATCHES
"GNU"
)
OR
(
CMAKE_C_COMPILER_ID MATCHES
"Clang"
))
# GCC can't handle not having a DLL entry point, so give it a fake one
list
(
APPEND GLEW_SRC_FILES
${
GLEW_DIR
}
/src/gcc_dll_entry.c
)
endif
()
endif
()
add_library
(
glew SHARED
${
GLEW_SRC_FILES
}
)
...
...
@@ -85,18 +89,21 @@ set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_N
add_library
(
glew_s STATIC
${
GLEW_SRC_FILES
}
)
set_target_properties
(
glew_s PROPERTIES COMPILE_DEFINITIONS
"GLEW_STATIC"
OUTPUT_NAME
"
${
GLEW_LIB_NAME
}
"
PREFIX lib
)
if
(
MSVC
)
# add options from visual studio project
and remove stdlib dependency
# add options from visual studio project
target_compile_definitions
(
glew PRIVATE
"GLEW_BUILD;VC_EXTRALEAN"
)
target_compile_definitions
(
glew_s PRIVATE
"GLEW_STATIC;VC_EXTRALEAN"
)
target_link_libraries
(
glew PRIVATE -BASE:0x62AA0000
)
# kill security checks which are dependent on stdlib
target_compile_options
(
glew PRIVATE -GS-
)
target_compile_options
(
glew_s PRIVATE -GS-
)
target_link_libraries
(
glew PRIVATE -BASE:0x62AA0000 -nodefaultlib -noentry
)
# remove stdlib dependency
target_link_libraries
(
glew PRIVATE -nodefaultlib -noentry
)
elseif
(
WIN32
AND
((
CMAKE_C_COMPILER_ID MATCHES
"GNU"
)
OR
(
CMAKE_C_COMPILER_ID MATCHES
"Clang"
)))
# remove stdlib dependency on windows with GCC and Clang (for similar reasons
# as to MSVC - to allow it to be used with any Windows compiler)
# not thoroughly tested yet!
target_link_libraries
(
glew PRIVATE -nostdlibs -lgcc
)
target_compile_options
(
glew PRIVATE -fno-builtin -fno-stack-protector
)
target_compile_options
(
glew_s PRIVATE -fno-builtin -fno-stack-protector
)
target_link_libraries
(
glew PRIVATE -nostdlib
)
endif
()
target_link_libraries
(
glew PUBLIC
${
GLEW_LIBRARIES
}
)
target_link_libraries
(
glew_s
${
GLEW_LIBRARIES
}
)
...
...
src/gcc_dll_entry.c
0 → 100644
View file @
32b2ea52
#ifdef GLEW_BUILD
#include
<windows.h>
BOOL
WINAPI
DllMainCRTStartup
(
HINSTANCE
instance
,
DWORD
reason
,
LPVOID
reserved
)
{
return
TRUE
;
}
#endif
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment