From fe6c52c1b40e6bb5815de53f38deded5b62a976e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20=C3=9Cz=C3=BCmc=C3=BC?= Date: Tue, 16 Aug 2016 11:57:03 +0300 Subject: [PATCH] Use the VS 2015 libraries for MSVC 14 (#16359) * Use the VS 2015 libraries for MSVC 14 When compiling with MSVC 14, the linker cannot find `libpng-2015.lib`, `libtiff-2015.lib`, `libjpeg-2015.lib` and `libglfw-2015.lib`. This commit fixes that problem * Remove the -2015 suffix from the non-MSVC 14 part on libchipmunk * Fix Linux compiler errors Check If we are on Windows then check for VS 2015. --- cmake/Modules/CocosUsePrebuiltLibs.cmake | 50 +++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/CocosUsePrebuiltLibs.cmake b/cmake/Modules/CocosUsePrebuiltLibs.cmake index b30fb16fa6..06f57fd94b 100644 --- a/cmake/Modules/CocosUsePrebuiltLibs.cmake +++ b/cmake/Modules/CocosUsePrebuiltLibs.cmake @@ -4,7 +4,15 @@ set(_chipmunk_inc chipmunk/chipmunk.h) set(_chipmunk_inc_paths include) -set(_chipmunk_libs chipmunk libchipmunk) +if(WINDOWS) + if (${MSVC_VERSION} STREQUAL "1900") + set(_chipmunk_libs chipmunk libchipmunk-2015) + else() + set(_chipmunk_libs chipmunk libchipmunk) + endif(${MSVC_VERSION}) +else() + set(_chipmunk_libs chipmunk libchipmunk) +endif(WINDOWS) set(_curl_inc curl/curl.h) # order: curl, ssl, crypto @@ -16,13 +24,37 @@ set(_freetype2_inc_paths freetype2) set(_freetype2_libs freetype freetype250) set(_jpeg_inc jpeglib.h) -set(_jpeg_libs jpeg libjpeg) +if(WINDOWS) + if (${MSVC_VERSION} STREQUAL "1900") + set(_jpeg_libs jpeg libjpeg-2015) + else() + set(_jpeg_libs jpeg libjpeg) + endif(${MSVC_VERSION}) +else() + set(_jpeg_libs jpeg libjpeg) +endif(WINDOWS) set(_png_inc png.h) -set(_png_libs png libpng) +if(WINDOWS) + if (${MSVC_VERSION} STREQUAL "1900") + set(_png_libs png libpng-2015) + else() + set(_png_libs png libpng) + endif(${MSVC_VERSION}) +else() + set(_png_libs png libpng) +endif(WINDOWS) set(_tiff_inc tiff.h) -set(_tiff_libs tiff libtiff) +if(WINDOWS) + if (${MSVC_VERSION} STREQUAL "1900") + set(_tiff_libs tiff libtiff-2015) + else() + set(_tiff_libs tiff libtiff) + endif(${MSVC_VERSION}) +else() + set(_tiff_libs tiff libtiff) +endif(WINDOWS) set(_webp_inc decode.h) set(_webp_libs webp libwebp) @@ -31,7 +63,15 @@ set(_websockets_inc libwebsockets.h) set(_websockets_libs websockets libwebsockets) set(_glfw3_inc glfw3.h) -set(_glfw3_libs glfw3 libglfw3) +if(WINDOWS) + if (${MSVC_VERSION} STREQUAL "1900") + set(_glfw3_libs glfw3-2015 libglfw3) + else() + set(_glfw3_libs glfw3 libglfw3) + endif(${MSVC_VERSION}) +else() + set(_glfw3_libs glfw3 libglfw3) +endif(WINDOWS) set(_sqlite3_inc sqlite3.h) set(_sqlite3_libs sqlite3)