Fixed support for Clang

Minor addition to unit tests.
This commit is contained in:
Stephen Seo 2016-03-05 20:16:32 +09:00
parent 1926a9eabb
commit d8dfba8361
2 changed files with 9 additions and 3 deletions

View file

@ -19,17 +19,20 @@ target_include_directories(EntityComponentSystem INTERFACE ${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -D NDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -D NDEBUG")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0)) if(NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0))
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.") message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.")
endif () endif ()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT (CLANG_VERSION VERSION_GREATER 3.4 OR CLANG_VERSION VERSION_EQUAL 3.4))
message(FATAL_ERROR "${PROJECT_NAME} requires clang 3.4 or greater.")
endif()
elseif(MSVC) elseif(MSVC)
else() else()
message(FATAL_ERROR "Your C++ compiler does not support C++14.") message(FATAL_ERROR "Your C++ compiler does not support C++14.")

View file

@ -124,6 +124,9 @@ TEST(Meta, Combine)
listAllTemp = EC::Meta::IndexOf<T1, ListAll>::value; listAllTemp = EC::Meta::IndexOf<T1, ListAll>::value;
combinedAllTemp = EC::Meta::IndexOf<T1, CombinedAll>::value; combinedAllTemp = EC::Meta::IndexOf<T1, CombinedAll>::value;
EXPECT_EQ(combinedAllTemp, listAllTemp); EXPECT_EQ(combinedAllTemp, listAllTemp);
bool same = std::is_same<CombinedAll, ListAll>::value;
EXPECT_TRUE(same);
} }
TEST(Meta, Morph) TEST(Meta, Morph)