Unify protobuf finding and usage.

But disable finding until bug with protobuf versions will be resolved.
This commit is contained in:
Vladimir Timofeev 2014-11-16 15:29:24 +03:00
parent d224dc0ce7
commit 039005ef13
2 changed files with 27 additions and 28 deletions

View File

@ -185,7 +185,7 @@ else(USE_CHIPMUNK)
add_definitions(-DCC_USE_PHYSICS=0)
endif(USE_CHIPMUNK)
# Box2d
# Box2d (not prebuilded, exists as source)
if(USE_BOX2D)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/Box2D)
@ -202,7 +202,7 @@ else()
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0)
endif(USE_BOX2D)
# Tinyxml2
# Tinyxml2 (not prebuilded, exists as source)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/tinyxml2)
set(TinyXML2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/tinyxml2)
@ -231,16 +231,27 @@ message(STATUS "WEBSOCKETS include dirs: ${WEBSOCKETS_INCLUDE_DIRS}")
find_package(CURL REQUIRED)
message(STATUS "CURL include dirs: ${CURL_INCLUDE_DIRS}")
# protobuf-lite (not prebuilded, exists as source)
# TODO: for now we can't use upstream protobuf because these files:
# cocos/editor-support/cocostudio/CSParseBinary.pb.h
# cocos/editor-support/cocostudio/CSParseBinary.pb.cc
# was generated by concrete version of protobuf compiler
# and source file not provided. So these files can be
# compiled only with our in-source version of protobuf-lite
## if(USE_PREBUILT_LIBS)
add_subdirectory(external/protobuf-lite)
set(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf-lite/src)
set(PROTOBUF_LITE_LIBRARIES protobuf)
## else()
## find_package(Protobuf REQUIRED PROTOBUF_LITE_LIBRARIES)
## endif()
message(STATUS "Protobuf lite libs: ${PROTOBUF_LITE_LIBRARIES}")
message(STATUS "Protobuf include dirs: ${PROTOBUF_INCLUDE_DIRS}")
if(NOT MINGW)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf-lite/src
)
link_directories(
${PLATFORM_LINK_DIR}
)
link_directories(${PLATFORM_LINK_DIR})
endif()
@ -248,7 +259,6 @@ endif()
if(LINUX OR APPLE)
add_subdirectory(external/unzip)
add_subdirectory(external/xxhash)
add_subdirectory(external/protobuf-lite)
endif()
# libcocos2d.a

View File

@ -81,26 +81,13 @@ set(COCOS_SRC cocos2d.cpp
${COCOS_EXTENSIONS_SRC}
)
if(MINGW)
find_package(Protobuf REQUIRED)
#find_package(MiniZip REQUIRED)
#${MINIZIP_INCLUDE_DIR}
find_package(ZLIB REQUIRED)
message( STATUS "ZLIB dirs: ${ZLIB_INCLUDE_DIRS}")
message( STATUS "Protobuf dirs: ${PROTOBUF_INCLUDE_DIRS}")
include_directories(${ZLIB_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
else()
if(NOT MINGW)
#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
include_directories(
../external/unzip)
include_directories( ../external/unzip )
endif()
@ -166,11 +153,12 @@ include_directories(
${PNG_INCLUDE_DIRS}
${TIFF_INCLUDE_DIRS}
${TinyXML2_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${WEBSOCKETS_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
)
target_link_libraries(cocos2d
protobuf unzip xxhash
unzip xxhash
${ZLIB_LIBRARIES}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
@ -178,6 +166,7 @@ target_link_libraries(cocos2d
${TinyXML2_LIBRARIES}
${WEBSOCKETS_LIBRARIES}
${CURL_LIBRARIES}
${PROTOBUF_LITE_LIBRARIES}
${FREETYPE_LIBRARIES}
${PLATFORM_SPECIFIC_LIBS}
)