Added FREEGLUT_REPLACE_GLUT configure option for MS Windows.
It provides back compatibility with older (autotools based) freeglut versions.
Also it simplifies build rules for crossplatform programs: they may be linked
with -lglut regardless of the system and library type (shared/static).
Patch is originally prepared for MXE project (http://mxe.cc/).
(cherry picked from commit cd9ac605ec
)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1793 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
979c5ce24d
commit
c985322fc0
@ -53,11 +53,16 @@ ENDIF()
|
|||||||
# OpenGL ES support
|
# OpenGL ES support
|
||||||
OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
|
OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
|
||||||
|
|
||||||
|
# option to build either as "glut" (ON) or "freeglut" (OFF)
|
||||||
|
IF(WIN32)
|
||||||
|
OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" OFF)
|
||||||
|
ELSE()
|
||||||
|
OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
# Wayland support
|
# Wayland support
|
||||||
OPTION(FREEGLUT_WAYLAND "Use Wayland (no X11)" OFF)
|
OPTION(FREEGLUT_WAYLAND "Use Wayland (no X11)" OFF)
|
||||||
# option to build either as "glut" (ON) or "freeglut" (OFF)
|
|
||||||
OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
@ -391,12 +396,20 @@ ENDIF()
|
|||||||
|
|
||||||
SET(LIBNAME freeglut)
|
SET(LIBNAME freeglut)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
|
IF(FREEGLUT_REPLACE_GLUT)
|
||||||
|
SET(LIBNAME glut)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
LIST(APPEND LIBS winmm)
|
LIST(APPEND LIBS winmm)
|
||||||
IF(FREEGLUT_BUILD_SHARED_LIBS)
|
IF(FREEGLUT_BUILD_SHARED_LIBS)
|
||||||
TARGET_COMPILE_DEFINITIONS(freeglut PRIVATE FREEGLUT_EXPORTS)
|
TARGET_COMPILE_DEFINITIONS(freeglut PRIVATE FREEGLUT_EXPORTS)
|
||||||
|
SET_TARGET_PROPERTIES(freeglut PROPERTIES OUTPUT_NAME ${LIBNAME})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF(FREEGLUT_BUILD_STATIC_LIBS)
|
IF(FREEGLUT_BUILD_STATIC_LIBS)
|
||||||
TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
|
TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
|
||||||
|
IF(FREEGLUT_REPLACE_GLUT)
|
||||||
|
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
|
||||||
|
ENDIF()
|
||||||
# need to set machine:x64 for linker, at least for VC10, and
|
# need to set machine:x64 for linker, at least for VC10, and
|
||||||
# doesn't hurt for older compilers:
|
# doesn't hurt for older compilers:
|
||||||
# http://public.kitware.com/Bug/view.php?id=11240#c22768
|
# http://public.kitware.com/Bug/view.php?id=11240#c22768
|
||||||
@ -563,11 +576,9 @@ ENDIF()
|
|||||||
# Client applications need to define FreeGLUT GLES version to
|
# Client applications need to define FreeGLUT GLES version to
|
||||||
# bootstrap headers inclusion in freeglut_std.h:
|
# bootstrap headers inclusion in freeglut_std.h:
|
||||||
SET(PC_LIBNAME ${LIBNAME})
|
SET(PC_LIBNAME ${LIBNAME})
|
||||||
SET(PC_FILENAME "freeglut.pc")
|
SET(PC_FILENAME "${LIBNAME}.pc")
|
||||||
IF(FREEGLUT_GLES)
|
IF(FREEGLUT_GLES)
|
||||||
SET(PC_CFLAGS "-DFREEGLUT_GLES")
|
SET(PC_CFLAGS "-DFREEGLUT_GLES")
|
||||||
SET(PC_LIBNAME "freeglut-gles")
|
|
||||||
SET(PC_FILENAME "freeglut-gles.pc")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
|
||||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel)
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel)
|
||||||
|
Reference in New Issue
Block a user