Clean up CMake project, added arithmetic operators to swizzle operators types
This commit is contained in:
parent
ac1f60997c
commit
a23dd2f800
@ -11,21 +11,6 @@ include(CMakePackageConfigHelpers)
|
|||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF)
|
|
||||||
if(GLM_STATIC_LIBRARY_ENABLE)
|
|
||||||
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_STATIC_LIBRARY_ENABLE with ON to build an optional static library")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(GLM_DYNAMIC_LIBRARY_ENABLE "GLM dynamic library" OFF)
|
|
||||||
if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_DYNAMIC_LIBRARY_ENABLE with ON to build an optional dynamic library")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(GLM_TEST_ENABLE "GLM test" OFF)
|
|
||||||
if(NOT GLM_TEST_ENABLE)
|
|
||||||
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
|
option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
|
||||||
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
||||||
option(GLM_TEST_ENABLE_CXX_14 "Enable C++ 14" OFF)
|
option(GLM_TEST_ENABLE_CXX_14 "Enable C++ 14" OFF)
|
||||||
@ -177,12 +162,8 @@ include_directories("${PROJECT_SOURCE_DIR}")
|
|||||||
add_subdirectory(glm)
|
add_subdirectory(glm)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
option(GLM_INSTALL_ENABLE "GLM install" ON)
|
|
||||||
|
|
||||||
set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
|
set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
|
||||||
if (GLM_INSTALL_ENABLE)
|
|
||||||
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
endif()
|
|
||||||
|
|
||||||
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" VERSION ${GLM_VERSION} COMPATIBILITY AnyNewerVersion)
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" VERSION ${GLM_VERSION} COMPATIBILITY AnyNewerVersion)
|
||||||
|
|
||||||
@ -197,12 +178,10 @@ configure_package_config_file(
|
|||||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
|
|
||||||
if(GLM_INSTALL_ENABLE)
|
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
|
||||||
DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(glm INTERFACE)
|
add_library(glm INTERFACE)
|
||||||
target_include_directories(glm INTERFACE
|
target_include_directories(glm INTERFACE
|
||||||
@ -212,17 +191,13 @@ install(TARGETS glm EXPORT glmTargets)
|
|||||||
|
|
||||||
export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
|
export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
|
||||||
|
|
||||||
if(GLM_INSTALL_ENABLE)
|
|
||||||
install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
|
||||||
endif()
|
|
||||||
|
|
||||||
# build pkg-config file
|
# build pkg-config file
|
||||||
configure_file("./cmake/glm.pc.in" "glm.pc" @ONLY)
|
configure_file("./cmake/glm.pc.in" "glm.pc" @ONLY)
|
||||||
|
|
||||||
# install pkg-config file
|
# install pkg-config file
|
||||||
if (GLM_INSTALL_ENABLE)
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glm.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glm.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
endif()
|
|
||||||
|
|
||||||
export(PACKAGE glm)
|
export(PACKAGE glm)
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ source_group("SIMD Files" FILES ${SIMD_HEADER})
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
|
|
||||||
if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
if(GLM_STATIC_LIBRARY_ENABLE)
|
|
||||||
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||||
@ -53,9 +51,7 @@ if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
|||||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||||
endif(GLM_STATIC_LIBRARY_ENABLE)
|
|
||||||
|
|
||||||
if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||||
@ -63,15 +59,4 @@ if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
|||||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||||
endif(GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
|
|
||||||
else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
|
||||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
|
||||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
|
||||||
${EXT_SOURCE} ${EXT_INLINE} ${EXT_HEADER}
|
|
||||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
|
||||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
|
||||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
|
||||||
|
|
||||||
endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
|
||||||
|
@ -51,25 +51,24 @@ namespace glm
|
|||||||
typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data;
|
typename detail::storage<1, T, detail::is_aligned<Q>::value>::type data;
|
||||||
/*
|
/*
|
||||||
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
||||||
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, x)
|
_GLM_SWIZZLE1_2_MEMBERS(T, Q, x)
|
||||||
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, r)
|
_GLM_SWIZZLE1_2_MEMBERS(T, Q, r)
|
||||||
_GLM_SWIZZLE1_2_MEMBERS(T, Q, tvec2, s)
|
_GLM_SWIZZLE1_2_MEMBERS(T, Q, s)
|
||||||
_GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, x)
|
_GLM_SWIZZLE1_3_MEMBERS(T, Q, x)
|
||||||
_GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, r)
|
_GLM_SWIZZLE1_3_MEMBERS(T, Q, r)
|
||||||
_GLM_SWIZZLE1_3_MEMBERS(T, Q, tvec3, s)
|
_GLM_SWIZZLE1_3_MEMBERS(T, Q, s)
|
||||||
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, x)
|
_GLM_SWIZZLE1_4_MEMBERS(T, Q, x)
|
||||||
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, r)
|
_GLM_SWIZZLE1_4_MEMBERS(T, Q, r)
|
||||||
_GLM_SWIZZLE1_4_MEMBERS(T, Q, tvec4, s)
|
_GLM_SWIZZLE1_4_MEMBERS(T, Q, s)
|
||||||
# endif
|
# endif
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
# else
|
# else
|
||||||
union {T x, r, s;};
|
union {T x, r, s;};
|
||||||
/*
|
|
||||||
# if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
|
# if GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
|
||||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q, tvec2, tvec2, tvec3, tvec4)
|
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q)
|
||||||
# endif
|
# endif
|
||||||
*/
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// -- Component accesses --
|
// -- Component accesses --
|
||||||
@ -112,7 +111,7 @@ namespace glm
|
|||||||
/*
|
/*
|
||||||
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
||||||
template<int E0>
|
template<int E0>
|
||||||
GLM_FUNC_DECL tvec(detail::_swizzle<1, T, Q, tvec1, E0, -1,-2,-3> const& that)
|
GLM_FUNC_DECL tvec(detail::_swizzle<1, T, Q, E0, -1,-2,-3> const& that)
|
||||||
{
|
{
|
||||||
*this = that();
|
*this = that();
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
function(glmCreateTestGTC NAME)
|
function(glmCreateTestGTC NAME)
|
||||||
if(GLM_TEST_ENABLE)
|
|
||||||
set(SAMPLE_NAME test-${NAME})
|
set(SAMPLE_NAME test-${NAME})
|
||||||
add_executable(${SAMPLE_NAME} ${NAME}.cpp)
|
add_executable(${SAMPLE_NAME} ${NAME}.cpp)
|
||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${SAMPLE_NAME}
|
NAME ${SAMPLE_NAME}
|
||||||
COMMAND $<TARGET_FILE:${SAMPLE_NAME}> )
|
COMMAND $<TARGET_FILE:${SAMPLE_NAME}> )
|
||||||
endif(GLM_TEST_ENABLE)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_subdirectory(bug)
|
add_subdirectory(bug)
|
||||||
|
@ -60,7 +60,7 @@ int test_ivec3_swizzle()
|
|||||||
|
|
||||||
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
|
||||||
{
|
{
|
||||||
glm::ivec3 A(1, 2, 3);
|
glm::ivec3 const A(1, 2, 3);
|
||||||
glm::ivec2 B = A.yx;
|
glm::ivec2 B = A.yx;
|
||||||
glm::ivec2 C = A.yx;
|
glm::ivec2 C = A.yx;
|
||||||
|
|
||||||
@ -82,6 +82,18 @@ int test_ivec3_swizzle()
|
|||||||
|
|
||||||
Error += E == A.xy() ? 0 : 1;
|
Error += E == A.xy() ? 0 : 1;
|
||||||
Error += E.xy() == A.xy() ? 0 : 1;
|
Error += E.xy() == A.xy() ? 0 : 1;
|
||||||
|
|
||||||
|
glm::ivec3 const F = A.xxx + A.xxx;
|
||||||
|
Error += F == glm::ivec3(2) ? 0 : 1;
|
||||||
|
|
||||||
|
glm::ivec3 const G = A.xxx - A.xxx;
|
||||||
|
Error += G == glm::ivec3(0) ? 0 : 1;
|
||||||
|
|
||||||
|
glm::ivec3 const H = A.xxx * A.xxx;
|
||||||
|
Error += H == glm::ivec3(1) ? 0 : 1;
|
||||||
|
|
||||||
|
glm::ivec3 const I = A.xxx / A.xxx;
|
||||||
|
Error += I == glm::ivec3(1) ? 0 : 1;
|
||||||
}
|
}
|
||||||
# endif//GLM_SWIZZLE
|
# endif//GLM_SWIZZLE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user