Commit a6be6563 authored by promayon's avatar promayon
Browse files

FIXED multiple warning on MSVC2013 (tentative)

FIXED test cmake macros now works for non-camitk applications outside the sdk (e.g., modeling/libraries/lml/test generates a non-camitk application stand alone executable to test the lml library independently, it works now)


git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1361 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 87bef54a
......@@ -6,3 +6,9 @@ camitk_extension( ACTION_EXTENSION
DESCRIPTION "This action features basic ITK image processing segmentation algorithms"
TEST_APPLICATION ${APPLICATION_TEST_ACTION}
)
if(ACTION_ITKSEGMENTATION AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# only ITK < 4 is supported on Linux in current CamiTK version
# ITKAlgorithms is needed for WatershedSegmentationAction
target_link_libraries(action-itksegmentation ITKAlgorithms)
endif()
\ No newline at end of file
......@@ -115,7 +115,7 @@ unsigned int AtomDC::registerIndexInSCDC ( std::IndexInParentItemPair p ) {
//cout << "AtomDC " << getName().toStdString() << " registerIndexInSCDC(" << dynamic_cast<StructuralComponentDC *> ( p.first )->getName().toStdString() << "," << p.second << endl;
return mySCDCindexes.size();
return (unsigned int) mySCDCindexes.size();
}
// -------------------- getOrderNumberInSCDC --------------------
......@@ -131,7 +131,7 @@ int AtomDC::getOrderNumberInSCDC ( StructuralComponentDC * parent ) {
// -------------------- unregisterIndexInSCDC --------------------
unsigned int AtomDC::unregisterIndexInSCDC ( StructuralComponentDC * parent ) {
mySCDCindexes.erase ( dynamic_cast<InterfaceNode *> ( parent ) );
return mySCDCindexes.size();
return (unsigned int) mySCDCindexes.size();
}
// -------------------- getPopupMenu --------------------
......
......@@ -155,9 +155,9 @@ double Load::getValue(const double t) {
#if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
namespace std {
bool greater(const ValueEvent* lhs, const ValueEvent* rhs) {
return lhs->getDate() < rhs->getDate();
}
bool greater(const ValueEvent* lhs, const ValueEvent* rhs) {
return lhs->getDate() < rhs->getDate();
}
}
#else
// ------------- sorting overloaded function ---------
......@@ -165,12 +165,12 @@ namespace std {
// this kind of overloads where you need them - compiler efficiency?
// so it is here cause needed in the addEvent method for the sort)
namespace std {
template <>
struct greater<ValueEvent*> {
bool operator()(const ValueEvent* lhs, const ValueEvent* rhs) const {
return lhs->getDate() < rhs->getDate();
}
};
template <>
struct greater<ValueEvent*> {
bool operator()(const ValueEvent* lhs, const ValueEvent* rhs) const {
return lhs->getDate() < rhs->getDate();
}
};
}
#endif
......@@ -181,9 +181,9 @@ void Load::addEvent(ValueEvent * ve) {
//-- sort the list by date
#if defined(_WIN32) && !defined(__MINGW32__) && ((_MSC_VER > 1700) || (_MSC_VER < 1600)) // MSVC<10 and MSVC11+ (VS 2012+) only, see http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.100%29.aspx
std::sort(eventList.begin(), eventList.end(), std::greater); // use the greater() method (see above)
std::sort(eventList.begin(), eventList.end(), std::greater); // use the greater() method (see above)
#else
std::sort(eventList.begin(), eventList.end(), std::greater<ValueEvent *>()); // use the greater() method (see above)
std::sort(eventList.begin(), eventList.end(), std::greater<ValueEvent *>()); // use the greater() method (see above)
#endif
}
......@@ -249,26 +249,26 @@ void Load::setDirection(const Direction &d) {
// --------------- getValueEvent ---------------
ValueEvent * Load::getValueEvent(const unsigned int i) const {
if (i<eventList.size())
return eventList[i];
return eventList[i];
else
return NULL;
}
}
// --------------- numberOfValueEvents ---------------
unsigned int Load::numberOfValueEvents() const {
return eventList.size();
}
// --------------- numberOfValueEvents ---------------
unsigned int Load::numberOfValueEvents() const {
return (unsigned int) eventList.size(); // if there are more than MAX_INT events, too bad (that's over 2,147,483,647 anyway...)
}
// --------------- getUnit ---------------
Unit Load::getUnit() const {
return unit;
}
// --------------- getUnit ---------------
Unit Load::getUnit() const {
return unit;
}
// --------------- setUnit ---------------
void Load::setUnit(const Unit u) {
unit = u;
}
// --------------- setUnit ---------------
void Load::setUnit(const Unit u) {
unit = u;
}
// --------------- getType --------------
......@@ -302,7 +302,7 @@ void Load::xmlPrint(std::ostream & o) const {
}
dir.xmlPrint(o);
o << "\t<unit>" << getUnit().getUnitName() << "</unit>" << std::endl;
o << "</load>" << std::endl;
......
......@@ -120,7 +120,7 @@ Load * Loads::getLoad(const unsigned int i) const {
// ------------------ numberOfLoads ------------------
unsigned int Loads::numberOfLoads() const {
return loads.size();
return (unsigned int) loads.size(); // if there are more than MAX_INT loads, too bad (that's over 2,147,483,647 anyway...)
}
// ------------------ deleteLoad ------------------
......
......@@ -48,7 +48,7 @@ void TargetList::add(const unsigned int index) {
#define isDigit(c) ((c)>='0' && (c)<='9')
void TargetList::add(const std::string s) {
int begin, end, len, i,j;
size_t begin, end, len, i, j;
// inits
len = s.size();
......@@ -126,9 +126,9 @@ void TargetList::add(const std::string s) {
// --------------- getNumberOfTargets ---------------
unsigned int TargetList::getNumberOfTargets() const {
if (indexedTargets()) {
return indexedTargetList.size();
return (unsigned int) indexedTargetList.size(); // if there are more than MAX_INT indexed targets, too bad (that's over 2,147,483,647 anyway...)
} else {
return namedTargetList.size();
return (unsigned int) namedTargetList.size(); // if there are more than MAX_INT named targets, too bad (that's over 2,147,483,647 anyway...)
}
}
......
......@@ -59,7 +59,7 @@ MultipleCriterion::~MultipleCriterion()
// -------------------- getNumberOfChildren --------------------
int MultipleCriterion::getNumberOfChildren()
{
return criterias.size();
return (int) criterias.size();
}
// -------------------- getChild --------------------
......
......@@ -157,7 +157,7 @@ inline std::vector <MultiComponent *> Component::getAllParentMultiComponents() {
return parentMultiComponentList;
}
inline unsigned int Component::getNumberOfParentMultiComponents() const {
return parentMultiComponentList.size();
return (unsigned int) parentMultiComponentList.size();
}
inline MultiComponent * Component::getParentMultiComponent(unsigned int i) {
if (i<parentMultiComponentList.size())
......
......@@ -102,8 +102,8 @@ protected:
};
// -------------------- inline methods -------------------
inline unsigned int MultiComponent::getNumberOfSubComponents() const {
return components.size();
inline unsigned int MultiComponent::getNumberOfSubComponents() const {
return (unsigned int) components.size();
}
inline Component * MultiComponent::getSubComponent(const unsigned int i) const {
if (i<components.size())
......
......@@ -59,7 +59,7 @@ void Properties::domToFields(xmlNodePtr node) {
// ---------------- numberOfFields -----------------
unsigned int Properties::numberOfFields() const {
return fields.size();
return (unsigned int) fields.size();
}
// ---------------- getField -----------------
......
......@@ -238,7 +238,7 @@ inline Structure * StructuralComponent::getStructureByName(const std::string n)
return (*it);
}
inline unsigned int StructuralComponent::getNumberOfStructures() const {
return structures.size();
return (unsigned int) structures.size();
}
inline void StructuralComponent::removeStructure(Structure *s) {
if (s) {
......
......@@ -110,7 +110,7 @@ inline std::vector <StructuralComponent *> Structure::getAllStructuralComponents
return mySCs;
}
inline unsigned int Structure::getNumberOfStructuralComponents() const {
return mySCs.size();
return (unsigned int) mySCs.size();
}
inline StructuralComponent * Structure::getStructuralComponent(unsigned int i) {
if (i<mySCs.size())
......
......@@ -274,7 +274,7 @@ void MeshQuality::updateTableWidget(vtkSmartPointer< vtkDoubleArray > qualityArr
indices = elementsMap[VTK_QUAD];
}
// resize the table
qualityInfo->setRowCount(indices.size());
qualityInfo->setRowCount((int)indices.size()); // if there are more than MAX_INT cells, too bad (that's over 2,147,483,647 cells anyway...)
minV = VTK_DOUBLE_MAX;
maxV = VTK_DOUBLE_MIN;
......
......@@ -233,9 +233,9 @@ vtkSmartPointer< vtkUnstructuredGrid > MergeMeshs::removeDuplicateCells(vtkSmart
int nbreDupTet;
if (nbrTET.size()>1) {
nbreDupTet =0;
for(vtkIdType j = 0; j<nbrTET.size(); j++) {
for(vtkIdType j = 0; (unsigned)j< nbrTET.size(); j++) {
std::vector<std::vector<double> > t1 (nbrTET_points.begin()+(4*j),nbrTET_points.begin()+((4*j)+4));
for(vtkIdType k = 0; k<nbrTET.size(); k++) {
for(vtkIdType k = 0; (unsigned) k<nbrTET.size(); k++) {
std::vector<std::vector<double> > t2 (nbrTET_points.begin()+(4*k),nbrTET_points.begin()+((4*k)+4));
if(duplicateTetra(t1,t2)) {
nbreDupTet++;
......@@ -245,7 +245,7 @@ vtkSmartPointer< vtkUnstructuredGrid > MergeMeshs::removeDuplicateCells(vtkSmart
if (nbreDupTet != (nbrTET.size()*nbrTET.size())) {
//tetras are not the same. A triangle between both is no longer necessary
for (vtkIdType j =0; j <keptTRI.size(); j++) {
for (vtkIdType j =0; (unsigned) j<keptTRI.size(); j++) {
duplicateTRI.push_back(keptTRI[j]);
}
}
......
......@@ -282,6 +282,7 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CAMITK_CMAKE_DIR}
${CAMITK_CMAKE_DIR}/modules
${CAMITK_CMAKE_DIR}/modules/macros
${CAMITK_CMAKE_DIR}/macros
${CAMITK_USER_CMAKE_DIR}
${CAMITK_USER_CMAKE_DIR}/modules
......
......@@ -56,13 +56,24 @@ macro(camitk_add_test)
set(CAMITK_TEST_LIST ${CAMITK_TEST_LIST} ${CAMITK_TEST_NAME})
# message(STATUS "Configuring test ${CAMITK_TEST_NAME}")
#CAMITK_INSTALL_PREFIX is camitk/src/sdk directory ...
set(CAMITK_INSTALL_PREFIX ${SDK_TOP_LEVEL_SOURCE_DIR})
# determine cmake macro path
if (NOT EXISTS SDK_TOP_LEVEL_SOURCE_DIR)
# this macro is called outside the sdk
set(CAMITK_CMAKE_MACRO_PATH ${CAMITK_CMAKE_DIR}/modules/macros)
if(NOT IS_DIRECTORY ${CAMITK_CMAKE_MACRO_PATH})
# inside opensource but not in sdk (modeling or imaging)
set(CAMITK_CMAKE_MACRO_PATH ${CMAKE_SOURCE_DIR}/sdk/cmake/modules/macros)
endif()
else()
# directly use the macro source dir
set(CAMITK_CMAKE_MACRO_PATH ${SDK_TOP_LEVEL_SOURCE_DIR}/cmake/modules/macros)
endif()
# create test output directory
set(CAMITK_TEST_OUTPUT_DIR "${CMAKE_BINARY_DIR}/Testing/Temporary/${CAMITK_TEST_NAME}")
# message(STATUS "Creating test output dir ${CAMITK_TEST_OUTPUT_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_TEST_OUTPUT_DIR})
# check which test is to be done
if(CAMITK_ADD_TEST_PASS_FILE)
add_test(NAME ${CAMITK_TEST_NAME}
......@@ -72,9 +83,9 @@ macro(camitk_add_test)
-DCAMITK_TEST_PASS_FILE=${CAMITK_ADD_TEST_PASS_FILE}
-DCAMITK_TEST_OUTPUT_DIR=${CAMITK_TEST_OUTPUT_DIR}
-DCAMITK_TEST_NAME=${CAMITK_TEST_NAME}
-P ${CAMITK_INSTALL_PREFIX}/cmake/modules/macros/CamiTKTestPassFile.cmake
-P ${CAMITK_CMAKE_MACRO_PATH}/CamiTKTestPassFile.cmake
)
elseif(CAMITK_ADD_TEST_PASS_FILE_OUTPUT)
elseif()
add_test(NAME ${CAMITK_TEST_NAME}
COMMAND ${CMAKE_COMMAND}
-DCAMITK_TEST_COMMAND=${CAMITK_INIT_TEST_EXECUTABLE}
......@@ -82,7 +93,7 @@ macro(camitk_add_test)
-DCAMITK_TEST_PASS_FILE=${CAMITK_ADD_TEST_PASS_FILE_OUTPUT}
-DCAMITK_TEST_OUTPUT_DIR=${CAMITK_TEST_OUTPUT_DIR}
-DCAMITK_TEST_NAME=${CAMITK_TEST_NAME}
-P ${CAMITK_INSTALL_PREFIX}/cmake/modules/macros/CamiTKTestCompareFile.cmake
-P ${CAMITK_CMAKE_MACRO_PATH}/CamiTKTestCompareFile.cmake
)
else()
# set output files for more advanced checking/debugging
......
......@@ -27,9 +27,9 @@
#! ...
#! # Start the test series for myprogram
#! camitk_init_test(myprogram)
#! camitk_add_test(...) # will be called myprogram_1
#! camitk_add_test(...) # will be called myprogram1
#! ...
#! camitk_add_test(...) # myprogram_2
#! camitk_add_test(...) # myprogram2
#!
#! \endcode
#
......@@ -51,14 +51,27 @@ macro(camitk_init_test)
if(NOT TARGET ${CAMITK_INIT_TEST_DEFAULT_ARGS})
message(FATAL_ERROR "Initializing test ${CAMITK_TEST_BASENAME} cannot proceed: ${CAMITK_INIT_TEST_DEFAULT_ARGS} is not a proper target")
endif()
# get the application real name using the target properties
get_target_property( APP_NAME ${CAMITK_INIT_TEST_DEFAULT_ARGS} OUTPUT_NAME )
# add debug postfix if needed by MSVC
set( APP_SUFFIX "" )
if(MSVC)
get_target_property( APP_SUFFIX ${CAMITK_INIT_TEST_DEFAULT_ARGS} DEBUG_POSTFIX )
endif()
# message( STATUS "CAMITK_INIT_TEST_DEFAULT_ARGS " ${CAMITK_INIT_TEST_DEFAULT_ARGS} "APP_SUFFIX " ${APP_SUFFIX} "APP_NAME " ${APP_NAME})
endif()
endif()
# if there is an error, it might be that the macro is used with a non-camitk application, just use the default parameter as application name
if (APP_NAME STREQUAL "APP_NAME-NOTFOUND")
set(APP_NAME ${CAMITK_INIT_TEST_DEFAULT_ARGS})
# CAMITK_INIT_TEST_EXECUTABLE is not the application name but the full path to it
set(CAMITK_INIT_TEST_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}${APP_SUFFIX} )
else()
# CAMITK_INIT_TEST_EXECUTABLE is not the application name but the full path to the binary to be executed
set(CAMITK_INIT_TEST_EXECUTABLE ${CAMITK_BUILD_BIN_DIR}/${APP_NAME}${APP_SUFFIX} )
endif()
set(CAMITK_TEST_BASENAME ${CAMITK_INIT_TEST_DEFAULT_ARGS})
# message(STATUS "Initializing test series for ${CAMITK_TEST_BASENAME}")
set( CAMITK_INIT_TEST_EXECUTABLE ${CAMITK_BUILD_BIN_DIR}/${APP_NAME}${APP_SUFFIX} ) #Here, it is not the application name we give but the name of the binary to be executed.
# message(STATUS "Initializing test series for ${CAMITK_TEST_BASENAME}")
endmacro()
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include <Component.h>
......@@ -198,8 +198,8 @@ std::string VtkMeshUtil::getVtkPointSetHeaderString(std::string vtkFileName, Vtk
break;
}
case VtkMeshUtil::UNKNOWN: {
int nbegin = vtkFileName.find_last_of('/');
int nend = vtkFileName.find_last_of('.');
size_t nbegin = vtkFileName.find_last_of('/');
size_t nend = vtkFileName.find_last_of('.');
headerStr = vtkFileName.substr(nbegin+1, nend - nbegin - 1);
break;
}
......
......@@ -35,6 +35,11 @@
#include <QFileInfo>
#include <QVector>
// Hide warning for Exception + declspec(nothrow)
#if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
#pragma warning( disable : 4290 )
#endif // MSVC only
// Dependency from cepcoreschema
// Declaration here to avoid declaration in dependant projects.
namespace cepcoreschema {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment