Skip to content

Commit

Permalink
Fixed some errors for Windows VS compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mschweiger committed Jun 18, 2014
1 parent b3af4ac commit 1550589
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 72 deletions.
6 changes: 3 additions & 3 deletions arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
#ifndef __ARCH_H
#define __ARCH_H

#if defined(_WIN32) || defined(_WIN64)
#if defined(WIN32) || defined(WIN64)

#include <process.h>
#include <direct.h>
#include <float.h>
#include <stdlib.h>
#include <time.h>

#define __func__ __FUNCTION__
Expand All @@ -21,14 +22,13 @@

// avoid annoying warnings
#define hypot _hypot
#define isnan(x) _isnan((x))
#define getpid() _getpid()
#define getcwd(buffer,maxlen) _getcwd(buffer,maxlen)
#define unlink(fname) _unlink(fname)

inline double drand48(void) { return (double)rand()/(double)RAND_MAX; }
// quick fix of missing function. this should be improved upon!

#endif //_WIN32
#endif // WINxx

#endif // !__ARCH_H
2 changes: 1 addition & 1 deletion src/libmath/timing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static double tick_per_sec ()
{
clock_t ticks_per_second;

#if defined (_WIN32) || defined(_WIN64)
#if defined (WIN32) || defined(WIN64)
ticks_per_second = 100;
#else
#ifndef CLK_TCK
Expand Down
2 changes: 1 addition & 1 deletion src/libparam2001/legendre.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int factorial(int i);

double plgndr(int l, int m, double x);

toast::complex SphericalHarmonic(int l,int m, double thi, double fi); // calculates the spherical harmonic
std::complex<double> SphericalHarmonic(int l,int m, double thi, double fi); // calculates the spherical harmonic
//of degree l order m
// at the (thi,fi) point
#endif
7 changes: 3 additions & 4 deletions src/libparam2001/pplot3d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "legendre.h"
#include "pplot3d.h"

using namespace toast;
using namespace std;


Expand Down Expand Up @@ -70,7 +69,7 @@ CVector myCCompRowMatrix::DiagATA ()
for(int j=0;j<At.nCols();j++)
{
// cerr<<i<<" " <<At(i,j)<<endl;
if(At.Get(i,j)!=0) Diag[i]+=At(i,j)*At(i,j);
if(At.Get(i,j) != 0.0) Diag[i]+=At(i,j)*At(i,j);
}
}

Expand All @@ -89,7 +88,7 @@ CCompRowMatrix myCCompRowMatrix::AttA ()
At.Transpone();

