fix building with system prebuilt libs

This commit is contained in:
Martell Malone 2015-07-22 14:19:22 +01:00
parent 5b8371aaa2
commit 3e0ada4c84
4 changed files with 112 additions and 9 deletions

View File

@ -326,16 +326,23 @@ cocos_find_package(TIFF TIFF REQUIRED)
cocos_find_package(WEBSOCKETS WEBSOCKETS REQUIRED)
cocos_find_package(CURL CURL REQUIRED)
add_subdirectory(external/flatbuffers)
set(FLATBUFFERS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external)
message(STATUS "Flatbuffers include dirs: ${FLATBUFFERS_INCLUDE_DIRS}")
# build xxhash
add_subdirectory(external/xxhash)
set(XXHASH_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/xxhash)
set(XXHASH_LIBRARIES xxhash)
# flatbuffers
if(USE_PREBUILT_LIBS)
add_subdirectory(external/flatbuffers)
set(FLATBUFFERS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external)
message(STATUS "Flatbuffers include dirs: ${FLATBUFFERS_INCLUDE_DIRS}")
else()
cocos_find_package(flatbuffers flatbuffers REQUIRED)
endif()
# xxhash
if(USE_PREBUILT_LIBS)
add_subdirectory(external/xxhash)
set(XXHASH_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/xxhash)
set(XXHASH_LIBRARIES xxhash)
else()
cocos_find_package(xxhash xxhash REQUIRED)
endif()
# libcocos2d.a
add_subdirectory(cocos)

View File

@ -0,0 +1,32 @@
#.rst:
# FindRecast
# ------------
#
# Locate RECAST library
#
# This module defines
#
# ::
#
# RECAST_LIBRARIES, the library to link against
# RECAST_FOUND, the libraries needed to use RECAST
# RECAST_INCLUDE_DIRS, where to find headers.
#
find_path(RECAST_INCLUDE_DIR
NAMES Recast/Recast.h
PATH_SUFFIXES include
)
find_library(RECAST_LIBRARY
NAMES Recast
PATH_SUFFIXES lib
)
set(RECAST_INCLUDE_DIRS "${RECAST_INCLUDE_DIR}")
set(RECAST_LIBRARIES "${RECAST_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(RECAST DEFAULT_MSG RECAST_LIBRARIES RECAST_INCLUDE_DIRS)
mark_as_advanced(RECAST_INCLUDE_DIR RECAST_LIBRARY)

View File

@ -0,0 +1,32 @@
#.rst:
# Findflatbuffers
# ------------
#
# Locate flatbuffers library
#
# This module defines
#
# ::
#
# FLATBUFFERS_LIBRARIES, the library to link against
# FLATBUFFERS_FOUND, the libraries needed to use flatbuffers
# FLATBUFFERS_INCLUDE_DIRS, where to find headers.
#
find_path(FLATBUFFERS_INCLUDE_DIR
NAMES flatbuffers.h
PATH_SUFFIXES include include/flatbuffers
)
find_library(FLATBUFFERS_LIBRARY
NAMES flatbuffers
PATH_SUFFIXES lib
)
set(FLATBUFFERS_INCLUDE_DIRS "${FLATBUFFERS_INCLUDE_DIR}")
set(FLATBUFFERS_LIBRARIES "${FLATBUFFERS_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(FLATBUFFERS DEFAULT_MSG FLATBUFFERS_LIBRARIES FLATBUFFERS_INCLUDE_DIRS)
mark_as_advanced(FLATBUFFERS_INCLUDE_DIR FLATBUFFERS_LIBRARY)

View File

@ -0,0 +1,32 @@
#.rst:
# Findxxhash
# ------------
#
# Locate xxhash library
#
# This module defines
#
# ::
#
# XXHASH_LIBRARIES, the library to link against
# XXHASH_FOUND, the libraries needed to use flatbuffers
# XXHASH_INCLUDE_DIRS, where to find headers.
#
find_path(XXHASH_INCLUDE_DIR
NAMES xxhash.h xxhash.h
PATH_SUFFIXES include include/xxhash
)
find_library(XXHASH_LIBRARY
NAMES xxhash
PATH_SUFFIXES lib
)
set(XXHASH_INCLUDE_DIRS "${XXHASH_INCLUDE_DIR}")
set(XXHASH_LIBRARIES "${XXHASH_LIBRARY}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(XXHASH DEFAULT_MSG XXHASH_LIBRARIES XXHASH_INCLUDE_DIRS)
mark_as_advanced(XXHASH_INCLUDE_DIR XXHASH_LIBRARY)