source: pacpusframework/trunk/cmake/PacpusDependencies.cmake@ 374

Last change on this file since 374 was 323, checked in by Marek Kurdej, 10 years ago

Add auto-finding WINSDK_LIB.

  • Property svn:executable set to *
File size: 5.7 KB
RevLine 
[89]1#################################################
2# ___________ ____ ______ __ __ _____ #
3# \____ \__ \ _/ ___\\____ \| | \/ ___/ #
4# | |_> > __ \\ \___| |_> > | /\___ \ #
5# | __(____ /\___ > __/|____//____ > #
6# |__| \/ \/|__| \/ #
7# #
8#################################################
9
[187]10################################################################################
11# OUTPUT
[89]12set(PACPUS_DEPENDENCIES_INC "")
13set(PACPUS_DEPENDENCIES_LIB "")
14
[187]15################################################################################
16# Necessary for Qt5
17# message(STATUS "Set CMake variable 'CMAKE_PREFIX_PATH' to the path like '%QT_BIN%/../lib/cmake'")
18set(QT_CMAKE_DIR "$ENV{QT_BIN}/../lib/cmake")
19get_filename_component(QT_CMAKE_DIR "${QT_CMAKE_DIR}" ABSOLUTE)
[322]20message(STATUS "\${QT_CMAKE_DIR} = '${QT_CMAKE_DIR}'")
[187]21list(APPEND CMAKE_PREFIX_PATH
22 ${QT_CMAKE_DIR}
23)
24if(WIN32)
[323]25 find_library(GLU32_LIB_PATH
26 NAMES glu32
27 HINTS
28 "${WINSDK_LIB}"
29 "$ENV{WINSDK_LIB}"
30 # 8.1
31 "C:/Program Files/Windows Kits/8.1/Lib/winv6.3/um/x86"
32 "C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x86"
33 "C:/Program Files/Windows Kits/8.1/Lib/winv6.3/um/x64"
34 "C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64"
35 # 8.0
36 "C:/Program Files/Windows Kits/8.0/Lib/win8/um/x86"
37 "C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86"
38 "C:/Program Files/Windows Kits/8.0/Lib/win8/um/x64"
39 "C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64"
40 )
41 get_filename_component(GLU32_LIB_DIR "${GLU32_LIB_PATH}" DIRECTORY)
42 set(WINSDK_LIB "${GLU32_LIB_DIR}" CACHE PATH "Directory of Windows Development Kit, should contain glu32.lib.")
[267]43 if("${WINSDK_LIB}" STREQUAL "")
[322]44 message(STATUS "Environment variable 'WINSDK_LIB' should be set to the path containing glu32 library, e.g. 'C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86'")
45 else()
[267]46 message(STATUS "\$ENV{WINSDK_LIB} = '$ENV{WINSDK_LIB}'")
47 message(STATUS "\${WINSDK_LIB} = '${WINSDK_LIB}'")
48 endif()
[187]49 list(APPEND CMAKE_PREFIX_PATH
[226]50 ${WINSDK_LIB}
[187]51 )
[119]52endif()
[226]53if(DEBUG)
[267]54 message(STATUS "\${CMAKE_PREFIX_PATH} = '${CMAKE_PREFIX_PATH}'")
[226]55endif()
[119]56
[187]57################################################################################
58# Find Qt
59find_package(Qt5Widgets QUIET)
60if(Qt5Widgets_FOUND)
61 # Tell CMake to run moc when necessary:
62 #set(CMAKE_AUTOMOC ON)
63 # As moc files are generated in the binary dir, tell CMake
64 # to always look for includes there:
65 set(CMAKE_INCLUDE_CURRENT_DIR ON)
66
67 find_package(Qt5Core REQUIRED)
68 find_package(Qt5Xml REQUIRED)
69 find_package(Qt5Gui REQUIRED)
[234]70 #find_package(Qt5OpenGL REQUIRED)
71 #find_package(Qt5Network REQUIRED)
72 #find_package(Qt5SerialPort REQUIRED)
[187]73
74 set(QT_DEFINITIONS
75 ${Qt5Widgets_DEFINITIONS}
76 ${Qt5Core_DEFINITIONS}
77 ${Qt5Xml_DEFINITIONS}
78 ${Qt5Gui_DEFINITIONS}
79 ${Qt5OpenGL_DEFINITIONS}
80 ${Qt5Network_DEFINITIONS}
81 ${Qt5SerialPort_DEFINITIONS}
[175]82 )
[187]83 set(QT_INCLUDE_DIR
84 ${Qt5Widgets_INCLUDE_DIRS}
85 ${Qt5Core_INCLUDE_DIRS}
86 ${Qt5Xml_INCLUDE_DIRS}
87 ${Qt5Gui_INCLUDE_DIRS}
88 ${Qt5OpenGL_INCLUDE_DIRS}
89 ${Qt5Network_INCLUDE_DIRS}
90 ${Qt5SerialPort_INCLUDE_DIRS}
91 )
92 set(QT_LIBRARIES
93 ${Qt5Widgets_LIBRARIES}
94 ${Qt5Core_LIBRARIES}
95 ${Qt5Xml_LIBRARIES}
96 ${Qt5Gui_LIBRARIES}
97 ${Qt5OpenGL_LIBRARIES}
98 ${Qt5Network_LIBRARIES}
99 ${Qt5SerialPort_LIBRARIES}
100 )
101
102 if(Qt5_POSITION_INDEPENDENT_CODE)
103 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
[175]104 endif()
[187]105else()
106 message(STATUS "Qt5 not found: try to find Qt4")
107
[214]108 find_package(Qt4 REQUIRED QtCore QtGui QtXml)
109 include(${QT_USE_FILE})
[187]110endif()
111
112################################################################################
[127]113# All the Pacpus modules depend on Qt5
[89]114# However, since each module requires specific Qt's modules, they have to include their own QT_USE_FILE
115
[187]116################################################################################
117# Boost
[239]118set(Boost_USE_STATIC_LIBS OFF)
119set(Boost_USE_MULTITHREADED ON)
120set(Boost_USE_STATIC_RUNTIME OFF)
[187]121list(APPEND PACPUS_DEFINITIONS " -DBOOST_ALL_DYN_LINK ")
[285]122if(CMAKE_COMPILER_IS_GNUC)
123 list(APPEND PACPUS_DEFINITIONS " -lpthread ")
124endif()
[239]125find_package(Boost 1.54.0
[187]126 COMPONENTS
[285]127 chrono # thread
128 date_time # thread
[239]129 program_options #1.32.0
[285]130 system # log, thread needed on Linux
131 thread
[89]132)
[187]133if(Boost_FOUND)
134 include_directories(${Boost_INCLUDE_DIRS})
135 link_directories(${Boost_LIBRARY_DIRS})
136 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
137 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]138endif()
[301]139
[89]140if(PACPUS_USE_LOG)
[141]141 find_package(Boost 1.54.0 REQUIRED
142 COMPONENTS
[239]143 #filesystem
144 log # 1.54.0
[285]145 log_setup # log
[141]146 )
147 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
148 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
[89]149endif()
[301]150if(PACPUS_BUILD_TESTS)
151 find_package(Boost 1.21.0 REQUIRED
152 COMPONENTS
153 unit_test_framework
154 )
155 list(APPEND PACPUS_DEPENDENCIES_INC ${Boost_INCLUDE_DIRS})
156 list(APPEND PACPUS_DEPENDENCIES_LIB ${Boost_LIBRARIES})
157endif()
[89]158
[187]159################################################################################
160# DOCUMENTATION
[89]161if(PACPUS_BUILD_DOC)
162 find_package(Doxygen)
163 if(NOT DOXYGEN_FOUND)
164 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")
165 endif()
166endif()
Note: See TracBrowser for help on using the repository browser.