Browse Source

Added target to build optional static and dynamic GLM library

Christophe Riccio 9 years ago
parent
commit
b14e39b4cf
3 changed files with 32 additions and 6 deletions
  1. 10 0
      CMakeLists.txt
  2. 15 2
      glm/CMakeLists.txt
  3. 7 4
      glm/detail/dummy.cpp

+ 10 - 0
CMakeLists.txt

@@ -16,6 +16,16 @@ enable_testing()
 
 
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 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)
 option(GLM_TEST_ENABLE "GLM test" OFF)
 if(NOT GLM_TEST_ENABLE)
 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")
 	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")

+ 15 - 2
glm/CMakeLists.txt

@@ -40,5 +40,18 @@ if(GLM_TEST_ENABLE)
 		${GTX_SOURCE}     ${GTX_INLINE}     ${GTX_HEADER})
 		${GTX_SOURCE}     ${GTX_INLINE}     ${GTX_HEADER})
 endif(GLM_TEST_ENABLE)
 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)

+ 7 - 4
glm/detail/dummy.cpp

@@ -32,7 +32,7 @@
 /// GLM is a header only library. There is nothing to compile. 
 /// GLM is a header only library. There is nothing to compile. 
 /// dummy.cpp exist only a wordaround for CMake file.
 /// dummy.cpp exist only a wordaround for CMake file.
 ///////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////
-
+/*
 #define GLM_MESSAGES
 #define GLM_MESSAGES
 #include <glm/glm.hpp>
 #include <glm/glm.hpp>
 #include <glm/ext.hpp>
 #include <glm/ext.hpp>
@@ -149,6 +149,8 @@ struct intersection
 	glm::vec4 position;
 	glm::vec4 position;
 	glm::vec3 normal;
 	glm::vec3 normal;
 };
 };
+*/
+
 
 
 /*
 /*
 // Sample 4
 // Sample 4
@@ -191,7 +193,7 @@ glm::vec3 lighting
 }
 }
 */
 */
 
 
-
+/*
 template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
 template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
 T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
 T normalizeDotA(vecType<T, P> const & x, vecType<T, P> 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));
 	return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
 }
 }
-
+*/
 int main()
 int main()
 {
 {
+/*
 	glm::vec1 o(1);
 	glm::vec1 o(1);
 	glm::vec2 a(1);
 	glm::vec2 a(1);
 	glm::vec3 b(1);
 	glm::vec3 b(1);
@@ -227,6 +230,6 @@ int main()
 	float a0 = normalizeDotA(a, a);
 	float a0 = normalizeDotA(a, a);
 	float b0 = normalizeDotB(b, b);
 	float b0 = normalizeDotB(b, b);
 	float c0 = normalizeDotC(c, c);
 	float c0 = normalizeDotC(c, c);
-
+*/
 	return 0;
 	return 0;
 }
 }