Merge pull request #48 from tehnick/fixes-from-mxe-project

Added FREEGLUT_REPLACE_GLUT configure option for MS Windows
This commit is contained in:
Diederick C. Niehorster 2017-04-22 22:02:53 +02:00 committed by GitHub
commit 0a695848a9

View File

@ -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,12 @@ 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") ENDIF()
SET(PC_FILENAME "freeglut-gles.pc") IF(FREEGLUT_BUILD_STATIC_LIBS)
LIST(APPEND PC_CFLAGS -DFREEGLUT_STATIC)
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)