From e6cd59d9b57ac8e96e699b010318c86f7241e2ca Mon Sep 17 00:00:00 2001 From: xantares Date: Wed, 4 Feb 2015 21:27:12 +0100 Subject: [PATCH 01/14] rewrite cmake infrastructure --- CMakeLists.txt | 128 ++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b17b42a..473a268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,82 +1,88 @@ -project(GLEW) -cmake_minimum_required(VERSION 2.4) +if ( NOT DEFINED CMAKE_BUILD_TYPE ) + set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" ) +endif () -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) +project (GLEW) -set(GLEW_VERSION "1.11.0") +cmake_minimum_required (VERSION 2.4) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +if (COMMAND cmake_policy) + cmake_policy (SET CMP0003 NEW) +endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(GLEW_LIB_NAME glew32) -else(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(GLEW_LIB_NAME GLEW) - set(DLL_PREFIX lib) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") +option (BUILD_SHARED_LIBS "build shared/static libs" ON) -# -# All platforms need OpenGL -# +set (GLEW_VERSION "1.12.0") -include(FindPkgConfig) -pkg_check_modules( OpenGL REQUIRED gl ) +set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -# -# Linux needs X11 -# +if (WIN32) + set(GLEW_LIB_NAME glew32) +else () + set(GLEW_LIB_NAME GLEW) + set(DLL_PREFIX lib) +endif () -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - find_package(X11 REQUIRED) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +find_package (OpenGL REQUIRED) +set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) -set(CMAKE_C_FLAGS "${CFLAGS} ${CMAKE_C_FLAGS} -DGLEW_BUILD -DGLEW_NO_GLU -O2 -Wall -W" ) +if (UNIX) + find_package (X11 REQUIRED) + list (APPEND GLEW_LIBRARIES ${X11_LIBRARIES}) +endif () -include_directories( ${PROJECT_SOURCE_DIR}/include ) +add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) -add_library(GLEW_static STATIC src/glew.c ) -add_library(GLEW_shared SHARED src/glew.c ) -set_target_properties(GLEW_static PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME} PREFIX lib) -set_target_properties(GLEW_shared PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME} PREFIX "${DLL_PREFIX}") -target_link_libraries(GLEW_shared ${OpenGL_LDFLAGS}) +include_directories (${PROJECT_SOURCE_DIR}/include) -add_library(GLEW_MX_static STATIC src/glew.c ) -add_library(GLEW_MX_shared SHARED src/glew.c ) -set_target_properties(GLEW_MX_static PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}mx COMPILE_FLAGS "-DGLEW_MX" PREFIX lib) -set_target_properties(GLEW_MX_shared PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}mx COMPILE_FLAGS "-DGLEW_MX" PREFIX "${DLL_PREFIX}") -target_link_libraries(GLEW_MX_shared ${OpenGL_LDFLAGS}) +add_library (glew src/glew.c) +target_link_libraries(glew ${GLEW_LIBRARIES}) +set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) +if (BUILD_SHARED_LIBS) + set_target_properties(glew PROPERTIES PREFIX "${DLL_PREFIX}") +else () + set_target_properties(glew PROPERTIES PREFIX lib) +endif () -add_executable(glewinfo src/glewinfo.c) -target_link_libraries(glewinfo GLEW_shared ${OpenGL_LDFLAGS}) +add_library(glew_mx src/glew.c ) +target_link_libraries (glew_mx ${GLEW_LIBRARIES}) +set_target_properties (glew_mx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(glewinfo ${X11_LIBRARIES}) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if (BUILD_SHARED_LIBS) + set_target_properties (glew_mx PROPERTIES PREFIX "${DLL_PREFIX}") +else () + set_target_properties (glew_mx PROPERTIES PREFIX lib) +endif () + +add_executable (glewinfo src/glewinfo.c) +target_link_libraries(glewinfo glew) add_executable(visualinfo src/visualinfo.c) -target_link_libraries(visualinfo GLEW_shared ${OpenGL_LDFLAGS}) +target_link_libraries(visualinfo glew) -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(visualinfo ${X11_LIBRARIES}) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -install( - TARGETS - GLEW_static - GLEW_shared - GLEW_MX_static - GLEW_MX_shared - glewinfo - visualinfo - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +install ( TARGETS glew glew_mx glewinfo visualinfo + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} ) -install(CODE "execute_process( COMMAND bash -x -c \"sed -e 's%@prefix@%${CMAKE_INSTALL_PREFIX}%g' -e 's%@exec_prefix@%\\\${prefix}%g' -e 's%@libdir@%\\\${prefix}/lib%g' -e 's%@includedir@%\\\${prefix}/include%g' -e 's/\@version\@/${GLEW_VERSION}/g' -e 's/\@cflags\@//g' -e 's/\@libname\@/${GLEW_LIB_NAME}/g' -e 's|@requireslib@|glu|g' < ${CMAKE_SOURCE_DIR}/glew.pc.in > ${CMAKE_BINARY_DIR}/glew.pc\" )" ) -install(CODE "execute_process( COMMAND bash -x -c \"sed -e 's%@prefix@%${CMAKE_INSTALL_PREFIX}%g' -e 's%@exec_prefix@%\\\${prefix}%g' -e 's%@libdir@%\\\${prefix}/lib%g' -e 's%@includedir@%\\\${prefix}/include%g' -e 's/\@version\@/${GLEW_VERSION}/g' -e 's/\@cflags\@/-DGLEW_MX/g' -e 's/\@libname\@/${GLEW_LIB_NAME}mx/g' -e 's|@requireslib@|glu|g' < ${CMAKE_SOURCE_DIR}/glew.pc.in > ${CMAKE_BINARY_DIR}/glewmx.pc\" )" ) +set (prefix ${CMAKE_INSTALL_PREFIX}) +set (exec_prefix \${prefix}) +set (libdir \${prefix}/lib) +set (includedir \${prefix}/include) +set (includedir \${prefix}/include) +set (version ${GLEW_VERSION}) +set (libname ${GLEW_LIB_NAME}) +set (cflags) +set (requireslib glu) +configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glew.pc @ONLY) +set (cflags "-DGLEW_MX") +set (libname ${GLEW_LIB_NAME}mx) +configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glewmx.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/glew.pc ${CMAKE_BINARY_DIR}/glewmx.pc DESTINATION lib/pkgconfig) +install(FILES ${CMAKE_BINARY_DIR}/glew.pc ${CMAKE_BINARY_DIR}/glewmx.pc + DESTINATION lib/pkgconfig +) From b1822129a0bdebb585eb203dfd26192c010b54a4 Mon Sep 17 00:00:00 2001 From: xantares Date: Wed, 4 Feb 2015 21:45:12 +0100 Subject: [PATCH 02/14] Update CMakeLists.txt X11 are part of OPENGL_LIBRARIES --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 473a268..725a144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,11 +28,6 @@ endif () find_package (OpenGL REQUIRED) set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) -if (UNIX) - find_package (X11 REQUIRED) - list (APPEND GLEW_LIBRARIES ${X11_LIBRARIES}) -endif () - add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) include_directories (${PROJECT_SOURCE_DIR}/include) From a5f06123495feb2dc2a8d22e223f1e9071daa4a0 Mon Sep 17 00:00:00 2001 From: xantares Date: Fri, 6 Feb 2015 09:33:39 +0100 Subject: [PATCH 03/14] build static & shared --- CMakeLists.txt | 59 ++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 725a144..a9a6da9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if (COMMAND cmake_policy) cmake_policy (SET CMP0003 NEW) endif() -option (BUILD_SHARED_LIBS "build shared/static libs" ON) +option (BUILD_UTILS "utilities" ON) set (GLEW_VERSION "1.12.0") @@ -19,10 +19,10 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) if (WIN32) - set(GLEW_LIB_NAME glew32) + set (GLEW_LIB_NAME glew32) else () - set(GLEW_LIB_NAME GLEW) - set(DLL_PREFIX lib) + set (GLEW_LIB_NAME GLEW) + set (DLL_PREFIX lib) endif () find_package (OpenGL REQUIRED) @@ -32,38 +32,41 @@ add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) include_directories (${PROJECT_SOURCE_DIR}/include) -add_library (glew src/glew.c) -target_link_libraries(glew ${GLEW_LIBRARIES}) +add_library (glew SHARED src/glew.c) +add_library (glew_s STATIC src/glew.c) +target_link_libraries (glew ${GLEW_LIBRARIES}) +target_link_libraries (glew_s ${GLEW_LIBRARIES}) set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) -if (BUILD_SHARED_LIBS) - set_target_properties(glew PROPERTIES PREFIX "${DLL_PREFIX}") -else () - set_target_properties(glew PROPERTIES PREFIX lib) -endif () +set_target_properties (glew_s PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) +set_target_properties (glew PROPERTIES PREFIX "${DLL_PREFIX}") +set_target_properties (glew_s PROPERTIES PREFIX lib) -add_library(glew_mx src/glew.c ) -target_link_libraries (glew_mx ${GLEW_LIBRARIES}) -set_target_properties (glew_mx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) +add_library(glewmx SHARED src/glew.c ) +add_library(glewmx_s STATIC src/glew.c ) +target_link_libraries (glewmx ${GLEW_LIBRARIES}) +target_link_libraries (glewmx_s ${GLEW_LIBRARIES}) +set_target_properties (glewmx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) +set_target_properties (glewmx_s PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) +set_target_properties (glewmx PROPERTIES PREFIX "${DLL_PREFIX}") +set_target_properties (glewmx_s PROPERTIES PREFIX lib) -if (BUILD_SHARED_LIBS) - set_target_properties (glew_mx PROPERTIES PREFIX "${DLL_PREFIX}") -else () - set_target_properties (glew_mx PROPERTIES PREFIX lib) -endif () - -add_executable (glewinfo src/glewinfo.c) -target_link_libraries(glewinfo glew) - -add_executable(visualinfo src/visualinfo.c) -target_link_libraries(visualinfo glew) - - -install ( TARGETS glew glew_mx glewinfo visualinfo +install ( TARGETS glew glew_s glewmx glewmx_s RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} ) +if (BUILD_UTILS) + add_executable (glewinfo src/glewinfo.c) + target_link_libraries (glewinfo glew) + + add_executable (visualinfo src/visualinfo.c) + target_link_libraries (visualinfo glew) + + install ( TARGETS glewinfo visualinfo + DESTINATION bin) +endif () + set (prefix ${CMAKE_INSTALL_PREFIX}) set (exec_prefix \${prefix}) set (libdir \${prefix}/lib) From ed4fe8ebc4d1c81f3d0950c7f1ee6e7f9f860e26 Mon Sep 17 00:00:00 2001 From: xantares Date: Mon, 9 Feb 2015 16:06:11 +0100 Subject: [PATCH 04/14] set project name to glew --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9a6da9..e248a7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ if ( NOT DEFINED CMAKE_BUILD_TYPE ) set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" ) endif () -project (GLEW) +project (glew) cmake_minimum_required (VERSION 2.4) From 4fcd4688a56cb35b29a0612a3fa05cf6beff62be Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Thu, 19 Feb 2015 21:44:16 +1000 Subject: [PATCH 05/14] [cmake] Move cmake build into build/cmake to avoid collision with established GNUmake build system. --- .gitattributes | 7 ++++--- .gitignore | 4 ++++ CMakeLists.txt => build/cmake/CMakeLists.txt | 22 +++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) rename CMakeLists.txt => build/cmake/CMakeLists.txt (78%) diff --git a/.gitattributes b/.gitattributes index 56c8047..6bd6429 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ -* text eol=lf -*.png binary -build/*/* text eol=crlf +* text eol=lf +*.png binary +build/*/* text eol=crlf +CMakeLists.txt text eol=lf diff --git a/.gitignore b/.gitignore index e182c2f..0cdd347 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ /build/*/*.suo /build/*/*.vcxproj.user /build/*/tmp/ +/build/cmake/CMakeFiles/ +/build/cmake/CMakeCache.txt +/build/cmake/cmake_install.cmake +/build/cmake/Makefile /auto/extensions /auto/registry /bin diff --git a/CMakeLists.txt b/build/cmake/CMakeLists.txt similarity index 78% rename from CMakeLists.txt rename to build/cmake/CMakeLists.txt index e248a7f..4a1cbd6 100644 --- a/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -14,6 +14,8 @@ option (BUILD_UTILS "utilities" ON) set (GLEW_VERSION "1.12.0") +set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..) + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -30,10 +32,10 @@ set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) -include_directories (${PROJECT_SOURCE_DIR}/include) +include_directories (${GLEW_DIR}/include) -add_library (glew SHARED src/glew.c) -add_library (glew_s STATIC src/glew.c) +add_library (glew SHARED ${GLEW_DIR}/src/glew.c) +add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c) target_link_libraries (glew ${GLEW_LIBRARIES}) target_link_libraries (glew_s ${GLEW_LIBRARIES}) set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) @@ -41,8 +43,8 @@ set_target_properties (glew_s PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) set_target_properties (glew PROPERTIES PREFIX "${DLL_PREFIX}") set_target_properties (glew_s PROPERTIES PREFIX lib) -add_library(glewmx SHARED src/glew.c ) -add_library(glewmx_s STATIC src/glew.c ) +add_library(glewmx SHARED ${GLEW_DIR}/src/glew.c ) +add_library(glewmx_s STATIC ${GLEW_DIR}/src/glew.c ) target_link_libraries (glewmx ${GLEW_LIBRARIES}) target_link_libraries (glewmx_s ${GLEW_LIBRARIES}) set_target_properties (glewmx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) @@ -57,10 +59,10 @@ install ( TARGETS glew glew_s glewmx glewmx_s ) if (BUILD_UTILS) - add_executable (glewinfo src/glewinfo.c) + add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c) target_link_libraries (glewinfo glew) - add_executable (visualinfo src/visualinfo.c) + add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c) target_link_libraries (visualinfo glew) install ( TARGETS glewinfo visualinfo @@ -76,11 +78,11 @@ set (version ${GLEW_VERSION}) set (libname ${GLEW_LIB_NAME}) set (cflags) set (requireslib glu) -configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glew.pc @ONLY) +configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY) set (cflags "-DGLEW_MX") set (libname ${GLEW_LIB_NAME}mx) -configure_file (glew.pc.in ${CMAKE_BINARY_DIR}/glewmx.pc @ONLY) +configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glewmx.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/glew.pc ${CMAKE_BINARY_DIR}/glewmx.pc +install(FILES ${GLEW_DIR}/glew.pc ${GLEW_DIR}/glewmx.pc DESTINATION lib/pkgconfig ) From 9a8e815da87c016a67afdc042cafd90bd1d6ffc2 Mon Sep 17 00:00:00 2001 From: xantares Date: Thu, 26 Feb 2015 10:54:39 +0000 Subject: [PATCH 06/14] [cmake] get version from config/version --- build/cmake/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 4a1cbd6..ef84ad2 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -12,10 +12,17 @@ endif() option (BUILD_UTILS "utilities" ON) -set (GLEW_VERSION "1.12.0") - set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..) +# get version from config/version +file (STRINGS ${GLEW_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*") +string (REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${_VERSION_MAJOR_STRING}) +file (STRINGS ${GLEW_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*") +string (REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MINOR ${_VERSION_MINOR_STRING}) +file (STRINGS ${GLEW_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*") +string (REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${_VERSION_PATCH_STRING}) +set (GLEW_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) From 516c9adf41eca4f9ed2ea3410239b21c58481854 Mon Sep 17 00:00:00 2001 From: xantares Date: Thu, 26 Feb 2015 11:00:25 +0000 Subject: [PATCH 07/14] set right export definitions for shared/static libs --- build/cmake/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index ef84ad2..00156f5 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -37,18 +37,16 @@ endif () find_package (OpenGL REQUIRED) set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) -add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU) +add_definitions (-DGLEW_NO_GLU) include_directories (${GLEW_DIR}/include) add_library (glew SHARED ${GLEW_DIR}/src/glew.c) +set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}") add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c) +set_target_properties (glew_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX lib) target_link_libraries (glew ${GLEW_LIBRARIES}) target_link_libraries (glew_s ${GLEW_LIBRARIES}) -set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) -set_target_properties (glew_s PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}) -set_target_properties (glew PROPERTIES PREFIX "${DLL_PREFIX}") -set_target_properties (glew_s PROPERTIES PREFIX lib) add_library(glewmx SHARED ${GLEW_DIR}/src/glew.c ) add_library(glewmx_s STATIC ${GLEW_DIR}/src/glew.c ) From b565769b01119de1e66698f07b00d2cff3de3f4b Mon Sep 17 00:00:00 2001 From: xantares Date: Thu, 26 Feb 2015 11:10:12 +0000 Subject: [PATCH 08/14] fix compile definitions for glewmx too --- build/cmake/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 00156f5..e08fe62 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -42,20 +42,18 @@ add_definitions (-DGLEW_NO_GLU) include_directories (${GLEW_DIR}/include) add_library (glew SHARED ${GLEW_DIR}/src/glew.c) -set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}") +set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}") add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c) set_target_properties (glew_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX lib) target_link_libraries (glew ${GLEW_LIBRARIES}) target_link_libraries (glew_s ${GLEW_LIBRARIES}) add_library(glewmx SHARED ${GLEW_DIR}/src/glew.c ) +set_target_properties (glewmx PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD;GLEW_MX" OUTPUT_NAME "${GLEW_LIB_NAME}mx" PREFIX "${DLL_PREFIX}") add_library(glewmx_s STATIC ${GLEW_DIR}/src/glew.c ) +set_target_properties (glewmx_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC;GLEW_MX" OUTPUT_NAME "${GLEW_LIB_NAME}mx" PREFIX lib) target_link_libraries (glewmx ${GLEW_LIBRARIES}) target_link_libraries (glewmx_s ${GLEW_LIBRARIES}) -set_target_properties (glewmx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) -set_target_properties (glewmx_s PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx) -set_target_properties (glewmx PROPERTIES PREFIX "${DLL_PREFIX}") -set_target_properties (glewmx_s PROPERTIES PREFIX lib) install ( TARGETS glew glew_s glewmx glewmx_s RUNTIME DESTINATION bin From 0c9ab41431e0a9118ccba7fc9c4ef7eca7f67a8a Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Sun, 15 Mar 2015 18:55:29 +1100 Subject: [PATCH 09/14] Changing over makefiles so LDFLAGS.STATIC is used. Also added makefile.darwin-universal for creating a universal static library that can be used properly. --- Makefile | 4 ++-- config/Makefile.cygming | 1 + config/Makefile.cygwin | 2 +- config/Makefile.darwin | 2 +- config/Makefile.darwin-ppc | 2 +- config/Makefile.darwin-universal | 31 +++++++++++++++++++++++++++++++ config/Makefile.darwin-x86_64 | 2 +- config/Makefile.freebsd | 2 +- config/Makefile.gnu | 2 +- config/Makefile.haiku | 2 +- config/Makefile.irix | 1 + config/Makefile.kfreebsd | 2 +- config/Makefile.linux | 2 +- config/Makefile.linux-mingw-w64 | 1 + config/Makefile.linux-mingw32 | 1 + config/Makefile.linux-mingw64 | 1 + config/Makefile.mingw | 1 + config/Makefile.nacl-32 | 2 +- config/Makefile.nacl-64 | 2 +- config/Makefile.netbsd | 2 +- config/Makefile.openbsd | 2 +- config/Makefile.solaris | 1 + config/Makefile.solaris-gcc | 1 + 23 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 config/Makefile.darwin-universal diff --git a/Makefile b/Makefile index 6a9803c..3eb0ad5 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ lib: mkdir lib lib/$(LIB.STATIC): $(LIB.OBJS) - $(AR) cr $@ $^ + $(AR) $(LDFLAGS.STATIC) $@ $^ ifneq ($(STRIP),) $(STRIP) -x $@ endif @@ -148,7 +148,7 @@ glew.pc: glew.pc.in glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc lib/$(LIB.STATIC.MX): $(LIB.OBJS.MX) - $(AR) cr $@ $^ + $(AR) $(LDFLAGS.STATIC) $@ $^ lib/$(LIB.SHARED.MX): $(LIB.SOBJS.MX) $(LD) $(LDFLAGS.SO.MX) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) diff --git a/config/Makefile.cygming b/config/Makefile.cygming index a356c5c..21fdfe4 100644 --- a/config/Makefile.cygming +++ b/config/Makefile.cygming @@ -7,6 +7,7 @@ INCDIR = /usr/include/mingw/GL CC := gcc -mno-cygwin LD := gcc -mno-cygwin LN := +LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = -L$(LIBDIR) WARN = -Wall -W diff --git a/config/Makefile.cygwin b/config/Makefile.cygwin index 8600fd0..ad8f6f0 100644 --- a/config/Makefile.cygwin +++ b/config/Makefile.cygwin @@ -7,7 +7,7 @@ LN := LDFLAGS.EXTRA = LIBDIR = $(GLEW_DEST)/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin b/config/Makefile.darwin index bf34a0e..9812907 100644 --- a/config/Makefile.darwin +++ b/config/Makefile.darwin @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = +LDFLAGS.STATIC = cr LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin-ppc b/config/Makefile.darwin-ppc index 46c8b73..16dcfe8 100644 --- a/config/Makefile.darwin-ppc +++ b/config/Makefile.darwin-ppc @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = +LDFLAGS.STATIC = cr LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin-universal b/config/Makefile.darwin-universal new file mode 100644 index 0000000..8bb00e1 --- /dev/null +++ b/config/Makefile.darwin-universal @@ -0,0 +1,31 @@ +NAME = $(GLEW_NAME) +CC = cc +LD = cc +AR = LIBTOOL +STRIP = +CFLAGS.EXTRA = -dynamic -fno-common +#CFLAGS.EXTRA += -no-cpp-precomp +CFLAGS.EXTRA += -arch i386 -arch x86_64 +LDFLAGS.EXTRA = -arch i386 -arch x86_64 +ifneq (undefined, $(origin GLEW_APPLE_GLX)) +CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX' +LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 +else +LDFLAGS.GL = -framework AGL -framework OpenGL +endif +LDFLAGS.STATIC = -static -o +LDFLAGS.DYNAMIC = +WARN = -Wall -W +POPT = -O2 +CFLAGS.EXTRA += -fPIC +BIN.SUFFIX = +LIB.SONAME = lib$(NAME).$(SO_MAJOR).dylib +LIB.DEVLNK = lib$(NAME).dylib +LIB.SHARED = lib$(NAME).$(SO_VERSION).dylib +LIB.STATIC = lib$(NAME).a +LDFLAGS.SO = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR) +LIB.SONAME.MX = lib$(NAME)mx.$(SO_MAJOR).dylib +LIB.DEVLNK.MX = lib$(NAME)mx.dylib +LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib +LIB.STATIC.MX = lib$(NAME)mx.a +LDFLAGS.SO.MX = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED.MX) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR) diff --git a/config/Makefile.darwin-x86_64 b/config/Makefile.darwin-x86_64 index e6eb050..656ad2c 100644 --- a/config/Makefile.darwin-x86_64 +++ b/config/Makefile.darwin-x86_64 @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = +LDFLAGS.STATIC = cr LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.freebsd b/config/Makefile.freebsd index ca2771d..e60368a 100644 --- a/config/Makefile.freebsd +++ b/config/Makefile.freebsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R6/include -fPIC NAME = GLEW diff --git a/config/Makefile.gnu b/config/Makefile.gnu index b7c58be..f254ca5 100644 --- a/config/Makefile.gnu +++ b/config/Makefile.gnu @@ -3,7 +3,7 @@ CC = cc LD = cc LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.haiku b/config/Makefile.haiku index ce832f9..0ab5a0a 100644 --- a/config/Makefile.haiku +++ b/config/Makefile.haiku @@ -6,7 +6,7 @@ ifneq (undefined, $(origin GLEW_MX)) endif LDFLAGS.GL = -lGL -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW diff --git a/config/Makefile.irix b/config/Makefile.irix index a1be5ee..3ddfcf7 100644 --- a/config/Makefile.irix +++ b/config/Makefile.irix @@ -4,6 +4,7 @@ LD = ld ABI = -64# -n32 CC += $(ABI) LD += $(ABI) +LDFLAGS.STATIC = cr LDFLAGS.EXTRA = LDFLAGS.GL = -lGL -lXext -lX11 NAME = GLEW diff --git a/config/Makefile.kfreebsd b/config/Makefile.kfreebsd index faf1046..8bd089d 100644 --- a/config/Makefile.kfreebsd +++ b/config/Makefile.kfreebsd @@ -3,7 +3,7 @@ CC = cc LD = cc LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.linux b/config/Makefile.linux index 55e4a23..5bbed66 100644 --- a/config/Makefile.linux +++ b/config/Makefile.linux @@ -17,7 +17,7 @@ else LIBDIR = $(GLEW_DEST)/lib endif LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.linux-mingw-w64 b/config/Makefile.linux-mingw-w64 index bedf166..d88a907 100644 --- a/config/Makefile.linux-mingw-w64 +++ b/config/Makefile.linux-mingw-w64 @@ -9,6 +9,7 @@ CC := i686-w64-mingw32-gcc LD := i686-w64-mingw32-ld LN := STRIP := +LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.linux-mingw32 b/config/Makefile.linux-mingw32 index fdb2239..6a1cfbb 100644 --- a/config/Makefile.linux-mingw32 +++ b/config/Makefile.linux-mingw32 @@ -10,6 +10,7 @@ CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := +LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.linux-mingw64 b/config/Makefile.linux-mingw64 index 0e19f6c..43840f7 100644 --- a/config/Makefile.linux-mingw64 +++ b/config/Makefile.linux-mingw64 @@ -10,6 +10,7 @@ CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := +LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.mingw b/config/Makefile.mingw index f1fb194..1bb3b0b 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -3,6 +3,7 @@ NAME = glew32 CC := gcc LD := gcc LN := +LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = -L/mingw/lib WARN = -Wall -W diff --git a/config/Makefile.nacl-32 b/config/Makefile.nacl-32 index 2a5cec7..a5360f5 100644 --- a/config/Makefile.nacl-32 +++ b/config/Makefile.nacl-32 @@ -19,7 +19,7 @@ LDFLAGS.EXTRA += -melf_nacl LDFLAGS.GL = LDFLAGS.GLU = -lRegalGLU LDFLAGS.GLUT = -lRegalGLUT -LDFLAGS.STATIC = +LDFLAGS.STATIC = cr LDFLAGS.DYNAMIC = -shared WARN = -Wall -W -Wno-unused-parameter POPT = -O2 diff --git a/config/Makefile.nacl-64 b/config/Makefile.nacl-64 index 37cb6e9..16af8fd 100644 --- a/config/Makefile.nacl-64 +++ b/config/Makefile.nacl-64 @@ -19,7 +19,7 @@ LDFLAGS.EXTRA += -melf64_nacl LDFLAGS.GL = LDFLAGS.GLU = -lRegalGLU LDFLAGS.GLUT = -lRegalGLUT -LDFLAGS.STATIC = +LDFLAGS.STATIC = cr LDFLAGS.DYNAMIC = -shared WARN = -Wall -W -Wno-unused-parameter POPT = -O2 diff --git a/config/Makefile.netbsd b/config/Makefile.netbsd index 6da47b1..e03d029 100644 --- a/config/Makefile.netbsd +++ b/config/Makefile.netbsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R7/lib -R /usr/X11R7/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R7/include -fPIC NAME = GLEW diff --git a/config/Makefile.openbsd b/config/Makefile.openbsd index ade993e..fcd4eb0 100644 --- a/config/Makefile.openbsd +++ b/config/Makefile.openbsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGLU -lGL -lX11 -lm -LDFLAGS.STATIC = -Wl,-Bstatic +LDFLAGS.STATIC = cr -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R6/include NAME = GLEW diff --git a/config/Makefile.solaris b/config/Makefile.solaris index 96e6d1f..87a53b3 100644 --- a/config/Makefile.solaris +++ b/config/Makefile.solaris @@ -2,6 +2,7 @@ NAME = $(GLEW_NAME) CC = cc LD = ld CFLAGS.EXTRA = -I/usr/openwin/include -Kpic +LDFLAGS.STATIC = cr LDFLAGS.SO = -G LDFLAGS.EXTRA = -L/usr/openwin/lib LDFLAGS.GL = -lGL -lX11 diff --git a/config/Makefile.solaris-gcc b/config/Makefile.solaris-gcc index d66395b..8b92753 100644 --- a/config/Makefile.solaris-gcc +++ b/config/Makefile.solaris-gcc @@ -2,6 +2,7 @@ NAME = $(GLEW_NAME) CC = gcc LD = ld CFLAGS.EXTRA = -I/usr/openwin/include -fPIC +LDFLAGS.STATIC = cr LDFLAGS.SO = -G LDFLAGS.EXTRA = -L/usr/openwin/lib LDFLAGS.GL = -lGL -lX11 From 573eeabd8e04fbe65be656165a6158eed0c33f79 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 21 Feb 2015 20:53:05 +1000 Subject: [PATCH 10/14] [Mac] Migrate glewinfo on Mac from AGL to CGL, with the possibility of running in (core) OpenGL 3.2 mode. --- auto/src/glewinfo_tail.c | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/auto/src/glewinfo_tail.c b/auto/src/glewinfo_tail.c index a2b184a..b48a3f1 100644 --- a/auto/src/glewinfo_tail.c +++ b/auto/src/glewinfo_tail.c @@ -185,26 +185,34 @@ void glewDestroyContext () #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) -#include +#include +#include -AGLContext ctx, octx; +CGLContextObj ctx, octx; GLboolean glewCreateContext () { - int attrib[] = { AGL_RGBA, AGL_NONE }; - AGLPixelFormat pf; - /*int major, minor; - SetPortWindowPort(wnd); - aglGetVersion(&major, &minor); - fprintf(stderr, "GL %d.%d\n", major, minor);*/ - pf = aglChoosePixelFormat(NULL, 0, attrib); - if (NULL == pf) return GL_TRUE; - ctx = aglCreateContext(pf, NULL); - if (NULL == ctx || AGL_NO_ERROR != aglGetError()) return GL_TRUE; - aglDestroyPixelFormat(pf); - /*aglSetDrawable(ctx, GetWindowPort(wnd));*/ - octx = aglGetCurrentContext(); - if (GL_FALSE == aglSetCurrentContext(ctx)) return GL_TRUE; + const CGLPixelFormatAttribute attrib[4] = + { + kCGLPFAAccelerated, /* No software rendering */ +#if 0 + kCGLPFAOpenGLProfile, /* OSX 10.7 Lion onwards */ + (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core, /* 3.2 Core Context */ +#endif + 0 + }; + CGLPixelFormatObj pf; + GLint npix; + CGLError error; + + error = CGLChoosePixelFormat(attrib, &pf, &npix); + if (error) return GL_TRUE; + error = CGLCreateContext(pf, NULL, &ctx); + if (error) return GL_TRUE; + CGLReleasePixelFormat(pf); + octx = CGLGetCurrentContext(); + error = CGLSetCurrentContext(ctx); + if (error) return GL_TRUE; /* Needed for Regal on the Mac */ #if defined(GLEW_REGAL) && defined(__APPLE__) RegalMakeCurrent(ctx); @@ -214,8 +222,8 @@ GLboolean glewCreateContext () void glewDestroyContext () { - aglSetCurrentContext(octx); - if (NULL != ctx) aglDestroyContext(ctx); + CGLSetCurrentContext(octx); + CGLReleaseContext(ctx); } /* ------------------------------------------------------------------------ */ From 69cbc3532f954506e223d3765cb71f7f9e8dea4e Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Mon, 23 Mar 2015 21:16:49 +1100 Subject: [PATCH 11/14] Changed approach to be slightly more resilient to regression issues --- Makefile | 5 +++-- config/Makefile.cygming | 1 - config/Makefile.cygwin | 2 +- config/Makefile.darwin | 2 +- config/Makefile.darwin-ppc | 2 +- config/Makefile.darwin-universal | 2 +- config/Makefile.darwin-x86_64 | 2 +- config/Makefile.freebsd | 2 +- config/Makefile.gnu | 2 +- config/Makefile.haiku | 2 +- config/Makefile.irix | 1 - config/Makefile.kfreebsd | 2 +- config/Makefile.linux | 2 +- config/Makefile.linux-mingw-w64 | 1 - config/Makefile.linux-mingw32 | 1 - config/Makefile.linux-mingw64 | 1 - config/Makefile.mingw | 1 - config/Makefile.nacl-32 | 2 +- config/Makefile.nacl-64 | 2 +- config/Makefile.netbsd | 2 +- config/Makefile.openbsd | 2 +- config/Makefile.solaris | 1 - config/Makefile.solaris-gcc | 1 - 23 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 3eb0ad5..3947b29 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME) # - use LN= on gmake command-line AR ?= ar +ARFLAGS.STATIC ?= cr INSTALL ?= install STRIP ?= strip RM ?= rm -f @@ -104,7 +105,7 @@ lib: mkdir lib lib/$(LIB.STATIC): $(LIB.OBJS) - $(AR) $(LDFLAGS.STATIC) $@ $^ + $(AR) $(ARFLAGS.STATIC) $@ $^ ifneq ($(STRIP),) $(STRIP) -x $@ endif @@ -148,7 +149,7 @@ glew.pc: glew.pc.in glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc lib/$(LIB.STATIC.MX): $(LIB.OBJS.MX) - $(AR) $(LDFLAGS.STATIC) $@ $^ + $(AR) $(ARFLAGS.STATIC) $@ $^ lib/$(LIB.SHARED.MX): $(LIB.SOBJS.MX) $(LD) $(LDFLAGS.SO.MX) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) diff --git a/config/Makefile.cygming b/config/Makefile.cygming index 21fdfe4..a356c5c 100644 --- a/config/Makefile.cygming +++ b/config/Makefile.cygming @@ -7,7 +7,6 @@ INCDIR = /usr/include/mingw/GL CC := gcc -mno-cygwin LD := gcc -mno-cygwin LN := -LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = -L$(LIBDIR) WARN = -Wall -W diff --git a/config/Makefile.cygwin b/config/Makefile.cygwin index ad8f6f0..8600fd0 100644 --- a/config/Makefile.cygwin +++ b/config/Makefile.cygwin @@ -7,7 +7,7 @@ LN := LDFLAGS.EXTRA = LIBDIR = $(GLEW_DEST)/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin b/config/Makefile.darwin index 9812907..bf34a0e 100644 --- a/config/Makefile.darwin +++ b/config/Makefile.darwin @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = cr +LDFLAGS.STATIC = LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin-ppc b/config/Makefile.darwin-ppc index 16dcfe8..46c8b73 100644 --- a/config/Makefile.darwin-ppc +++ b/config/Makefile.darwin-ppc @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = cr +LDFLAGS.STATIC = LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin-universal b/config/Makefile.darwin-universal index 8bb00e1..17e7e4a 100644 --- a/config/Makefile.darwin-universal +++ b/config/Makefile.darwin-universal @@ -13,7 +13,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = -static -o +ARFLAGS.STATIC = -static -o LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.darwin-x86_64 b/config/Makefile.darwin-x86_64 index 656ad2c..e6eb050 100644 --- a/config/Makefile.darwin-x86_64 +++ b/config/Makefile.darwin-x86_64 @@ -10,7 +10,7 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -LDFLAGS.STATIC = cr +LDFLAGS.STATIC = LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.freebsd b/config/Makefile.freebsd index e60368a..ca2771d 100644 --- a/config/Makefile.freebsd +++ b/config/Makefile.freebsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R6/include -fPIC NAME = GLEW diff --git a/config/Makefile.gnu b/config/Makefile.gnu index f254ca5..b7c58be 100644 --- a/config/Makefile.gnu +++ b/config/Makefile.gnu @@ -3,7 +3,7 @@ CC = cc LD = cc LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.haiku b/config/Makefile.haiku index 0ab5a0a..ce832f9 100644 --- a/config/Makefile.haiku +++ b/config/Makefile.haiku @@ -6,7 +6,7 @@ ifneq (undefined, $(origin GLEW_MX)) endif LDFLAGS.GL = -lGL -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW diff --git a/config/Makefile.irix b/config/Makefile.irix index 3ddfcf7..a1be5ee 100644 --- a/config/Makefile.irix +++ b/config/Makefile.irix @@ -4,7 +4,6 @@ LD = ld ABI = -64# -n32 CC += $(ABI) LD += $(ABI) -LDFLAGS.STATIC = cr LDFLAGS.EXTRA = LDFLAGS.GL = -lGL -lXext -lX11 NAME = GLEW diff --git a/config/Makefile.kfreebsd b/config/Makefile.kfreebsd index 8bd089d..faf1046 100644 --- a/config/Makefile.kfreebsd +++ b/config/Makefile.kfreebsd @@ -3,7 +3,7 @@ CC = cc LD = cc LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.linux b/config/Makefile.linux index 5bbed66..55e4a23 100644 --- a/config/Makefile.linux +++ b/config/Makefile.linux @@ -17,7 +17,7 @@ else LIBDIR = $(GLEW_DEST)/lib endif LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW WARN = -Wall -W diff --git a/config/Makefile.linux-mingw-w64 b/config/Makefile.linux-mingw-w64 index d88a907..bedf166 100644 --- a/config/Makefile.linux-mingw-w64 +++ b/config/Makefile.linux-mingw-w64 @@ -9,7 +9,6 @@ CC := i686-w64-mingw32-gcc LD := i686-w64-mingw32-ld LN := STRIP := -LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.linux-mingw32 b/config/Makefile.linux-mingw32 index 6a1cfbb..fdb2239 100644 --- a/config/Makefile.linux-mingw32 +++ b/config/Makefile.linux-mingw32 @@ -10,7 +10,6 @@ CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := -LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.linux-mingw64 b/config/Makefile.linux-mingw64 index 43840f7..0e19f6c 100644 --- a/config/Makefile.linux-mingw64 +++ b/config/Makefile.linux-mingw64 @@ -10,7 +10,6 @@ CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := -LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 WARN = -Wall -W POPT = -O2 diff --git a/config/Makefile.mingw b/config/Makefile.mingw index 1bb3b0b..f1fb194 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -3,7 +3,6 @@ NAME = glew32 CC := gcc LD := gcc LN := -LDFLAGS.STATIC = cr LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = -L/mingw/lib WARN = -Wall -W diff --git a/config/Makefile.nacl-32 b/config/Makefile.nacl-32 index a5360f5..2a5cec7 100644 --- a/config/Makefile.nacl-32 +++ b/config/Makefile.nacl-32 @@ -19,7 +19,7 @@ LDFLAGS.EXTRA += -melf_nacl LDFLAGS.GL = LDFLAGS.GLU = -lRegalGLU LDFLAGS.GLUT = -lRegalGLUT -LDFLAGS.STATIC = cr +LDFLAGS.STATIC = LDFLAGS.DYNAMIC = -shared WARN = -Wall -W -Wno-unused-parameter POPT = -O2 diff --git a/config/Makefile.nacl-64 b/config/Makefile.nacl-64 index 16af8fd..37cb6e9 100644 --- a/config/Makefile.nacl-64 +++ b/config/Makefile.nacl-64 @@ -19,7 +19,7 @@ LDFLAGS.EXTRA += -melf64_nacl LDFLAGS.GL = LDFLAGS.GLU = -lRegalGLU LDFLAGS.GLUT = -lRegalGLUT -LDFLAGS.STATIC = cr +LDFLAGS.STATIC = LDFLAGS.DYNAMIC = -shared WARN = -Wall -W -Wno-unused-parameter POPT = -O2 diff --git a/config/Makefile.netbsd b/config/Makefile.netbsd index e03d029..6da47b1 100644 --- a/config/Makefile.netbsd +++ b/config/Makefile.netbsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R7/lib -R /usr/X11R7/lib LDFLAGS.GL = -lGL -lX11 -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R7/include -fPIC NAME = GLEW diff --git a/config/Makefile.openbsd b/config/Makefile.openbsd index fcd4eb0..ade993e 100644 --- a/config/Makefile.openbsd +++ b/config/Makefile.openbsd @@ -3,7 +3,7 @@ CC = cc LD = ld LDFLAGS.EXTRA = -L/usr/X11R6/lib LDFLAGS.GL = -lGLU -lGL -lX11 -lm -LDFLAGS.STATIC = cr -Wl,-Bstatic +LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic CFLAGS.EXTRA += -I/usr/X11R6/include NAME = GLEW diff --git a/config/Makefile.solaris b/config/Makefile.solaris index 87a53b3..96e6d1f 100644 --- a/config/Makefile.solaris +++ b/config/Makefile.solaris @@ -2,7 +2,6 @@ NAME = $(GLEW_NAME) CC = cc LD = ld CFLAGS.EXTRA = -I/usr/openwin/include -Kpic -LDFLAGS.STATIC = cr LDFLAGS.SO = -G LDFLAGS.EXTRA = -L/usr/openwin/lib LDFLAGS.GL = -lGL -lX11 diff --git a/config/Makefile.solaris-gcc b/config/Makefile.solaris-gcc index 8b92753..d66395b 100644 --- a/config/Makefile.solaris-gcc +++ b/config/Makefile.solaris-gcc @@ -2,7 +2,6 @@ NAME = $(GLEW_NAME) CC = gcc LD = ld CFLAGS.EXTRA = -I/usr/openwin/include -fPIC -LDFLAGS.STATIC = cr LDFLAGS.SO = -G LDFLAGS.EXTRA = -L/usr/openwin/lib LDFLAGS.GL = -lGL -lX11 From aee8b6ff6945074e5b2f3b495332cd627c3ed2c3 Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Thu, 26 Mar 2015 13:24:03 +1100 Subject: [PATCH 12/14] Renamed ARFLAGS.STATIC to simply ARFLAGS --- Makefile | 6 +++--- config/Makefile.darwin-universal | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3947b29..45bc9a4 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME) # - use LN= on gmake command-line AR ?= ar -ARFLAGS.STATIC ?= cr +ARFLAGS ?= cr INSTALL ?= install STRIP ?= strip RM ?= rm -f @@ -105,7 +105,7 @@ lib: mkdir lib lib/$(LIB.STATIC): $(LIB.OBJS) - $(AR) $(ARFLAGS.STATIC) $@ $^ + $(AR) $(ARFLAGS) $@ $^ ifneq ($(STRIP),) $(STRIP) -x $@ endif @@ -149,7 +149,7 @@ glew.pc: glew.pc.in glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc lib/$(LIB.STATIC.MX): $(LIB.OBJS.MX) - $(AR) $(ARFLAGS.STATIC) $@ $^ + $(AR) $(ARFLAGS) $@ $^ lib/$(LIB.SHARED.MX): $(LIB.SOBJS.MX) $(LD) $(LDFLAGS.SO.MX) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) diff --git a/config/Makefile.darwin-universal b/config/Makefile.darwin-universal index 17e7e4a..b2ba4af 100644 --- a/config/Makefile.darwin-universal +++ b/config/Makefile.darwin-universal @@ -2,6 +2,7 @@ NAME = $(GLEW_NAME) CC = cc LD = cc AR = LIBTOOL +ARFLAGS = -static -o STRIP = CFLAGS.EXTRA = -dynamic -fno-common #CFLAGS.EXTRA += -no-cpp-precomp @@ -13,7 +14,6 @@ LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11 else LDFLAGS.GL = -framework AGL -framework OpenGL endif -ARFLAGS.STATIC = -static -o LDFLAGS.DYNAMIC = WARN = -Wall -W POPT = -O2 From 06430b007b1e5c71d2a44272d9933cb7349ae6c5 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Thu, 26 Mar 2015 19:35:52 +1000 Subject: [PATCH 13/14] First try AR, then try LIBTOOL... --- Makefile | 11 +++++++++++ config/Makefile.darwin-universal | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 45bc9a4..792e779 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,11 @@ lib: mkdir lib lib/$(LIB.STATIC): $(LIB.OBJS) +ifneq ($(AR),) $(AR) $(ARFLAGS) $@ $^ +else ifneq ($(LIBTOOL),) + $(LIBTOOL) $@ $^ +endif ifneq ($(STRIP),) $(STRIP) -x $@ endif @@ -149,7 +153,14 @@ glew.pc: glew.pc.in glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc lib/$(LIB.STATIC.MX): $(LIB.OBJS.MX) +ifneq ($(AR),) $(AR) $(ARFLAGS) $@ $^ +else ifneq ($(LIBTOOL),) + $(LIBTOOL) $@ $^ +endif +ifneq ($(STRIP),) + $(STRIP) -x $@ +endif lib/$(LIB.SHARED.MX): $(LIB.SOBJS.MX) $(LD) $(LDFLAGS.SO.MX) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) diff --git a/config/Makefile.darwin-universal b/config/Makefile.darwin-universal index b2ba4af..5f3f278 100644 --- a/config/Makefile.darwin-universal +++ b/config/Makefile.darwin-universal @@ -1,8 +1,8 @@ NAME = $(GLEW_NAME) CC = cc LD = cc -AR = LIBTOOL -ARFLAGS = -static -o +AR = +LIBTOOL = libtool -static -o STRIP = CFLAGS.EXTRA = -dynamic -fno-common #CFLAGS.EXTRA += -no-cpp-precomp From 7c046e2307ba9eed918e437fb85389f14668381c Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sun, 29 Mar 2015 11:43:56 +1000 Subject: [PATCH 14/14] For github pull request #33 - GLEW version in glew.h Allow for tools to extract the GLEW version from glew.h directly. No functional change for C API. See: https://github.com/nigels-com/glew/pull/33/files --- auto/Makefile | 6 +++++- auto/src/glew_tail.h | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/auto/Makefile b/auto/Makefile index e05ceef..a10d44a 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -143,8 +143,12 @@ $(I.DEST)/glew.h: $(EXT)/.dummy $(BIN)/make_struct_var.pl GLEW_VAR_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@ echo -e "\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@ perl -e "s/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/" -pi $@ - rm -f $@.bak cat $(SRC)/glew_tail.h >> $@ + perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@ + perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@ + perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@ + perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@ + rm -f $@.bak $(I.DEST)/wglew.h: $(EXT)/.dummy @echo "--------------------------------------------------------------------" diff --git a/auto/src/glew_tail.h b/auto/src/glew_tail.h index bd9be0a..92ac0bd 100644 --- a/auto/src/glew_tail.h +++ b/auto/src/glew_tail.h @@ -13,6 +13,17 @@ #define GLEW_VERSION_MINOR 3 #define GLEW_VERSION_MICRO 4 +/* ------------------------------------------------------------------------- */ + +/* GLEW version info */ + +/* +VERSION GLEW_VERSION_STRING +VERSION_MAJOR GLEW_VERSION_MAJOR_STRING +VERSION_MINOR GLEW_VERSION_MINOR_STRING +VERSION_MICRO GLEW_VERSION_MICRO_STRING +*/ + /* API */ #ifdef GLEW_MX