WSL/SLF GitLab Repository

CMakeLists.txt 3.55 KB
Newer Older
1
2
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")

3
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/dataClasses/CMakeLists.txt")
4
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/plugins/CMakeLists.txt")
5
6
7
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteoLaws/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteoStats/CMakeLists.txt")
INCLUDE("${PROJECT_SOURCE_DIR}/meteoio/meteoFilters/CMakeLists.txt")
8

9
IF(PROJ4)
10
11
12
	FIND_PATH(LIBPROJ_INCLUDE_DIR "proj_api.h")
	FIND_LIBRARY(LIBPROJ proj)
	INCLUDE_DIRECTORIES(${LIBPROJ_INCLUDE_DIR})
13
14
15
16
17
	IF(MSVC)
		ADD_DEFINITIONS(/DPROJ4) #it looks like some VC++ versions don't support -D syntax
	ELSE(MSVC)
		ADD_DEFINITIONS(-DPROJ4)
	ENDIF(MSVC)
18
19
ENDIF(PROJ4)

20
21
22
23
24
25
26
27
IF(DATA_QA)
	IF(MSVC)
		ADD_DEFINITIONS(/DDATA_QA) #it looks like some VC++ versions don't support -D syntax
	ELSE(MSVC)
		ADD_DEFINITIONS(-DDATA_QA)
	ENDIF(MSVC)
ENDIF(DATA_QA)

28
SET(meteoio_sources
29
	${dataClasses_sources}
30
	IOManager.cc
31
32
	MeteoProcessor.cc
	ResamplingAlgorithms.cc
33
	ResamplingAlgorithms2D.cc
34
	Meteo1DInterpolator.cc
35
	InterpolationAlgorithms.cc
36
37
	DataGenerator.cc
	GeneratorAlgorithms.cc
38
39
	Timer.cc
	IOHandler.cc
40
	Graphics.cc
41
42
43
44
45
	Meteo2DInterpolator.cc
	BufferedIOHandler.cc
	IOInterface.cc
	Config.cc
	IOExceptions.cc
46
	IOUtils.cc
47
	FileUtils.cc
48
	plugins/libsmet.cc
49
	${plugins_sources}
50
51
52
	${meteoLaws_sources}
	${meteoStats_sources}
	${meteoFilters_sources}
53
)
Mathias Bavay's avatar
Mathias Bavay committed
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
IF(GUI_EXCEPTIONS)
	IF(MSVC)
		ADD_DEFINITIONS(/DMSG_BOX)
	ELSE(MSVC)
		ADD_DEFINITIONS(-DMSG_BOX)
	ENDIF(MSVC)
	IF(UNIX AND NOT APPLE AND NOT CYGWIN)
		FIND_PACKAGE(X11)
		IF(X11_FOUND)
			INCLUDE_DIRECTORIES(SYSTEM ${X11_INCLUDE_DIR})
			SET(GUI_LIBS ${X11_LIBRARIES})
			LIST(APPEND meteoio_sources MessageBoxX11.cc)
		ELSE(X11_FOUND)
			SET(GUI_EXCEPTIONS) #unsets the variable
		ENDIF(X11_FOUND)
	ENDIF(UNIX AND NOT APPLE AND NOT CYGWIN)
ENDIF(GUI_EXCEPTIONS)
72

73
74
#shared library.
IF(BUILD_SHARED_LIBS)
Mathias Bavay's avatar
Mathias Bavay committed
75
	SET(SHAREDNAME ${PROJECT_NAME})
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	ADD_LIBRARY(${SHAREDNAME} ${meteoio_sources})
	TARGET_LINK_LIBRARIES(${SHAREDNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES} ${EXTRA_LINK_FLAGS} ${GUI_LIBS})
	SET_TARGET_PROPERTIES(${SHAREDNAME} PROPERTIES
		PREFIX "${LIBPREFIX}"
		LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		CLEAN_DIRECT_OUTPUT 1
		VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
		SOVERSION "${VERSION_MAJOR}"
	)
	INSTALL(TARGETS ${SHAREDNAME}
		RUNTIME DESTINATION lib
		LIBRARY DESTINATION lib
		ARCHIVE DESTINATION lib
		COMPONENT libraries
	)
ENDIF(BUILD_SHARED_LIBS)

#static library. Please keep in mind that for Windows, a dll is a runtime
96
97
IF(BUILD_STATIC_LIBS)
	SET(STATICNAME ${PROJECT_NAME}_STATIC)
Mathias Bavay's avatar
Mathias Bavay committed
98
	SET(STATICLIBNAME ${PROJECT_NAME})
99
	ADD_LIBRARY(${STATICNAME} STATIC ${meteoio_sources})
100
	TARGET_LINK_LIBRARIES(${STATICNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES} ${EXTRA_LINK_FLAGS} ${GUI_LIBS})
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	SET_TARGET_PROPERTIES(${STATICNAME} PROPERTIES
		PREFIX "${LIBPREFIX}"
		LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
		CLEAN_DIRECT_OUTPUT 1
		OUTPUT_NAME ${STATICLIBNAME}
	)
	INSTALL(TARGETS ${STATICNAME}
		RUNTIME DESTINATION lib
		LIBRARY DESTINATION lib
		ARCHIVE DESTINATION lib
		COMPONENT libraries
	)
ENDIF(BUILD_STATIC_LIBS)
116
117
118

IF(WIN32) #handle the special case of WIN32 needing import libraries
	FILE(GLOB_RECURSE importlibs "lib/libmeteo*.lib")
119
120
	FILE(GLOB_RECURSE dlls "lib/libmeteo*.dll") #bug: otherwise, dlls are missing
	INSTALL(FILES ${dlls} ${importlibs} DESTINATION lib COMPONENT libraries)
121
ENDIF(WIN32)