From c2ad7496a8a4346497c44ee02998078e4b256e6b Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 17 Aug 2016 11:18:28 -0700 Subject: [PATCH] Fix build on VS2015 --- ASTCEncoder/test/CMakeLists.txt | 73 +++++++++++++++++---------------- CMakeLists.txt | 3 +- PVRTCEncoder/src/PVRTCImage.cpp | 1 - 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/ASTCEncoder/test/CMakeLists.txt b/ASTCEncoder/test/CMakeLists.txt index 3238a18..650b391 100644 --- a/ASTCEncoder/test/CMakeLists.txt +++ b/ASTCEncoder/test/CMakeLists.txt @@ -79,47 +79,50 @@ FOREACH(TEST ${TESTS}) ADD_TEST(${TEST_NAME} ${TEST_NAME}) ENDFOREACH() +IF( PNG_FOUND ) -# Setup the test that makes sure that we don't have any -# regressions in the ASTC decoder. -SET(TEST_NAME Test_ASTCEncoder_Decompress) + # Setup the test that makes sure that we don't have any + # regressions in the ASTC decoder. + SET(TEST_NAME Test_ASTCEncoder_Decompress) -# Copy the .pvr files that we will use for testing... -SET(TEST_IMAGES 4x4 12x12 8x8 6x5 10x8 ) -FOREACH(IMAGE ${TEST_IMAGES}) - FILE(COPY - ${FasTC_SOURCE_DIR}/ASTCEncoder/test/data/mandrill_${IMAGE}.astc - DESTINATION ${CMAKE_BINARY_DIR} - USE_SOURCE_PERMISSIONS + # Copy the .pvr files that we will use for testing... + SET(TEST_IMAGES 4x4 12x12 8x8 6x5 10x8 ) + FOREACH(IMAGE ${TEST_IMAGES}) + FILE( + COPY ${FasTC_SOURCE_DIR}/ASTCEncoder/test/data/mandrill_${IMAGE}.astc + DESTINATION ${CMAKE_BINARY_DIR} + USE_SOURCE_PERMISSIONS ) -ENDFOREACH() + ENDFOREACH() -FOREACH(IMAGE ${TEST_IMAGES}) - FILE(COPY - ${FasTC_SOURCE_DIR}/ASTCEncoder/test/data/mandrill_decompressed_${IMAGE}.png - DESTINATION ${CMAKE_BINARY_DIR} - USE_SOURCE_PERMISSIONS - ) -ENDFOREACH() + FOREACH(IMAGE ${TEST_IMAGES}) + FILE( + COPY ${FasTC_SOURCE_DIR}/ASTCEncoder/test/data/mandrill_decompressed_${IMAGE}.png + DESTINATION ${CMAKE_BINARY_DIR} + USE_SOURCE_PERMISSIONS + ) + ENDFOREACH() -INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/IO/include ) -INCLUDE_DIRECTORIES( ${FasTC_BINARY_DIR}/IO/include ) -INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/Core/include ) -INCLUDE_DIRECTORIES( ${FasTC_BINARY_DIR}/Core/include ) + INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/IO/include ) + INCLUDE_DIRECTORIES( ${FasTC_BINARY_DIR}/IO/include ) + INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/Core/include ) + INCLUDE_DIRECTORIES( ${FasTC_BINARY_DIR}/Core/include ) -# HACK for MSVC 2012... -IF(MSVC) - ADD_DEFINITIONS(-D_VARIADIC_MAX=10) -ENDIF() + # HACK for MSVC 2012... + IF(MSVC) + ADD_DEFINITIONS(-D_VARIADIC_MAX=10) + ENDIF() -# The cpp file to compile for the test -ADD_EXECUTABLE(${TEST_NAME} TestASTCDecompression.cpp) + # The cpp file to compile for the test + ADD_EXECUTABLE(${TEST_NAME} TestASTCDecompression.cpp) -# Libraries that we need... -TARGET_LINK_LIBRARIES(${TEST_NAME} ASTCEncoder) -TARGET_LINK_LIBRARIES(${TEST_NAME} gtest_main) -TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCBase) -TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCIO) -TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCCore) + # Libraries that we need... + TARGET_LINK_LIBRARIES(${TEST_NAME} ASTCEncoder) + TARGET_LINK_LIBRARIES(${TEST_NAME} gtest_main) + TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCBase) + TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCIO) + TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCCore) -ADD_TEST(NAME ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${TEST_NAME}) \ No newline at end of file + ADD_TEST(NAME ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${TEST_NAME}) + +ENDIF( PNG_FOUND ) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 086c5bc..a363197 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,8 @@ INSTALL( ENABLE_TESTING() IF(MSVC) - SET(gtest_force_shared_crt TRUE) + MESSAGE("Setting force shared crt") + SET(gtest_force_shared_crt TRUE CACHE BOOL "Used to properly select MSVC runtime libraries" FORCE) ENDIF(MSVC) ADD_SUBDIRECTORY(GTest) diff --git a/PVRTCEncoder/src/PVRTCImage.cpp b/PVRTCEncoder/src/PVRTCImage.cpp index 349a60b..be13b60 100644 --- a/PVRTCEncoder/src/PVRTCImage.cpp +++ b/PVRTCEncoder/src/PVRTCImage.cpp @@ -52,7 +52,6 @@ #if _MSC_VER # define _CRT_SECURE_NO_WARNINGS -# define snprintf _snprintf #endif #include "PVRTCImage.h"