From 07c31bb4e1cea1750de73aa74e77813b9ee7e5c0 Mon Sep 17 00:00:00 2001 From: martell Date: Thu, 9 Oct 2014 05:22:21 +0100 Subject: [PATCH] Linux: fix glfw3 searching --- cmake/Modules/FindChipmunk.cmake | 2 +- cmake/Modules/FindGLFW3.cmake | 69 ++++++++++++++++++++++++++++++++ cmake/Modules/FindWebP.cmake | 2 +- cocos/CMakeLists.txt | 11 ++++- 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 cmake/Modules/FindGLFW3.cmake diff --git a/cmake/Modules/FindChipmunk.cmake b/cmake/Modules/FindChipmunk.cmake index 924de3db7e..31fc02f489 100644 --- a/cmake/Modules/FindChipmunk.cmake +++ b/cmake/Modules/FindChipmunk.cmake @@ -2,7 +2,7 @@ # FindChipmunk # ------------ # -# Locate FindChipmunk library +# Locate Chipmunk library # # This module defines # diff --git a/cmake/Modules/FindGLFW3.cmake b/cmake/Modules/FindGLFW3.cmake new file mode 100644 index 0000000000..937a8d0f52 --- /dev/null +++ b/cmake/Modules/FindGLFW3.cmake @@ -0,0 +1,69 @@ +#.rst: +# FindGLFW3 +# ------------ +# +# Locate glfw3 library +# +# This module defines +# +# :: +# +# GLFW3_LIBRARIES, the library to link against +# GLFW3_FOUND, if false, do not try to link to FREETYPE +# GLFW3_INCLUDE_DIRS, where to find headers. +# This is the concatenation of the paths: +# GLFW3_INCLUDE_DIR +# +#============================================================================= +# Copyright 2014-2014 Martell Malone +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +FIND_PATH(GLFW3_INCLUDE_DIR glfw3.h + HINTS + ENV GLFW3_DIR + PATH_SUFFIXES include/GLFW include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +FIND_LIBRARY(GLFW3_LIBRARY + NAMES glfw3 libglfw3 + HINTS + ENV GLFW3_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt +) + +set(GLFW3_INCLUDE_DIRS "${GLFW3_INCLUDE_DIR}") +set(GLFW3_LIBRARIES "${GLFW3_LIBRARY}") + +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set GLFW3_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 DEFAULT_MSG GLFW3_LIBRARIES GLFW3_INCLUDE_DIR) + +MARK_AS_ADVANCED(GLFW3_INCLUDE_DIR GLFW3_LIBRARIES GLFW3_LIBRARY) diff --git a/cmake/Modules/FindWebP.cmake b/cmake/Modules/FindWebP.cmake index 8b74805bdc..4b716f55b8 100644 --- a/cmake/Modules/FindWebP.cmake +++ b/cmake/Modules/FindWebP.cmake @@ -2,7 +2,7 @@ # FindWebP # ------------ # -# Locate FindChipmunk library +# Locate webp library # # This module defines # diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index 1be8fb4abd..370570497c 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -95,6 +95,16 @@ if(MINGW) else() + if(LINUX) + + find_package(GLFW3 REQUIRED) + message( STATUS "GLFW3 dirs: ${GLFW3_INCLUDE_DIRS}") + include_directories(${GLFW3_INCLUDE_DIRS}) + + endif(LINUX) + + + #todo: provide prebuild versions of minizip for android ios mac and msvc #done: prebuilt version for mingw-w64 (linux distros should have them also) # check for opensuse the buildbot system arch and ubuntu @@ -109,7 +119,6 @@ endif() ../external/xxhash ../external/xxtea) - add_library(cocos2d ${BUILD_TYPE} ${COCOS_SRC})