Compile METIS-5.1.0/ParMETIS-4.0.3 in mingw64 gcc 5.2.0

Following three modifications are needed to compile METIS-5.1.0:

1.  Modify line 4 of CMakelists.txt from
set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
    to
set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/GKlib" CACHE PATH "path to GKlib")

2. Delete POSIX include file #include <sys/resource.h> in gk_arch.h. Seems allright.

3.  Exclude
--------------
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
              struct gk_option *__longopts, int *__longind);
extern int gk_getopt_long_only (int __argc, char **__argv,
              char *__shortopts, struct gk_option *__longopts, int *__longind);
--------------
in file gk_getopt.h by, e.g.

#if !defined _MINGW64
extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
              struct gk_option *__longopts, int *__longind);
extern int gk_getopt_long_only (int __argc, char **__argv,
              char *__shortopts, struct gk_option *__longopts, int *__longind);
#endif


To compile ParMETIS-4.0.3
1. Set GKLIB_PATH like
set(GKLIB_PATH "${CMAKE_SOURCE_DIR}/metis/GKlib" CACHE PATH "path to GKlib")

2.  Add a line "include( findMPI )" in front of  "include_directories(${MPI_INCLUDE_PATH})" inside CMAKElistx.txt
     For those who use MSMPI, you should be include <_mingw.h> in mpi.h of MSMPI. Otherwise there should be undefined data type errors.

3. Do above modification 2,3 for metis compile.

Code::Blocks + GLUT + FLTK

Code::Blocks provides project templates for both GLUT and FLTK, but no for GLUT + FLTK. Here is a procedure to build a simple GLUT + FLTK program in Code::Blocks.


1.  Build up a new project for GLUT by using the Code::Blocks' template.
2.  Add search directories setting to the include and library directories of FLTK.
3.  Modify #include <GL/glut.h> in main.cpp to #include<FL/glut.H>
4.  Modify the Linker settings as follows
   1)  Add other linker options:  -mwindows
   2)  Link libraries as: fltk_images, fltk_gl, fltk, fltk_png, fltk_z, fltk_jpeg, glu32, opengl32, ole32, uuid, comctl32. Pay attention to that the sequential order of those libraries is important.


The project would be rebuilt successfully. You can then add FLTK functions as you like.

How to install GLUT for mingw

There are some binary distribution of glut in windows available, such as here. But it is not sure if they are available for your system, the version of your gcc compiler on your mingw32 or mingw64 etc. On the other hand, it is not easy to compile its sourcecode in mingw. However, freeglut provides cmake support for cross platform compiling. It is therefore suggested that freeglut, which provides binary distribution also, be adopted.


1. Compile freeglut by using cmake.


2. Keeping the include, library  and dll file of freeglut available and compile like:
    g++ -Os -Wall test.cc -o test -mwindows -lfreeglut -lopengl32 -lglu32


That's all.

如何将windows的dll库文件转换为mingw库文件

1  下载gendef
http://sourceforge.net/projects/mingw/files/MinGW/Extension/gendef/gendef-1.0.1346/


2.  执行gendef dll库文件名产生def文件
   如  gendef msmpi.dll 将产生 msmpi.def


3   执行dlltool -d msmpi.def -l libmpi.def -l libmsmpi.a -D msmpi.dll 将库文件名产生libmsmpi.a


如果要在64位机上使用msmpi,除此以外还需
1)  在/Inc/mpi.h文件的第128行,加上
     #include <stdint.h>
2) 如果使用非intel编译器,如gfortran,还需将/Inc/mpif.h文件用用mpich中的相关文件替代。

Build Trilinos in VS+intel compiler

Following software are used:
1). Trilinos 11.14.1
2). Visual studio 2012
3). Intel compiler Composer XE2013
4). cmake 3.2.1


1.  Begin with intel Command Prompt Visual Studio 2012 mode
2.  Type in : cmake-gui to open cmake gui
3.  First configure in cmake
     Specif the generate for this project: " Visual studio 11 2012 Win64"
     Speify native compiler: Here you set CMAKE_C_COMPILER.  CAMKE_CXX_COMPILER and CMAKE_FORTRAN_COMPILER to icl, ifort respectively.


4.  Afetr first configuration, Turn off Tilinos_ENABLE_OPTIONAL_PACKAGES because most libraries in trilinos cannot be compiled in windows. Turn on Trilinos_ENABLE_Epetra, Trilinos_ENABLE_Epetraext, Trilinos_ENABLE_ML. Turn on Triluinos_ENABLE_Fortran, TPL_ENABLE_MPI if needed.


5. Do configure


6. Libraries like BLAS, LAPACK, MPI maybe missing. Set
   BLAS_LIBRARIES_DIRS = /pahto/mkl/lib/intel64
   BLAS_LIBRARIE_MAKE = mkl_intel_lp64


   LAPACK_LIBRARIES_DIRS = /pahto/mkl/lib/intel64
   LAPACK_LIBRARIE_MAKE = mkl_intel_lp64


  MPI_BASE_DIR = C:/Program Files/Microsoft HPC Pack2012/
  ........
by hand.


7.  Do configure
8. Do generate. You would get MSVC solution files.
9. Double click Trillinos.sln.
10. Add a preprocessor definition ICL and compile.

VS Code下cmake, c++编译,调试环境的构成步骤

1   下载必须extension      按[Ctrl+Shift+X]打开extension窗口,选择安装"C/C++", "CMake", "CMake Tools" 2   在VSCode下打开作业目录 ...