From f8f7c2e229b9e608081ce3089881aea061a1287b Mon Sep 17 00:00:00 2001 From: thery Date: Sun, 1 May 2011 23:47:50 +0200 Subject: [PATCH] simplification compilation windows pb VarInt sous Windows et static const float --- Apps/CMakeLists.txt | 5 +++-- Apps/Examples/Release/CMakeLists.txt | 9 ++++++--- Apps/Tuto/CMakeLists.txt | 13 +++++++------ Apps/Tuto/tuto_mt.cpp | 2 +- ThirdParty/CMakeLists.txt | 9 +++++---- ThirdParty/gzstream/gzstream.h | 8 ++++---- build/CMakeLists.txt | 8 ++++---- build/Debug/CMakeLists.txt | 12 +++++++----- build/Release/CMakeLists.txt | 12 ++++++++---- include/Utils/glutwin.h | 4 ++-- include/Utils/img3D_IO.h | 20 ++++++++++---------- include/Utils/os_spec.h | 17 ++++------------- include/Utils/qtInputs.h | 6 +++--- include/Utils/qtgl.h | 2 +- include/Utils/trackball.h | 8 ++++---- src/Algo/Render/mapRender.cpp | 2 -- src/Utils/qtgl.cpp | 1 + src/Utils/qtinputs.cpp | 8 ++++---- 18 files changed, 74 insertions(+), 72 deletions(-) diff --git a/Apps/CMakeLists.txt b/Apps/CMakeLists.txt index af96e8c1..935f7562 100644 --- a/Apps/CMakeLists.txt +++ b/Apps/CMakeLists.txt @@ -2,13 +2,14 @@ SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin) SET (COMMON_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${DEVIL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} gzstream AntTweakBar openctm assimp) -SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) -SET(CGoGN_LIBS_R topology algo container utils) +SET(CGoGN_LIBS_R topology algo container utils) IF(WIN32) + SET(CGoGN_LIBS_D topology algo container utils) # libs have same name but in different place in Visual add_subdirectory(Examples/Release) add_subdirectory(Tuto) ELSE(WIN32) + SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) add_subdirectory(Examples/Release) add_subdirectory(Examples/Debug) add_subdirectory(Examples/Tests) diff --git a/Apps/Examples/Release/CMakeLists.txt b/Apps/Examples/Release/CMakeLists.txt index 4860dfd8..0350d6a2 100644 --- a/Apps/Examples/Release/CMakeLists.txt +++ b/Apps/Examples/Release/CMakeLists.txt @@ -28,9 +28,12 @@ include_directories( ) # define libs path -link_directories( - ${CGoGN_ROOT_DIR}/lib/Release -) +IF(WIN32) + link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName) ) +ELSE(WIN32) + link_directories( ${CGoGN_ROOT_DIR}/lib/Release ) +ENDIF(WIN32) + #define exec to compile diff --git a/Apps/Tuto/CMakeLists.txt b/Apps/Tuto/CMakeLists.txt index 403823ec..50e679c1 100644 --- a/Apps/Tuto/CMakeLists.txt +++ b/Apps/Tuto/CMakeLists.txt @@ -2,12 +2,8 @@ cmake_minimum_required(VERSION 2.6) project(Tutos) -#SET (COMMON_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${DEVIL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} gzstream AntTweakBar openctm) - SET (CMAKE_BUILD_TYPE Debug) - - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING") # FOR Qt4 @@ -28,9 +24,14 @@ include_directories( ${CGoGN_ROOT_DIR}/include ) - # define libs path -link_directories(${CGoGN_ROOT_DIR}/lib/Release ${CGoGN_ROOT_DIR}/lib/Debug) +IF(WIN32) + link_directories(${CGoGN_ROOT_DIR}/lib/$(ConfigurationName)) +ELSE(WIN32) + link_directories(${CGoGN_ROOT_DIR}/lib/Release ${CGoGN_ROOT_DIR}/lib/Debug) +ENDIF(WIN32) + + #define exec to compile diff --git a/Apps/Tuto/tuto_mt.cpp b/Apps/Tuto/tuto_mt.cpp index e15ec2d7..91f3ee35 100644 --- a/Apps/Tuto/tuto_mt.cpp +++ b/Apps/Tuto/tuto_mt.cpp @@ -408,7 +408,7 @@ int main(int argc, char **argv) { using namespace CGoGN::Utils::QT; - inputValues( VarInt(0,20,xx, "Entier", + inputValues( VarInteger(0,20,xx, "Entier", VarBool(zz, "Bool", VarDbl(0.314,3.14,yy,"Double", VarSlider(10,100,kk,"Slider", diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index e5595781..cd733e66 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -8,6 +8,7 @@ SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..) find_package(OpenGL) find_package(GLUT) + IF (APPLE) SET(CMAKE_OSX_ARCHITECTURES x86_64) ENDIF(APPLE) @@ -19,10 +20,10 @@ IF(WIN32) add_subdirectory(gzstream/Build) add_subdirectory(Numerical) add_subdirectory(Assimp/code) - if(CMAKE_CONFIGURATION_TYPES) - set(CMAKE_CONFIGURATION_TYPES Release) - set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Use only Release configuration for ThirdParty" FORCE) - endif() +# if(CMAKE_CONFIGURATION_TYPES) +# set(CMAKE_CONFIGURATION_TYPES Release) +# set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Use only Release configuration for ThirdParty" FORCE) +# endif() ELSE(WIN32) SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/Release) add_custom_target( FakeTargetOpenCTM ALL "make" diff --git a/ThirdParty/gzstream/gzstream.h b/ThirdParty/gzstream/gzstream.h index 07714b06..7cb94772 100644 --- a/ThirdParty/gzstream/gzstream.h +++ b/ThirdParty/gzstream/gzstream.h @@ -36,10 +36,10 @@ #include #include #include - #ifndef PI_DEFINED - #define PI_DEFINED - const double M_PI = 3.14159265359; - #endif + //#ifndef PI_DEFINED + //#define PI_DEFINED + //double M_PI = 3.14159265359; + //#endif #endif diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 16a12695..72991aae 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -9,7 +9,8 @@ SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..) SET(CMAKE_MODULE_PATH " ${CMAKE_MODULE_PATH} ${CGoGN_ROOT_DIR}/cmake_modules/") -find_package(OpenGL) +find_package(OpenGL REQUIRED) +find_package(Qt4 REQUIRED) find_package(GLUT) # qq definition specifiques pour mac @@ -28,7 +29,6 @@ IF(WIN32) SET(LIBXML2_LIBRARIES xml2) INCLUDE_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/include/) LINK_DIRECTORIES(${CGoGN_ROOT_DIR}/windows_dependencies/lib/) -# add_subdirectory(${CGoGN_ROOT_DIR}/ThirdParty ThirdParty) add_subdirectory(Release) add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps) if (EXISTS "${CGoGN_ROOT_DIR}/Perso") @@ -37,7 +37,7 @@ IF(WIN32) if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES Release Debug) - set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Use only Release configuration for ThirdParty" FORCE) + set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE) endif() ELSE(WIN32) @@ -51,7 +51,7 @@ ELSE(WIN32) ELSE(IL_LIBRARIES) SET(DEVIL_LIBRARIES ${IL_LIBRARY} ${ILU_LIBRARY} ${ILUT_LIBRARY}) ENDIF(IL_LIBRARIES) -# add_subdirectory(${CGoGN_ROOT_DIR}/ThirdParty ThirdParty) + add_subdirectory(Release) add_subdirectory(Debug) add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps) diff --git a/build/Debug/CMakeLists.txt b/build/Debug/CMakeLists.txt index f8485b28..d26d63de 100644 --- a/build/Debug/CMakeLists.txt +++ b/build/Debug/CMakeLists.txt @@ -2,15 +2,17 @@ cmake_minimum_required(VERSION 2.6) project(CGoGNDebug) -set(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/Debug) - -#SET(BUILD_SHARED_LIBS,FALSE) - SET(CMAKE_BUILD_TYPE Debug) +IF(WIN32) + SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib) +ELSE(WIN32) + SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/Debug) +ENDIF(WIN32) + +#SET(BUILD_SHARED_LIBS,FALSE) # FOR Qt4 -FIND_PACKAGE(Qt4 REQUIRED) SET(QT_USE_QTOPENGL TRUE) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) diff --git a/build/Release/CMakeLists.txt b/build/Release/CMakeLists.txt index a455f2a9..86700356 100644 --- a/build/Release/CMakeLists.txt +++ b/build/Release/CMakeLists.txt @@ -2,15 +2,19 @@ cmake_minimum_required(VERSION 2.6) project(CGoGNRelease) -set(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/Release) +SET(CMAKE_BUILD_TYPE Release) +IF(WIN32) + SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib) +ELSE(WIN32) + SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib/Release) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING") +ENDIF(WIN32) #SET(BUILD_SHARED_LIBS,FALSE) -SET(CMAKE_BUILD_TYPE Release) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING") + # FOR Qt4 -FIND_PACKAGE(Qt4 REQUIRED) SET(QT_USE_QTOPENGL TRUE) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) diff --git a/include/Utils/glutwin.h b/include/Utils/glutwin.h index 7cf1ea23..28478109 100644 --- a/include/Utils/glutwin.h +++ b/include/Utils/glutwin.h @@ -30,7 +30,7 @@ #define __X_GL_H #define GLAPIENTRY -#include +#include #ifndef WIN32 #ifdef MAC_OSX @@ -54,7 +54,7 @@ namespace CGoGN namespace Utils { -APIEXPORT class SimpleGlutWin +class SimpleGlutWin { protected: // internal values used for the manipulation of object diff --git a/include/Utils/img3D_IO.h b/include/Utils/img3D_IO.h index 2154e514..9fb8a23c 100644 --- a/include/Utils/img3D_IO.h +++ b/include/Utils/img3D_IO.h @@ -45,7 +45,7 @@ namespace Img3D_IO * Initialization of IO * Necessary before any other call */ - void APIEXPORT initIO(); + void initIO(); /** * Load bool image (0/255) @@ -77,7 +77,7 @@ namespace Img3D_IO * @param vz voxel size z * @param tag image tag */ - APIEXPORT void saveBool(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); + void saveBool(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); /** * Load 8 bits image, if image is boolean compressed, it uncompress it ! @@ -92,7 +92,7 @@ namespace Img3D_IO * @param tag image tag (reference out) * @return a pointer on the image data (that have been allocated by function) */ - APIEXPORT unsigned char* loadVal_8(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag); + unsigned char* loadVal_8(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag); /** * Save 8bits val image @@ -108,7 +108,7 @@ namespace Img3D_IO * @param vz voxel size z * @param tag image tag */ - APIEXPORT void saveVal(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); + void saveVal(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); /** @@ -124,7 +124,7 @@ namespace Img3D_IO * @param tag image tag (reference out) * @return a pointer on the image data (that have been allocated by function) */ - APIEXPORT unsigned short* loadVal_16(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag); + unsigned short* loadVal_16(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag); /** * Save 16bits val image @@ -140,7 +140,7 @@ namespace Img3D_IO * @param vz voxel size z * @param tag image tag */ - APIEXPORT void saveVal_16(ILstring filename, unsigned short* data, int w, int h, int d, float vx, float vy, float vz, int tag); + void saveVal_16(ILstring filename, unsigned short* data, int w, int h, int d, float vx, float vy, float vz, int tag); /** * Load float value image @@ -155,7 +155,7 @@ namespace Img3D_IO * @param tag image tag (reference out) * @return a pointer on the image data (that have been allocated by function) */ - APIEXPORT float* loadVal_float(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id); + float* loadVal_float(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id); /** * Save float val image @@ -171,7 +171,7 @@ namespace Img3D_IO * @param vz voxel size z * @param tag image tag */ - APIEXPORT void saveVal_float(ILstring filename, float* data, int w, int h, int d, float vx, float vy, float vz, int tag); + void saveVal_float(ILstring filename, float* data, int w, int h, int d, float vx, float vy, float vz, int tag); /** @@ -187,7 +187,7 @@ namespace Img3D_IO * @param tag image tag (reference out) * @return a pointer on the image data (that have been allocated by function) */ - APIEXPORT unsigned char* loadRGB(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id); + unsigned char* loadRGB(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id); /** * Save RGB 8 bits image @@ -203,7 +203,7 @@ namespace Img3D_IO * @param vz voxel size z * @param tag image tag */ - APIEXPORT void saveRGB(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); + void saveRGB(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag); } //namespace } //namespace diff --git a/include/Utils/os_spec.h b/include/Utils/os_spec.h index 863ba2dc..e04820a7 100644 --- a/include/Utils/os_spec.h +++ b/include/Utils/os_spec.h @@ -8,19 +8,10 @@ #include #include #include - #ifndef PI_DEFINED - #define PI_DEFINED - const double M_PI = 3.14159265359; - #endif - #ifdef EXPORTING - // #define APIEXPORT __declspec(dllexport) - #define APIEXPORT -#else -// #define APIEXPORT __declspec(dllimport) - #define APIEXPORT - #endif -#else - #define APIEXPORT + //#ifndef PI_DEFINED + //#define PI_DEFINED + //double M_PI=3.14159265359; + //#endif #endif // SPECIFIC FOR MAC diff --git a/include/Utils/qtInputs.h b/include/Utils/qtInputs.h index 52e89ad3..c42e8e72 100644 --- a/include/Utils/qtInputs.h +++ b/include/Utils/qtInputs.h @@ -82,15 +82,15 @@ public: * Class for integer input in dialog window (with spinbox) * Use: VarBool(min,max,ref_to_val, "label" [,nextVar]) */ -class VarInt: public Var +class VarInteger: public Var { public: int m_min; int m_max; int& m_val; public: - VarInt(int min, int max, int& val, const std::string& label); - VarInt(int min, int max, int& val, const std::string& label, const Var& var); + VarInteger(int min, int max, int& val, const std::string& label); + VarInteger(int min, int max, int& val, const std::string& label, const Var& var); QWidget* createInput() const; void updateFrom( QWidget* widg) const; }; diff --git a/include/Utils/qtgl.h b/include/Utils/qtgl.h index 1fee7f8f..544029cb 100644 --- a/include/Utils/qtgl.h +++ b/include/Utils/qtgl.h @@ -62,7 +62,7 @@ public: protected: - static const float FAR_PLANE=500.0f; + static float FAR_PLANE; SimpleQT* m_cbs; diff --git a/include/Utils/trackball.h b/include/Utils/trackball.h index 6323a454..e4973222 100644 --- a/include/Utils/trackball.h +++ b/include/Utils/trackball.h @@ -64,7 +64,7 @@ namespace Utils * The resulting rotation is returned as a quaternion rotation in the * first paramater. */ -APIEXPORT void +void trackball(float q[4], float p1x, float p1y, float p2x, float p2y); /* @@ -75,14 +75,14 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y); * rotation, the second and third the total rotation (which will be * over-written with the resulting new total rotation). */ -APIEXPORT void +void add_quats(float *q1, float *q2, float *dest); /* * A useful function, builds a rotation matrix in Matrix based on * given quaternion. */ -APIEXPORT void +void build_rotmatrix(float m[4][4], float q[4]); @@ -93,7 +93,7 @@ void build_rotmatrixgl3(glm::mat4& m, float q[4]); * the given vector) and an angle about which to rotate. The angle is * expressed in radians. The result is put into the third argument. */ -APIEXPORT void +void axis_to_quat(float a[3], float phi, float q[4]); } //namespace Utils diff --git a/src/Algo/Render/mapRender.cpp b/src/Algo/Render/mapRender.cpp index a86d0e3f..a1abb9eb 100644 --- a/src/Algo/Render/mapRender.cpp +++ b/src/Algo/Render/mapRender.cpp @@ -50,8 +50,6 @@ MapRender::MapRender(): MapRender::~MapRender() { glDeleteBuffersARB(4, m_VBOBuffers); - delete[] m_VBOBuffers ; - } diff --git a/src/Utils/qtgl.cpp b/src/Utils/qtgl.cpp index 7b6c584d..35c66cb3 100644 --- a/src/Utils/qtgl.cpp +++ b/src/Utils/qtgl.cpp @@ -35,6 +35,7 @@ namespace Utils namespace QT { +float GLWidget::FAR_PLANE=500.0f; GLWidget::GLWidget(SimpleQT* cbs, QWidget *parent) : QGLWidget(QGLFormat(QGL::Rgba | QGL::DoubleBuffer| QGL::DepthBuffer), parent), diff --git a/src/Utils/qtinputs.cpp b/src/Utils/qtinputs.cpp index f06e7766..5064053e 100644 --- a/src/Utils/qtinputs.cpp +++ b/src/Utils/qtinputs.cpp @@ -144,20 +144,20 @@ void VarBool::updateFrom( QWidget* widg) const //class VarInt -VarInt::VarInt(int min, int max, int& val, const std::string& label): +VarInteger::VarInteger(int min, int max, int& val, const std::string& label): m_min(min),m_max(max), m_val(val) { m_label= label; } -VarInt::VarInt(int min, int max, int& val, const std::string& label, const Var& var): +VarInteger::VarInteger(int min, int max, int& val, const std::string& label, const Var& var): Var(var), m_min(min),m_max(max), m_val(val) { m_label= label; } -QWidget* VarInt::createInput() const +QWidget* VarInteger::createInput() const { QSpinBox *spin = new QSpinBox(); spin->setRange(m_min, m_max); @@ -165,7 +165,7 @@ QWidget* VarInt::createInput() const return spin; } -void VarInt::updateFrom( QWidget* widg) const +void VarInteger::updateFrom( QWidget* widg) const { QSpinBox* spin = dynamic_cast(widg); m_val = spin->value(); -- GitLab