2014-11-20 17:05:15 +08:00
|
|
|
# CocosUsePrebuiltLibs - sets external libs variables to link with
|
|
|
|
|
|
|
|
# START CONFIG
|
|
|
|
|
2016-03-01 05:53:00 +08:00
|
|
|
set(_chipmunk_inc chipmunk/chipmunk.h)
|
|
|
|
set(_chipmunk_inc_paths include)
|
2014-11-20 17:05:15 +08:00
|
|
|
set(_chipmunk_libs chipmunk libchipmunk)
|
|
|
|
|
|
|
|
set(_curl_inc curl/curl.h)
|
2016-03-03 08:51:54 +08:00
|
|
|
# order: curl, ssl, crypto
|
|
|
|
set(_curl_libs curl libcurl_imp libcurl ssl libeay32 ssleay32 crypto)
|
2014-11-20 17:05:15 +08:00
|
|
|
|
|
|
|
set(_freetype2_prefix FREETYPE)
|
|
|
|
set(_freetype2_inc ft2build.h freetype/freetype.h)
|
|
|
|
set(_freetype2_inc_paths freetype2)
|
|
|
|
set(_freetype2_libs freetype freetype250)
|
|
|
|
|
|
|
|
set(_jpeg_inc jpeglib.h)
|
|
|
|
set(_jpeg_libs jpeg libjpeg)
|
|
|
|
|
|
|
|
set(_png_inc png.h)
|
|
|
|
set(_png_libs png libpng)
|
|
|
|
|
|
|
|
set(_tiff_inc tiff.h)
|
|
|
|
set(_tiff_libs tiff libtiff)
|
|
|
|
|
|
|
|
set(_webp_inc decode.h)
|
|
|
|
set(_webp_libs webp libwebp)
|
|
|
|
|
|
|
|
set(_websockets_inc libwebsockets.h)
|
|
|
|
set(_websockets_libs websockets libwebsockets)
|
|
|
|
|
|
|
|
set(_glfw3_inc glfw3.h)
|
|
|
|
set(_glfw3_libs glfw3 libglfw3)
|
|
|
|
|
|
|
|
set(_sqlite3_inc sqlite3.h)
|
|
|
|
set(_sqlite3_libs sqlite3)
|
|
|
|
|
|
|
|
set(_gles_prefix GLEW)
|
2014-12-21 19:19:52 +08:00
|
|
|
set(_gles_inc GL/glew.h)
|
2014-11-20 17:05:15 +08:00
|
|
|
set(_gles_inc_paths OGLES)
|
|
|
|
set(_gles_libs glew32)
|
|
|
|
|
|
|
|
set(_icon_prefix ICONV)
|
|
|
|
set(_icon_inc iconv.h)
|
|
|
|
set(_icon_libs libiconv)
|
|
|
|
|
|
|
|
set(_MP3Decoder_prefix MPG123)
|
|
|
|
set(_MP3Decoder_inc mpg123.h)
|
|
|
|
set(_MP3Decoder_libs libmpg123)
|
|
|
|
|
|
|
|
set(_OggDecoder_prefix VORBIS)
|
|
|
|
set(_OggDecoder_inc ogg/ogg.h)
|
|
|
|
set(_OggDecoder_libs libogg libvorbis libvorbisfile)
|
|
|
|
|
|
|
|
set(_OpenalSoft_prefix OPENAL)
|
|
|
|
set(_OpenalSoft_inc al.h)
|
|
|
|
set(_OpenalSoft_inc_paths AL)
|
|
|
|
set(_OpenalSoft_libs OpenAL32)
|
|
|
|
|
|
|
|
set(_zlib_inc zlib.h)
|
2015-04-02 18:01:14 +08:00
|
|
|
set(_zlib_libs z libzlib libz)
|
2014-11-20 17:05:15 +08:00
|
|
|
|
2015-11-25 09:54:12 +08:00
|
|
|
set(_fmod_prefix FMOD)
|
|
|
|
set(_fmod_inc fmod.hpp)
|
|
|
|
set(_fmod_libs fmod fmod64 fmod fmod64)
|
2014-11-20 17:05:15 +08:00
|
|
|
|
|
|
|
set(all_prebuilt_libs
|
|
|
|
chipmunk
|
|
|
|
curl
|
|
|
|
freetype2
|
|
|
|
jpeg
|
|
|
|
png
|
|
|
|
tiff
|
|
|
|
webp
|
|
|
|
websockets
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if(MACOSX)
|
2015-04-02 18:01:14 +08:00
|
|
|
list(APPEND all_prebuilt_libs glfw3 zlib)
|
2014-11-20 17:05:15 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# We use MSVC instead of WINDOWS because it can be mingw that can't use our prebuilt libs
|
|
|
|
if(MSVC)
|
|
|
|
list(APPEND all_prebuilt_libs glfw3 sqlite3 gles icon MP3Decoder OggDecoder OpenalSoft zlib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LINUX)
|
2015-04-03 14:53:15 +08:00
|
|
|
list(APPEND all_prebuilt_libs fmod)
|
2014-11-20 17:05:15 +08:00
|
|
|
endif()
|
|
|
|
|
2016-03-03 08:51:54 +08:00
|
|
|
if(ANDROID)
|
|
|
|
list(APPEND all_prebuilt_libs zlib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2014-11-20 17:05:15 +08:00
|
|
|
# END CONFIG
|
|
|
|
|
|
|
|
foreach(_lib ${all_prebuilt_libs})
|
|
|
|
if(_${_lib}_prefix)
|
|
|
|
set(_prefix ${_${_lib}_prefix})
|
|
|
|
else()
|
|
|
|
# auto-prefix is uppercased name
|
|
|
|
string(TOUPPER ${_lib} _prefix)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(roots
|
|
|
|
${COCOS_EXTERNAL_DIR}/${_lib}
|
|
|
|
${COCOS_EXTERNAL_DIR}/${PLATFORM_FOLDER}-specific/${_lib}
|
|
|
|
)
|
|
|
|
foreach(_root ${roots})
|
|
|
|
if(EXISTS ${_root})
|
|
|
|
set(include_dir_candidates
|
|
|
|
${_root}/include
|
|
|
|
${_root}/include/${ARCH_DIR}
|
|
|
|
${_root}/include/${PLATFORM_FOLDER}
|
|
|
|
${_root}/include/${PLATFORM_FOLDER}/${ARCH_DIR}
|
|
|
|
)
|
|
|
|
set(include_dirs)
|
|
|
|
foreach(_dir ${include_dir_candidates})
|
|
|
|
if(EXISTS ${_dir})
|
|
|
|
# find all include paths
|
|
|
|
if(_${_lib}_inc_paths)
|
|
|
|
set(_suffixes ${_${_lib}_inc_paths})
|
|
|
|
else()
|
|
|
|
set(_suffixes include)
|
|
|
|
endif()
|
|
|
|
foreach(_inc_name ${_${_lib}_inc})
|
|
|
|
unset(_inc_tmp CACHE)
|
|
|
|
find_path(_inc_tmp ${_inc_name} PATH_SUFFIXES ${_suffixes} PATHS ${_dir} NO_DEFAULT_PATH)
|
|
|
|
if(_inc_tmp)
|
|
|
|
list(APPEND include_dirs ${_inc_tmp})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif(EXISTS ${_dir})
|
|
|
|
endforeach()
|
|
|
|
if(include_dirs)
|
|
|
|
set(${_prefix}_INCLUDE_DIRS ${include_dirs} CACHE PATH "Path to includes for ${_prefix}" FORCE)
|
|
|
|
endif()
|
|
|
|
#message(STATUS "${_lib} ${_prefix}_INCLUDE_DIRS: ${${_prefix}_INCLUDE_DIRS}")
|
|
|
|
|
|
|
|
set(lib_dir_candidates
|
2016-03-03 08:51:54 +08:00
|
|
|
${_root}/prebuilt/${PLATFORM_FOLDER}/${ANDROID_ABI}
|
2014-11-20 17:05:15 +08:00
|
|
|
${_root}/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
|
|
|
|
${_root}/prebuilt/${PLATFORM_FOLDER}
|
|
|
|
${_root}/prebuilt/${PLATFORM_FOLDER}/release-lib
|
|
|
|
${_root}/prebuilt/${ARCH_DIR}
|
|
|
|
${_root}/libraries/${PLATFORM_FOLDER}
|
|
|
|
${_root}/prebuilt
|
|
|
|
)
|
|
|
|
set(libs)
|
|
|
|
foreach(_dir ${lib_dir_candidates})
|
|
|
|
if(EXISTS ${_dir})
|
|
|
|
# find all libs
|
|
|
|
foreach(_lib_name ${_${_lib}_libs})
|
|
|
|
unset(_lib_tmp CACHE)
|
|
|
|
find_library(_lib_tmp ${_lib_name} PATHS ${_dir} NO_DEFAULT_PATH)
|
|
|
|
if(_lib_tmp)
|
|
|
|
list(APPEND libs ${_lib_tmp})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif(EXISTS ${_dir})
|
|
|
|
endforeach()
|
|
|
|
if(libs)
|
|
|
|
set(${_prefix}_LIBRARIES ${libs} CACHE STRING "Libraries to link for ${_prefix}" FORCE)
|
|
|
|
endif()
|
2014-11-20 18:50:55 +08:00
|
|
|
#message(STATUS "${_lib} ${_prefix}_LIBRARIES: ${${_prefix}_LIBRARIES}")
|
2014-11-20 17:05:15 +08:00
|
|
|
|
|
|
|
if(${_prefix}_LIBRARIES AND ${_prefix}_INCLUDE_DIRS)
|
|
|
|
set(${_prefix}_FOUND YES)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif(EXISTS ${_root})
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|