From a7463b1f06653c51677e57137fe6482dff26cad5 Mon Sep 17 00:00:00 2001 From: Yesh Date: Thu, 7 Apr 2022 09:29:58 +0800 Subject: [PATCH] Quick fix FreeGLUT quick fix: See `https://github.com/dcnieho/FreeGLUT/pull/76` Fixed CMake failure: See `https://github.com/google/liquidfun/issues/110` Also `-Werror` is removed since I am not the one to maintain it --- freeglut/src/fg_gl2.c | 8 ++++++++ freeglut/src/fg_gl2.h | 14 +++++++------- liquidfun/Box2D/CMakeLists.txt | 25 ++++--------------------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/freeglut/src/fg_gl2.c b/freeglut/src/fg_gl2.c index 4ef87be39..10a8cfb01 100644 --- a/freeglut/src/fg_gl2.c +++ b/freeglut/src/fg_gl2.c @@ -27,6 +27,14 @@ #include "fg_internal.h" #include "fg_gl2.h" +FGH_PFNGLGENBUFFERSPROC fghGenBuffers; +FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; +FGH_PFNGLBINDBUFFERPROC fghBindBuffer; +FGH_PFNGLBUFFERDATAPROC fghBufferData; +FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; +FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; +FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; + void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) { if (fgStructure.CurrentWindow != NULL) fgStructure.CurrentWindow->Window.attribute_v_coord = attrib; diff --git a/freeglut/src/fg_gl2.h b/freeglut/src/fg_gl2.h index ab8ba5c7d..fb3d46760 100644 --- a/freeglut/src/fg_gl2.h +++ b/freeglut/src/fg_gl2.h @@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -FGH_PFNGLGENBUFFERSPROC fghGenBuffers; -FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; -FGH_PFNGLBINDBUFFERPROC fghBindBuffer; -FGH_PFNGLBUFFERDATAPROC fghBufferData; -FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; -FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; -FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; +extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers; +extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; +extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer; +extern FGH_PFNGLBUFFERDATAPROC fghBufferData; +extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; +extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; +extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; # endif diff --git a/liquidfun/Box2D/CMakeLists.txt b/liquidfun/Box2D/CMakeLists.txt index 4f2461c5b..69df7ce0a 100644 --- a/liquidfun/Box2D/CMakeLists.txt +++ b/liquidfun/Box2D/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.7) project(Box2D) @@ -75,7 +75,7 @@ if(MSVC) elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) # Set the maximum warning level for gcc. - set(C_FLAGS_WARNINGS "-Wall -Werror -Wno-long-long -Wno-variadic-macros") + set(C_FLAGS_WARNINGS "-Wall -Wno-long-long -Wno-variadic-macros") endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_WARNINGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_FLAGS_WARNINGS}") @@ -99,23 +99,6 @@ if (BOX2D_CODE_COVERAGE AND set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}") endif() -# The XCode generator ignores CMAKE_C_FLAGS AND CMAKE_CXX_FLAGS so flags -# need to be added with target properties. -# The following functions track the list of targets so that it's possible to -# add flags to all targets using target properties. -set(ALL_TARGETS "" CACHE INTERNAL "") -# Override add_library() and adding the target to the ALL_TARGETS variable. -function(add_library name) - _add_library(${name} ${ARGN}) - set(ALL_TARGETS "${ALL_TARGETS}" "${name}" CACHE INTERNAL "") -endfunction(add_library) - -# Override add_executable() and adding the target to the ALL_TARGETS variable. -function(add_executable name) - _add_executable(${name} ${ARGN}) - set(ALL_TARGETS "${ALL_TARGETS}" "${name}" CACHE INTERNAL "") -endfunction(add_executable) - # The Box2D library. add_subdirectory(Box2D) @@ -141,7 +124,7 @@ endif(BOX2D_INSTALL_DOC) # Set the warning flags for all targets when using the Xcode generator. if(CMAKE_COMPILER_IS_CLANGXX) - foreach(target ${ALL_TARGETS}) + foreach(target ${BUILDSYSTEM_TARGETS}) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "${C_FLAGS_WARNINGS}") endforeach(target) @@ -161,7 +144,7 @@ endif() # Override / reset the output directory for all targets. set(LIB_OUTPUT_DIR "${OUTPUT_SUBDIR}") set(EXE_OUTPUT_DIR "${OUTPUT_SUBDIR}") -foreach(target ${ALL_TARGETS}) +foreach(target ${BUILDSYSTEM_TARGETS}) set_target_properties( ${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LIB_OUTPUT_DIR}"