int i, j,k;//, n = nCols();
toast::complex at_ik, at_jk;
std::complex<double> at_ik, at_jk;
// cerr<<"A"<<endl;
//CCoordMatrix ata(At.nRows(), At.nRows());
CDenseMatrix ata2(At.nRows(), At.nRows());
Expand All @@ -99,7 +98,7 @@ CCompRowMatrix myCCompRowMatrix::AttA ()
{
for(k=0;k<At.nCols();k++)
{
if((at_ik = At.Get(i,k))!=0 && (at_jk = At.Get(j,k))!=0)
if((at_ik = At.Get(i,k))!=0.0 && (at_jk = At.Get(j,k))!=0.0)
{
ata2(i,j)+=at_ik*at_jk;
}
Expand Down
1 change: 0 additions & 1 deletion src/libsharm/diffusphere.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "felib.h"
#include "sharmlib.h"
#include "diffusphere.h"
using namespace toast;
using namespace std;


Expand Down
4 changes: 4 additions & 0 deletions src/libstoast/GLProjector.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#define STOASTLIB_IMPLEMENTATION

#if defined(WIN32) || defined(WIN64)
#include <windows.h>
#endif
#include "stoastlib.h"
#include "GLProjector.h"
#include "GL/gl.h"
Expand Down
1 change: 0 additions & 1 deletion src/matlab/toastDisplace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "mex.h"
#include "util.h"
using namespace std;
using namespace toast;

const double M_PI=3.141592653589793;
//#define OUTPUT_SYSMAT 1
Expand Down
7 changes: 7 additions & 0 deletions toastdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
// A list of DEFINEs which fine tune TOAST compilation options
// ==========================================================================

#ifndef __TOASTDEF_H
#define __TOASTDEF_H

#include "arch.h"

#if defined(WIN32)||defined(WIN64)
#define NEED_EXPLICIT_INSTANTIATION // JK in Windows (VS2005) explicit instantiation is required
#endif
Expand Down Expand Up @@ -99,3 +104,5 @@
//#define MPI_FWDSOLVER

#endif

#endif // !__TOASTDEF_H
6 changes: 3 additions & 3 deletions win/VS2008/libfe/libfe.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="1"
>
<Tool
Expand Down Expand Up @@ -258,7 +258,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Expand Down Expand Up @@ -419,7 +419,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Expand Down
91 changes: 37 additions & 54 deletions win/VS2008/libmath/libmath.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@
/>
</Configuration>
<Configuration
Name="Release|Win32"
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
Expand All @@ -119,15 +120,18 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMATH_EXPORTS"
RuntimeLibrary="2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMATH_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Expand All @@ -143,14 +147,13 @@
Name="VCLinkerTool"
LinkIncremental="1"
AdditionalLibraryDirectories=""
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="false"
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
Expand All @@ -176,9 +179,7 @@
/>
</Configuration>
<Configuration
Name="Release_fdot|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
CharacterSet="0"
Expand Down Expand Up @@ -207,7 +208,6 @@
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Expand Down Expand Up @@ -256,12 +256,13 @@
/>
</Configuration>
<Configuration
Name="Debug|x64"
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
CharacterSet="1"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
Expand All @@ -281,14 +282,12 @@
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMATH_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PreprocessorDefinitions="NDEBUG;_USRDLL;LIBMATH_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
WarningLevel="2"
DebugInformationFormat="3"
/>
<Tool
Expand All @@ -302,12 +301,15 @@
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
AdditionalDependencies="libblas64.lib SuperLU_43.lib"
LinkIncremental="1"
AdditionalLibraryDirectories=""
IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="false"
SubSystem="2"
LinkTimeCodeGeneration="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
Expand Down Expand Up @@ -336,9 +338,9 @@
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
Name="Release_fdot|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
CharacterSet="0"
Expand All @@ -358,7 +360,6 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Expand All @@ -368,6 +369,7 @@
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Expand All @@ -381,8 +383,6 @@
/>
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
AdditionalDependencies="libblas64.lib SuperLU_43.lib"
LinkIncremental="1"
AdditionalLibraryDirectories=""
IgnoreDefaultLibraryNames=""
Expand All @@ -392,7 +392,7 @@
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
Expand Down Expand Up @@ -422,7 +422,7 @@
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\resources\toastlib.vsprops"
InheritedPropertySheets="..\resources\toastlib.vsprops;..\resources\toast_x64.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
Expand Down Expand Up @@ -450,7 +450,6 @@
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="2"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Expand Down Expand Up @@ -507,10 +506,6 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\libmath\complex.cc"
>
</File>
<File
RelativePath="..\..\..\src\libmath\cr_cholesky.cc"
>
Expand Down Expand Up @@ -547,10 +542,6 @@
RelativePath="..\..\..\src\libmath\nr.cc"
>
</File>
<File
RelativePath="..\..\..\src\libmath\scomplex.cc"
>
</File>
<File
RelativePath="..\..\..\src\libmath\scrmatrix.cc"
>
Expand Down Expand Up @@ -585,10 +576,6 @@
RelativePath="..\..\..\src\libmath\cdmatrix_imp.hpp"
>
</File>
<File
RelativePath="..\..\..\src\libmath\complex.h"
>
</File>
<File
RelativePath="..\..\..\src\libmath\cr_cholesky.h"
>
Expand Down Expand Up @@ -677,10 +664,6 @@
RelativePath="..\..\..\src\libmath\precon_imp.hpp"
>
</File>
<File
RelativePath="..\..\..\src\libmath\scomplex.h"
>
</File>
<File
RelativePath="..\..\..\src\libmath\scrmatrix.h"
>
Expand Down
Loading

0 comments on commit 1550589

Please sign in to comment.