Skip to content

Commit 475956d

Browse files
committed
CMakeLists - build FORNAN and EXAMPLES directory as an otpion
Fix doxygen errors. It turns out that "-" at the start of a line terminates a text-block. < and > need to be escaped. A few other comment blocks needed minor editting to work with Doxygen 1.8.14 properly Added "getopt.h" to some i.c files to take advantage of MINGW64 getopt support. Added external function protypes to C examples and stuff in the FORTRAN directory to avoid implicit dunctions from being defined for some things. That can have unintentional consequences. ftp in examples has to be defined to the EXACT size of pointers. Thus, the pointers in 32-bit Windows MUST be 32-bits wide and 64-bits in Win64. This also would apply in Linux. The old code assumed that the pointer-type cast always 64-bits wide. GCC warns about this stuff for good reason.\ The main function in programs must be defined with an "int" return type. This removes most code warnings. There still are Doxygen warnings about undocumented stuff.
1 parent 0cb29b9 commit 475956d

36 files changed

+296
-113
lines changed

CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ option(enable_single "Enable single precision library" ON)
100100
option(enable_double "Enable double precision library" ON)
101101
option(enable_complex "Enable complex precision library" ON)
102102
option(enable_complex16 "Enable complex16 precision library" ON)
103-
# option(enable_examples "Build examples" ON)
103+
option(enable_examples "Build examples" ON)
104104

105105
# setup required compiler defines and options.
106106
## add_definitions(-DPRNTlevel=0 -DAdd_)
@@ -167,6 +167,7 @@ endif()
167167
######################################################################
168168

169169
include_directories(${CMAKE_SOURCE_DIR}/SRC)
170+
include_directories(${CMAKE_SOURCE_DIR}/FORTRAN)
170171

171172
######################################################################
172173
#
@@ -175,6 +176,8 @@ include_directories(${CMAKE_SOURCE_DIR}/SRC)
175176
######################################################################
176177

177178
add_subdirectory(SRC)
179+
add_subdirectory(EXAMPLE)
180+
add_subdirectory(FORTRAN)
178181

179182
if(enable_matlabmex)
180183
add_subdirectory(MATLAB)

EXAMPLE/CMakelists.txt

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
macro(add_exe _exename _sources)
2+
add_executable(${_exename} ${_sources})
3+
target_link_libraries(${_exename} superlu)
4+
install(TARGETS ${_exename}
5+
#In Cygwin, MSYS, and Win32 Mingw, the run-time .dll is placed in the bin directory, not lib.
6+
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
7+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
8+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
9+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
10+
)
11+
endmacro(add_exe)
12+
macro(add_exe2 _exename _sources1 _sources2)
13+
add_executable(${_exename} ${_sources1} ${_sources2})
14+
target_link_libraries(${_exename} superlu)
15+
install(TARGETS ${_exename}
16+
#In Cygwin, MSYS, and Win32 Mingw, the run-time .dll is placed in the bin directory, not lib.
17+
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
18+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
19+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
20+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
21+
)
22+
endmacro(add_exe2)
23+
24+
if(enable_single)
25+
add_exe(slinsol slinsol.c)
26+
add_exe(slinsol1 slinsol1.c)
27+
add_exe(slinsolx slinsolx.c)
28+
add_exe(slinsolx1 slinsolx1.c)
29+
add_exe(slinsolx2 slinsolx2.c)
30+
add_exe(slinsolx3 slinsolx3.c)
31+
add_exe2(sitersol sitersol.c sfgmr.c)
32+
add_exe2(sitersol1 sitersol1.c sfgmr.c)
33+
endif(enable_single)
34+
if(enable_double)
35+
add_exe(dlinsol dlinsol.c)
36+
add_exe(dlinsol1 dlinsol1.c)
37+
add_exe(dlinsolx dlinsolx.c)
38+
add_exe(dlinsolx1 dlinsolx1.c)
39+
add_exe(dlinsolx2 dlinsolx2.c)
40+
add_exe(dlinsolx3 dlinsolx3.c)
41+
add_exe2(superlu_exe superlu.c sp_ienv.c)
42+
set_target_properties(superlu_exe PROPERTIES OUTPUT_NAME "superlu")
43+
add_exe2( ditersol ditersol.c dfgmr.c)
44+
add_exe2( ditersol1 ditersol1.c dfgmr.c)
45+
endif(enable_double)
46+
if(enable_complex)
47+
add_exe(clinsol clinsol.c)
48+
add_exe(clinsol1 clinsol1.c)
49+
add_exe(clinsolx clinsolx.c)
50+
add_exe(clinsolx1 clinsolx1.c)
51+
add_exe(clinsolx2 clinsolx2.c)
52+
add_exe(clinsolx3 clinsolx3.c)
53+
add_exe2( citersol citersol.c cfgmr.c)
54+
add_exe2( citersol1 citersol1.c cfgmr.c)
55+
endif(enable_complex)
56+
if(enable_complex16)
57+
add_exe(zlinsol zlinsol.c)
58+
add_exe(zlinsol1 zlinsol1.c)
59+
add_exe(zlinsolx zlinsolx.c)
60+
add_exe(zlinsolx1 zlinsolx1.c)
61+
add_exe(zlinsolx2 zlinsolx2.c)
62+
add_exe(zlinsolx3 zlinsolx3.c)
63+
add_exe2(zitersol zitersol.c zfgmr.c)
64+
add_exe2(zitersol1 zitersol1.c zfgmr.c)
65+
endif(enable_complex16)
66+
67+
#single: slinsol slinsol1 slinsolx slinsolx1 slinsolx2 slinsolx3 \
68+
# sitersol sitersol1
69+
#double: dlinsol dlinsol1 dlinsolx dlinsolx1 dlinsolx2 dlinsolx3 \
70+
# superlu ditersol ditersol1
71+
#complex: clinsol clinsol1 clinsolx clinsolx1 clinsolx2 clinsolx3 \
72+
# citersol citersol1
73+
#complex16: zlinsol zlinsol1 zlinsolx zlinsolx1 zlinsolx2 zlinsolx3 \
74+
# zitersol zitersol1

