From 2f60864cb810e95c8cfc6601a8e9e20f68ff8fb1 Mon Sep 17 00:00:00 2001 From: Sylvain Thery Date: Wed, 25 Jan 2012 17:01:08 +0100 Subject: [PATCH] Modification of compilation system, add an option to compile all CGoGN in one lib instead of four. --- Apps/CMakeLists.txt | 21 +++++++++++++++--- CMakeLists.txt | 9 ++++++++ Debug/CMakeLists.txt | 36 ++++++++++++++++-------------- README.TXT | 13 +++++++++++ Release/CMakeLists.txt | 50 ++++++++++++++---------------------------- apps_cmake.txt | 23 +++++++++++++------ 6 files changed, 93 insertions(+), 59 deletions(-) diff --git a/Apps/CMakeLists.txt b/Apps/CMakeLists.txt index 6cf21e8ca..2dd6db242 100644 --- a/Apps/CMakeLists.txt +++ b/Apps/CMakeLists.txt @@ -5,12 +5,26 @@ SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin) #INCLUDE(${QT_USE_FILE}) #ADD_DEFINITIONS(${QT_DEFINITIONS}) -SET(CGoGN_LIBS_R topology algo container utils) +IF (ONELIB) + SET(CGoGN_LIBS_R cgogn) +ELSE (ONELIB) + SET(CGoGN_LIBS_R topology algo container utils) +ENDIF (ONELIB) IF(WIN32) - SET(CGoGN_LIBS_D topology algo container utils) # libs have same name but in different place in Visual + # libs have same name but in different place in Visual + IF (ONELIB) + SET(CGoGN_LIBS_D cgogn) + ELSE (ONELIB) + SET(CGoGN_LIBS_D topology algo container utils) + ENDIF (ONELIB) ELSE(WIN32) - SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) + IF (ONELIB) + SET(CGoGN_LIBS_D cgognD) + ELSE (ONELIB) + SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) + ENDIF (ONELIB) + IF (WITH_QT) add_subdirectory(Examples/Debug) ENDIF (WITH_QT) @@ -20,5 +34,6 @@ IF (WITH_QT) add_subdirectory(Tuto) add_subdirectory(Examples/Release) ENDIF (WITH_QT) + add_subdirectory(Examples/Tests) diff --git a/CMakeLists.txt b/CMakeLists.txt index 371e19422..60a2b53cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ SET ( WITH_QT ON CACHE BOOL "build CGoGN with Qt lib ") SET ( WITH_NUMERICAL ON CACHE BOOL "build CGoGN with Numerical libs support ") # for CGoGN MR SET ( FORCE_MR "2" CACHE STRING "0:none / 1 force multi / 2: force mono") +#create one big lib +SET ( ONELIB OFF CACHE BOOL "build CGoGN in one lib") IF(WIN32) set(CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies") @@ -51,6 +53,13 @@ IF (FORCE_MR EQUAL 2) ENDIF (FORCE_MR EQUAL 2) + +IF (ONELIB) + file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h "1" ) +ELSE (ONELIB) + file(WRITE ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h "0" ) +ENDIF (ONELIB) + add_definitions(-DSHADERPATH="${CGoGN_ROOT_DIR}/lib/Shaders/") # define includes of external libs diff --git a/Debug/CMakeLists.txt b/Debug/CMakeLists.txt index 002c4ec74..802880224 100644 --- a/Debug/CMakeLists.txt +++ b/Debug/CMakeLists.txt @@ -25,10 +25,7 @@ file( ${CGoGN_ROOT_DIR}/include/Topology/*.hpp ${CGoGN_ROOT_DIR}/include/Topology/*.h ) -add_library( - topologyD - ${files_topology} -) + file( GLOB_RECURSE @@ -37,10 +34,7 @@ file( ${CGoGN_ROOT_DIR}/include/Container/*.hpp ${CGoGN_ROOT_DIR}/include/Container/*.h ) -add_library( - containerD - ${files_container} -) + file( GLOB_RECURSE @@ -50,10 +44,6 @@ file( ${CGoGN_ROOT_DIR}/include/Algo/*.hpp ${CGoGN_ROOT_DIR}/include/Algo/*.h ) -add_library( - algoD - ${files_algo} -) file( @@ -106,11 +96,25 @@ IF(WITH_QT) QT4_WRAP_CPP(UTILS_QT_HEADERS_MOC ${utils_qt_headers}) SET (files_utils_withQt ${files_utils} ${files_utils_qt} ${UTILS_QT_HEADERS_MOC}) - add_library( utilsD ${files_utils_withQt} ) -ELSE(WITH_QT) - add_library( utilsD ${files_utils} ) ENDIF (WITH_QT) -add_dependencies(utilsD shader_targetD ) + +IF (ONELIB) + IF(WITH_QT) + add_library( cgognD ${files_topology} ${files_container} ${files_algo} ${files_utils_withQt}) + ELSE(WITH_QT) + add_library( cgognD ${files_topology} ${files_container} ${files_algo} ${files_utils} ) + ENDIF (WITH_QT) +ELSE (ONELIB) + add_library( topologyD ${files_topology}) + add_library( containerD ${files_container}) + add_library( algoD ${files_algo}) + IF(WITH_QT) + add_library( utilsD ${files_utils_withQt} ) + ELSE(WITH_QT) + add_library( utilsD ${files_utils} ) + ENDIF (WITH_QT) + add_dependencies(utilsD shader_targetD ) +ENDIF (ONELIB) \ No newline at end of file diff --git a/README.TXT b/README.TXT index 48800628f..1da561e73 100644 --- a/README.TXT +++ b/README.TXT @@ -16,6 +16,13 @@ Pour compiler CGoGN: WITH_QT (T) afin de limiter les dépendances et le temps de compilation/ + FORCE_MR (2) + permet de compiler dans 3 modes: mixte (0), multi-resolution(1), mono-resolution(2). + + ONELIB (F) + permet de forcer la compilation en une seule lib (libcgogn.a) au lieu de quatre. + + - la compilation des sous-parties se fait en allant dans les sous-repertoires de build @@ -49,6 +56,12 @@ You can also compile debug by creating a directory that ended Debug build instea WITH_ZINRI (T) WITH_QT (T) to minimize dependencies and compilation time / + + FORCE_MR (2) + allow the compilation in 3 mode: mixed(0), multi-resolution(1), mono-resolution(2). + + ONELIB (F) + allow compilation in one lib (libcgogn.a) instead of four. - the compilation of each sub-parts is done by going in the subdirectories of build diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt index dfe5ec417..0e13ac0d8 100644 --- a/Release/CMakeLists.txt +++ b/Release/CMakeLists.txt @@ -24,10 +24,6 @@ file( ${CGoGN_ROOT_DIR}/include/Topology/*.hpp ${CGoGN_ROOT_DIR}/include/Topology/*.h ) -add_library( - topology - ${files_topology} -) file( GLOB_RECURSE @@ -36,10 +32,6 @@ file( ${CGoGN_ROOT_DIR}/include/Container/*.hpp ${CGoGN_ROOT_DIR}/include/Container/*.h ) -add_library( - container - ${files_container} -) file( GLOB_RECURSE @@ -49,22 +41,6 @@ file( ${CGoGN_ROOT_DIR}/include/Algo/*.hpp ${CGoGN_ROOT_DIR}/include/Algo/*.h ) -add_library( - algo - ${files_algo} -) - -#file( -# GLOB_RECURSE -# files_geometry -# ${CGoGN_ROOT_DIR}/src/Geometry/*.cpp -# ${CGoGN_ROOT_DIR}/include/Geometry/*.hpp -# ${CGoGN_ROOT_DIR}/include/Geometry/*.h -#) -#add_library( -# geometry -# ${files_geometry} -#) file( @@ -89,9 +65,6 @@ ELSE(WIN32) SOURCES ${shaders_src} ) ENDIF(WIN32) - - - file( GLOB # WARNING NO MORE RECURSE TO AVOID TAKING QT FILES files_utils @@ -119,14 +92,25 @@ IF(WITH_QT) QT4_WRAP_CPP(UTILS_QT_HEADERS_MOC ${utils_qt_headers}) SET (files_utils_withQt ${files_utils} ${files_utils_qt} ${UTILS_QT_HEADERS_MOC}) - add_library( utils ${files_utils_withQt} ) -ELSE(WITH_QT) - add_library( utils ${files_utils} ) ENDIF (WITH_QT) -add_dependencies(utils shader_target ) - - +IF (ONELIB) + IF(WITH_QT) + add_library( cgogn ${files_topology} ${files_container} ${files_algo} ${files_utils_withQt}) + ELSE(WITH_QT) + add_library( cgogn ${files_topology} ${files_container} ${files_algo} ${files_utils} ) + ENDIF (WITH_QT) +ELSE (ONELIB) + add_library( container ${files_container}) + add_library( topology ${files_topology}) + add_library( algo ${files_algo}) + IF(WITH_QT) + add_library( utils ${files_utils_withQt} ) + ELSE(WITH_QT) + add_library( utils ${files_utils} ) + ENDIF (WITH_QT) + add_dependencies(utils shader_target ) +ENDIF (ONELIB) \ No newline at end of file diff --git a/apps_cmake.txt b/apps_cmake.txt index 71fe09c34..296fc702c 100644 --- a/apps_cmake.txt +++ b/apps_cmake.txt @@ -11,20 +11,31 @@ SET ( WITH_QT ON CACHE BOOL "need Qt lib ") # for CGoGN MR file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_mr.h FORCE_MR) -#MESSAGE (STATUS "MR" ${FORCE_MR}) - IF (FORCE_MR EQUAL 1) add_definitions(-DCGoGN_FORCE_MR=1) ENDIF (FORCE_MR EQUAL 1) - IF (FORCE_MR EQUAL 2) add_definitions(-DCGoGN_FORCE_MR=2) ENDIF (FORCE_MR EQUAL 2) + +# for CGoGN in one lib on not +file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h ONELIB_STR) +IF (ONELIB_STR EQUAL 1) + SET(CGoGN_LIBS_D cgognD) + SET(CGoGN_LIBS_R cgogn) +ELSE (ONELIB_STR EQUAL 1) + SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) + SET(CGoGN_LIBS_R topology algo container utils) +ENDIF (ONELIB_STR EQUAL 1) + + + IF(WIN32) set(CMAKE_PREFIX_PATH ${CGoGN_ROOT_DIR}/windows_dependencies CACHE STRING "path to dependencies") ENDIF(WIN32) + find_package(OpenGL REQUIRED) find_package(Boost COMPONENTS regex thread REQUIRED) find_package(ZLIB REQUIRED) @@ -33,8 +44,6 @@ find_package(GLEW REQUIRED) - - IF (DEFINED ASSERTON) add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON}) ELSE (DEFINED ASSERTON) @@ -112,5 +121,5 @@ ENDIF(WIN32) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) -SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) -SET(CGoGN_LIBS_R topology algo container utils) + + -- GitLab