From b14e39b4cf063b0b50d84fc2b5d713a932eea85c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 12 Mar 2016 01:32:40 +0100 Subject: [PATCH] Added target to build optional static and dynamic GLM library --- CMakeLists.txt | 10 ++++++++++ glm/CMakeLists.txt | 17 +++++++++++++++-- glm/detail/dummy.cpp | 11 +++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd10009e..f9fc72b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,16 @@ enable_testing() add_definitions(-D_CRT_SECURE_NO_WARNINGS) +option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF) +if(NOT 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 static library" OFF) +if(NOT 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") diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt index 8f2f552e..66f81067 100644 --- a/glm/CMakeLists.txt +++ b/glm/CMakeLists.txt @@ -40,5 +40,18 @@ if(GLM_TEST_ENABLE) ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) endif(GLM_TEST_ENABLE) -#add_library(glm STATIC glm.cpp) -#add_library(glm_shared SHARED glm.cpp) +if(GLM_STATIC_LIBRARY_ENABLE) + add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_STATIC_LIBRARY_ENABLE) + +if(GLM_DYNAMIC_LIBRARY_ENABLE) + add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_DYNAMIC_LIBRARY_ENABLE) diff --git a/glm/detail/dummy.cpp b/glm/detail/dummy.cpp index 09a2ae59..4da61968 100644 --- a/glm/detail/dummy.cpp +++ b/glm/detail/dummy.cpp @@ -32,7 +32,7 @@ /// GLM is a header only library. There is nothing to compile. /// dummy.cpp exist only a wordaround for CMake file. /////////////////////////////////////////////////////////////////////////////////// - +/* #define GLM_MESSAGES #include #include @@ -149,6 +149,8 @@ struct intersection glm::vec4 position; glm::vec3 normal; }; +*/ + /* // Sample 4 @@ -191,7 +193,7 @@ glm::vec3 lighting } */ - +/* template class vecType> T normalizeDotA(vecType const & x, vecType const & y) { @@ -211,9 +213,10 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) { return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); } - +*/ int main() { +/* glm::vec1 o(1); glm::vec2 a(1); glm::vec3 b(1); @@ -227,6 +230,6 @@ int main() float a0 = normalizeDotA(a, a); float b0 = normalizeDotB(b, b); float c0 = normalizeDotC(c, c); - +*/ return 0; }