EXAMPLE/cfgmr.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ For information on ITSOL contact [email protected]
3030
*/
3131

3232
#include "slu_cdefs.h"
33+
#include "slu_Cnames.h"
3334

3435
#define epsmac 1.0e-16
3536

3637
extern void cdotc_(complex *, int *, complex [], int *, complex [], int *);
3738
extern float scnrm2_(int *, complex [], int *);
38-
39+
extern int ccopy_(int *, complex *, int *, complex [], int *);
40+
extern void caxpy_(int *, complex *, complex [], int *, complex [], int *);
3941

4042
int cfgmr(int n,
4143
void (*cmatvec) (complex, complex[], complex, complex[]),

EXAMPLE/clinsolx.c

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ at the top-level directory.
1717
*
1818
*/
1919
#include "slu_cdefs.h"
20+
#include "slu_Cnames.h"
21+
22+
#ifdef __MINGW32__
23+
#include "getopt.h"
24+
#endif
2025

2126
int main(int argc, char *argv[])
2227
{

EXAMPLE/clinsolx1.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_cdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/clinsolx2.c

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ at the top-level directory.
1919
*
2020
*/
2121
#include "slu_cdefs.h"
22+
#include "slu_Cnames.h"
23+
24+
#ifdef __MINGW32__
25+
#include "getopt.h"
26+
#endif
2227

2328
int main(int argc, char *argv[])
2429
{

EXAMPLE/clinsolx3.c

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ at the top-level directory.
1919
*
2020
*/
2121
#include "slu_cdefs.h"
22+
#include "slu_Cnames.h"
23+
24+
#ifdef __MINGW32__
25+
#include "getopt.h"
26+
#endif
2227

2328
int main(int argc, char *argv[])
2429
{

EXAMPLE/dfgmr.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ For information on ITSOL contact [email protected]
3030
*/
3131

3232
#include "slu_ddefs.h"
33+
#include "slu_Cnames.h"
3334

3435
#define epsmac 1.0e-16
3536

3637
extern double ddot_(int *, double [], int *, double [], int *);
3738
extern double dnrm2_(int *, double [], int *);
38-
39+
extern void daxpy_(int *, double *, double [], int *, double [], int *);
40+
extern int dcopy_(int *, double *, int *, double *, int *);
3941

4042
int dfgmr(int n,
4143
void (*dmatvec) (double, double[], double, double[]),

EXAMPLE/dlinsolx.c

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ at the top-level directory.
1717
*
1818
*/
1919
#include "slu_ddefs.h"
20+
#include "slu_Cnames.h"
21+
22+
#ifdef __MINGW32__
23+
#include "getopt.h"
24+
#endif
2025

2126
int main(int argc, char *argv[])
2227
{

EXAMPLE/dlinsolx1.c

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ at the top-level directory.
1919
*
2020
*/
2121
#include "slu_ddefs.h"
22+
#include "slu_Cnames.h"
23+
24+
#ifdef __MINGW32__
25+
#include "getopt.h"
26+
#endif
2227

2328
int main(int argc, char *argv[])
2429
{

EXAMPLE/dlinsolx2.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_ddefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/dlinsolx3.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_ddefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/sfgmr.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ For information on ITSOL contact [email protected]
3030
*/
3131

3232
#include "slu_sdefs.h"
33+
#include "slu_Cnames.h"
3334

3435
#define epsmac 1.0e-16
3536

3637
extern float sdot_(int *, float [], int *, float [], int *);
3738
extern float snrm2_(int *, float [], int *);
38-
39+
extern int scopy_(int *, float *, int *, float *, int *);
40+
extern void saxpy_(int *, float *, float [], int *, float [], int *);
3941

4042
int sfgmr(int n,
4143
void (*smatvec) (float, float[], float, float[]),

EXAMPLE/slinsolx.c

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ at the top-level directory.
1818
*/
1919
#include "slu_sdefs.h"
2020

21+
#ifdef __MINGW32__
22+
#include "getopt.h"
23+
#endif
24+
2125
int main(int argc, char *argv[])
2226
{
2327
char equed[1];

EXAMPLE/slinsolx1.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_sdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/slinsolx2.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_sdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/slinsolx3.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_sdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/sp_ienv.c

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ at the top-level directory.
2525
*/
2626
#include "slu_Cnames.h"
2727

28+
extern int input_error(char *, int *);
29+
2830
/*! \brief
2931
3032
<pre>

EXAMPLE/superlu.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ at the top-level directory.
2020
*/
2121
#include "slu_ddefs.h"
2222

23-
main(int argc, char *argv[])
23+
int main(int argc, char *argv[])
2424
{
2525
/*
2626
* Purpose

EXAMPLE/zfgmr.c

+3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ For information on ITSOL contact [email protected]
3030
*/
3131

3232
#include "slu_zdefs.h"
33+
#include "slu_Cnames.h"
3334

3435
#define epsmac 1.0e-16
3536

3637
extern void zdotc_(doublecomplex *, int *, doublecomplex [], int *, doublecomplex [], int *);
3738
extern double dznrm2_(int *, doublecomplex [], int *);
39+
extern void zcopy_(int *, doublecomplex [], int *, doublecomplex [], int *);
40+
extern void zaxpy_(int *, doublecomplex *, doublecomplex [], int *, doublecomplex [], int *);
3841

3942

4043
int zfgmr(int n,

EXAMPLE/zlinsolx.c

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ at the top-level directory.
1717
*
1818
*/
1919
#include "slu_zdefs.h"
20+
#include "slu_Cnames.h"
21+
22+
#ifdef __MINGW32__
23+
#include "getopt.h"
24+
#endif
2025

2126
int main(int argc, char *argv[])
2227
{

EXAMPLE/zlinsolx1.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_zdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

EXAMPLE/zlinsolx2.c

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ at the top-level directory.
1919
*
2020
*/
2121
#include "slu_zdefs.h"
22+
#include "slu_Cnames.h"
23+
24+
#ifdef __MINGW32__
25+
#include "getopt.h"
26+
#endif
2227

2328
int main(int argc, char *argv[])
2429
{

EXAMPLE/zlinsolx3.c

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ at the top-level directory.
2020
*/
2121
#include "slu_zdefs.h"
2222

23+
#ifdef __MINGW32__
24+
#include "getopt.h"
25+
#endif
26+
2327
int main(int argc, char *argv[])
2428
{
2529
/*

FORTRAN/CMakelists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
macro(add_exe3 _exename _sources _sources2 _sources3)
2+
add_executable(${_exename} ${_sources} ${_sources2} ${_sources3})
3+
target_link_libraries(${_exename} superlu)
4+
install(TARGETS ${_exename}
5+
#In Cygwin, MSYS, and Win32 Mingw, the run-time .dll is placed in the bin directory, not lib.
6+
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
7+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
8+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
9+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
10+
)
11+
endmacro(add_exe3)
12+
13+
add_exe3(df77exm f77_main.f hbcode1.f c_fortran_dgssv.c)
14+
add_exe3(test_omp test_omp.f hbcode1.f c_fortran_dgssv.c)
15+
add_exe3(zf77exm z_f77_main.f zhbcode1.f c_fortran_zgssv.c)
16+

0 commit comments

Comments
 (0)