forked from mbheinen/bpa-ipf-tsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
109 lines (96 loc) · 3.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
PROJECT(bpa-ipf-tsp Fortran C)
# Set bpa-ipf-foo version
SET(VERSION 0.0.2)
# Add local modlues to the module path
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")
INCLUDE(${CMAKE_MODULE_PATH}/SetFortranFlags.cmake)
# There is an error in CMAKE with this flag for pgf90. Unset it
GET_FILENAME_COMPONENT(FCNAME ${CMAKE_Fortran_COMPILER} NAME)
IF(FCNAME STREQUAL "pgf90")
UNSET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
ENDIF(FCNAME STREQUAL "pgf90")
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD AND NOT DRAGONFLY)
# When invoking cmake on distributions on which gcc's binaries are prefixed
# with an arch-specific triplet, the user must specify -DCHOST=<prefix>
if (DEFINED CHOST)
set(CMAKE_AR "${CHOST}-gcc-ar")
set(CMAKE_RANLIB "${CHOST}-gcc-ranlib")
else()
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
endif()
ENDIF()
#set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
# Define libraries
SET(IPFLIB ipf)
SET(IPCLIB ipc)
SET(TSPLIB libtsp)
SET(CFLOWLIB cflow)
SET(IPFGUILIB ipfgui)
# Define executables
SET(BPFEXE bpf)
SET(IPFBATEXE ipfbat)
SET(IPFREPORTSEXE ipf_reports)
SET(IPFTESTEXE ipf_test)
SET(IPFPLOTEXE ipfplot)
SET(IPFSRVEXE ipfsrv)
SET(GUIEXE gui)
SET(FINDOUTEXE findout)
SET(MIMICEXE mimic)
SET(PVCURVEEXE pvcurve)
SET(POSTPVCURVEEXE post_pvcurve)
SET(QVCURVEEXE qvcurve)
SET(LINEFLOWEXE lineflow)
SET(GPFEXE gpf)
SET(PUFEXE puf)
SET(NETDATEXE netdat)
SET(IPFCUTEXE ipfcut)
SET(TSPEXE tsp)
# Define some directories
SET(SRC ${CMAKE_SOURCE_DIR})
SET(LIB ${CMAKE_SOURCE_DIR}/lib)
SET(BIN ${CMAKE_SOURCE_DIR}/bin)
SET(SRCIPF ${SRC}/ipf)
SET(SRCIPC ${SRC}/ipc)
SET(SRCGUI ${SRC}/gui)
SET(SRCLIBTSP ${SRC}/libtsp)
SET(SRCLIBCFLOW ${SRC}/cflow)
SET(SRCLIBGUI ${SRC}/libgui)
SET(SRCBPF ${SRC}/bpf)
SET(SRCIPFBAT ${SRC}/ipfbat)
SET(SRCIPFREPORTS ${SRC}/ipf_reports)
SET(SRCIPFSRV ${SRC}/ipfsrv)
SET(SRCIPFTEST ${SRC}/ipf_test)
SET(SRCIPFPLOT ${SRC}/ipfplot)
SET(SRCGPF ${SRC}/gpf)
SET(SRCGUI ${SRC}/gui)
SET(SRCPUF ${SRC}/puf)
SET(SRCNETDAT ${SRC}/netdat)
SET(SRCIPFCUT ${SRC}/ipfcut)
SET(SRCTSP ${SRC}/tsp)
# Put .mod files in the lib folder
SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB})
# The source for the libraries put in the lib folder
ADD_SUBDIRECTORY(${SRCIPF} ${LIB}/ipf)
ADD_SUBDIRECTORY(${SRCIPC} ${LIB}/ipc)
ADD_SUBDIRECTORY(${SRCLIBTSP} ${LIB}/libtsp)
ADD_SUBDIRECTORY(${SRCLIBGUI} ${LIB}/libgui)
ADD_SUBDIRECTORY(${SRCLIBCFLOW} ${LIB}/cflow)
# The source for the executables put in the bin folder
ADD_SUBDIRECTORY(${SRCBPF} ${BIN})
ADD_SUBDIRECTORY(${SRCIPFBAT})
ADD_SUBDIRECTORY(${SRCIPFREPORTS})
ADD_SUBDIRECTORY(${SRCIPFSRV})
ADD_SUBDIRECTORY(${SRCGUI})
ADD_SUBDIRECTORY(${SRCIPFTEST})
ADD_SUBDIRECTORY(${SRCIPFPLOT})
#ADD_SUBDIRECTORY(${SRCGPF})
ADD_SUBDIRECTORY(${SRCPUF})
#ADD_SUBDIRECTORY(${SRCNETDAT})
#ADD_SUBDIRECTORY(${SRCIPFCUT})
ADD_SUBDIRECTORY(${SRCTSP})