more MSVC cmake fixes

This commit is contained in:
Gael Guennebaud 2008-12-17 18:37:04 +00:00
parent 4cb63808d4
commit 6e138d0069
5 changed files with 38 additions and 12 deletions

View File

@ -31,7 +31,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_SYSTEM_NAME MATCHES Linux)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common -fstrict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wextra -fno-exceptions -fno-check-new -fno-common -fstrict-aliasing")
if(NOT EIGEN_TEST_LIB)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(NOT EIGEN_TEST_LIB)

View File

@ -100,6 +100,8 @@ namespace Eigen {
# include "src/Sparse/UmfPackSupport.h"
#endif
#include "src/Sparse/ConstrainedCG.h"
} // namespace Eigen
#endif // EIGEN_SPARSE_MODULE_H

View File

@ -128,6 +128,17 @@ class SparseMatrix
class InnerIterator;
inline void setZero()
{
m_data.clear();
//if (m_outerSize)
memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
// for (int i=0; i<m_outerSize; ++i)
// m_outerIndex[i] = 0;
// if (m_outerSize)
// m_outerIndex[i] = 0;
}
/** \returns the number of non zero coefficients */
inline int nonZeros() const { return m_data.size(); }
@ -137,10 +148,9 @@ class SparseMatrix
*/
inline void startFill(int reserveSize = 1000)
{
m_data.clear();
std::cerr << this << " startFill\n";
setZero();
m_data.reserve(reserveSize);
for (int i=0; i<=m_outerSize; ++i)
m_outerIndex[i] = 0;
}
/**
@ -188,7 +198,7 @@ class SparseMatrix
}
m_outerIndex[outer+1] = m_outerIndex[outer];
}
//
// std::cerr << this << " " << outer << " " << inner << " - " << m_outerIndex[outer] << " " << m_outerIndex[outer+1] << "\n";
assert(m_outerIndex[outer+1] == m_data.size() && "invalid outer index");
int startId = m_outerIndex[outer];
int id = m_outerIndex[outer+1]-1;
@ -202,11 +212,17 @@ class SparseMatrix
--id;
}
m_data.index(id+1) = inner;
return (m_data.value(id+1) = 0);
//return (m_data.value(id+1) = 0);
m_data.value(id+1) = 0;
std::cerr << m_outerIndex[outer] << " " << m_outerIndex[outer+1] << "\n";
return m_data.value(id+1);
}
// inline void
inline void endFill()
{
std::cerr << this << " endFill\n";
int size = m_data.size();
int i = m_outerSize;
// find the last filled column
@ -222,6 +238,7 @@ class SparseMatrix
void resize(int rows, int cols)
{
std::cerr << this << " resize " << rows << "x" << cols << "\n";
const int outerSize = RowMajor ? rows : cols;
m_innerSize = RowMajor ? cols : rows;
m_data.clear();
@ -238,8 +255,10 @@ class SparseMatrix
}
inline SparseMatrix()
: m_outerSize(0), m_innerSize(0), m_outerIndex(0)
{}
: m_outerSize(-1), m_innerSize(0), m_outerIndex(0)
{
resize(0, 0);
}
inline SparseMatrix(int rows, int cols)
: m_outerSize(0), m_innerSize(0), m_outerIndex(0)

View File

@ -26,9 +26,9 @@ else(CHOLMOD_FOUND)
message("CHOLMOD not found, this optional backend won't be tested")
endif(CHOLMOD_FOUND)
if(NOT WIN32)
if(NOT MSVC)
enable_language(Fortran OPTIONAL)
endif(NOT WIN32)
endif(NOT MSVC)
find_package(Umfpack)
if(UMFPACK_FOUND)
@ -102,7 +102,12 @@ macro(ei_add_test testname)
if(NOT EIGEN_NO_ASSERTION_CHECKING)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
if(MSVC)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
else(MSVC)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
endif(MSVC)
option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
if(EIGEN_DEBUG_ASSERTS)
set_target_properties(${targetname} PROPERTIES COMPILE_DEFINITIONS "-DEIGEN_DEBUG_ASSERTS=1")

View File

@ -47,7 +47,7 @@ namespace Eigen
#define EI_PP_CAT2(a,b) a ## b
#define EI_PP_CAT(a,b) EI_PP_CAT2(a,b)
#define EIGEN_NO_EXCEPTIONS // disabling throwing assertions on bad alloc -- somehow makes the tests crawl
//#define EIGEN_NO_EXCEPTIONS // disabling throwing assertions on bad alloc -- somehow makes the tests crawl
#ifndef EIGEN_NO_ASSERTION_CHECKING