mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Cleanup.
This commit is contained in:
parent
1de60a4ff7
commit
10017b27bb
123
CMakeLists.txt
123
CMakeLists.txt
@ -10,26 +10,28 @@ set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
||||
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
||||
set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64")
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
option(GLFW_INSTALL "Generate installation target" ON)
|
||||
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
|
||||
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
||||
if (GLFW_DOCUMENT_INTERNALS)
|
||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
|
||||
option(GLFW_USE_MENUBAR "Populate the menu bar on first window creation" ON)
|
||||
else()
|
||||
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_BUILD_DLL 1)
|
||||
endif()
|
||||
|
||||
if (GLFW_USE_EGL)
|
||||
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
||||
"The client library to use; one of opengl, glesv1 or glesv2")
|
||||
@ -66,22 +68,43 @@ endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
|
||||
if (GLFW_DOCUMENT_INTERNALS)
|
||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set GCC-specific flags
|
||||
# Set compiler specific flags
|
||||
#--------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
if (UNIX)
|
||||
add_definitions(-Wall)
|
||||
|
||||
if (UNIX AND BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Export shared library / dynamic library / DLL build option
|
||||
#--------------------------------------------------------------------
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_BUILD_DLL 1)
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||
foreach (flag CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
|
||||
if (${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
if (${flag} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -122,31 +145,10 @@ endif()
|
||||
# Use Win32 for window creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WIN32)
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
|
||||
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||
foreach (flag CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
|
||||
if (${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
if (${flag} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
|
||||
|
||||
# The DLL links against winmm; the static library loads it
|
||||
# That way, both code paths receive testing
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_NO_DLOAD_WINMM 1)
|
||||
list(APPEND glfw_LIBRARIES winmm)
|
||||
endif()
|
||||
endif()
|
||||
@ -244,16 +246,9 @@ if (_GLFW_GLX)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
endif()
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
endif()
|
||||
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
|
||||
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
|
||||
@ -292,8 +287,6 @@ if (_GLFW_EGL)
|
||||
list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${EGL_LIBRARY})
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${EGL_LIBRARY})
|
||||
|
||||
if (UNIX)
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl")
|
||||
endif()
|
||||
@ -319,8 +312,6 @@ endif()
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
|
||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||
|
||||
if (GLFW_USE_MENUBAR)
|
||||
set(_GLFW_USE_MENUBAR 1)
|
||||
endif()
|
||||
@ -329,7 +320,6 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
set(_GLFW_USE_CHDIR 1)
|
||||
endif()
|
||||
|
||||
# Universal build
|
||||
if (GLFW_BUILD_UNIVERSAL)
|
||||
message(STATUS "Building GLFW as Universal Binaries")
|
||||
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
||||
@ -403,7 +393,7 @@ if (DOXYGEN_FOUND)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Install files
|
||||
# Install files other than the library
|
||||
# The library is installed by src/CMakeLists.txt
|
||||
#--------------------------------------------------------------------
|
||||
if (GLFW_INSTALL)
|
||||
@ -419,18 +409,15 @@ if (GLFW_INSTALL)
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc
|
||||
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Uninstall operation
|
||||
# Don't generate this target if a higher-level project already has
|
||||
#--------------------------------------------------------------------
|
||||
if (GLFW_INSTALL AND NOT TARGET uninstall)
|
||||
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
${CMAKE_COMMAND} -P
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
# Only generate this target if no higher-level project already has
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
${CMAKE_COMMAND} -P
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
11
README.md
11
README.md
@ -11,8 +11,7 @@ API changes.
|
||||
|
||||
If you are new to GLFW, you may find the
|
||||
[introductory tutorial](http://www.glfw.org/docs/3.0/quick.html) for GLFW
|
||||
3 useful. If
|
||||
you have used GLFW 2 in the past, there is a
|
||||
3 useful. If you have used GLFW 2 in the past, there is a
|
||||
[transition guide](http://www.glfw.org/docs/3.0/moving.html) for moving to the
|
||||
GLFW 3 API.
|
||||
|
||||
@ -70,8 +69,8 @@ directory of bundled applications to the `Contents/Resources` directory.
|
||||
|
||||
#### Windows specific options
|
||||
|
||||
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version of the
|
||||
Visual C++ runtime library.
|
||||
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
|
||||
static library version of the Visual C++ runtime library.
|
||||
|
||||
|
||||
#### EGL specific options
|
||||
@ -100,6 +99,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
|
||||
|
||||
## Changelog
|
||||
|
||||
- Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles
|
||||
|
||||
|
||||
## Contact
|
||||
|
||||
@ -167,7 +168,7 @@ skills.
|
||||
- Jeff Molofee
|
||||
- Jon Morton
|
||||
- Julian Møller
|
||||
- Ozzy at Orkysquad
|
||||
- Ozzy
|
||||
- Peoro
|
||||
- Braden Pellett
|
||||
- Arturo J. Pérez
|
||||
|
@ -11,10 +11,6 @@ endif()
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/deps)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE)
|
||||
# HACK: This is NOTFOUND on OS X 10.8
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
@ -3,10 +3,6 @@ include_directories(${GLFW_SOURCE_DIR}/src
|
||||
${GLFW_BINARY_DIR}/src
|
||||
${glfw_INCLUDE_DIRS})
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
set(common_HEADERS ${GLFW_BINARY_DIR}/src/config.h internal.h
|
||||
${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h
|
||||
${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h)
|
||||
|
@ -11,10 +11,6 @@ endif()
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/deps)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE)
|
||||
# HACK: This is NOTFOUND on OS X 10.8
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
Loading…
Reference in New Issue
Block a user