-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_targets.cmake
166 lines (130 loc) · 5.07 KB
/
install_targets.cmake
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Configure the install to be in a specific folder the binary and the libs that is not
# the /usr/bin for now
# check the default destination folder
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(WIN32)
set(USER_HOME_DIR "C:/alias/")
else(WIN32)
set(USER_HOME_DIR $ENV{HOME})
endif(WIN32)
if(NOT USER_HOME_DIR)
message(FATAL_ERROR "We couldn't find the home folder where we want to install the app")
else()
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIR}/alias" CACHE PATH "..." FORCE)
endif()
endif()
message(STATUS "We will install the app in ${CMAKE_INSTALL_PREFIX}")
# avoid pointing to local link folder
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}" isSystemDir)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
set(DEST_INSTALL_BIN_PATH ${CMAKE_INSTALL_PREFIX})
# set the install targets for all the project libs
# TODO: we can iterate on the global variable of all targets here instead?
set(INSTALL_TARGETS_LIBS_LIST
toolbox
encryption
data
actions
protos
storage
service
)
if (UNIX)
set(INSTALL_TARGETS_LIBS_LIST ${INSTALL_TARGETS_LIBS_LIST} uuid)
endif(UNIX)
# libraries
install(TARGETS ${INSTALL_TARGETS_LIBS_LIST} DESTINATION / COMPONENT libraries)
# applicationes
install(TARGETS qt_client DESTINATION / COMPONENT applications)
# TODO: add the post install target to copy the third party libs (all the deps folder
# into the destination folder?
# install(CODE "cp -rf ${ALIAS_DEP_ROOT}/lib/*.so /")
if(WIN32)
##
## Windows installations
##
# check the env vars are set
set(MINGW64_ROOT $ENV{MINGW64_ROOT})
set(QT_MINGW_ROOT $ENV{QT_MINGW_ROOT})
assert_def_exists(MINGW64_ROOT)
assert_def_exists(QT_MINGW_ROOT)
function(copy_libs ROOT_FOLDER LIB_NAMES)
set(full_list_files "")
foreach(the_lib IN LISTS ${LIB_NAMES})
set(full_lib_path "${ROOT_FOLDER}/${the_lib}.dll")
set(full_list_files ${full_list_files} ${full_lib_path})
endforeach()
install(FILES ${full_list_files} DESTINATION / COMPONENT libraries)
endfunction()
# we need to copy all the dependencies libs from the bin folder
install(DIRECTORY ${ALIAS_DEP_ROOT}/bin/ DESTINATION /
COMPONENT libraries FILES_MATCHING PATTERN "*.dll" )
# we need to install qt dependencies
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(QT_DEP_LIBS Qt5Cored Qt5Guid Qt5Widgetsd)
else()
set(QT_DEP_LIBS Qt5Core Qt5Gui Qt5Widgets)
endif()
copy_libs("${QT_MINGW_ROOT}/bin" QT_DEP_LIBS)
# copy the platforms lib as well
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
install(FILES ${QT_MINGW_ROOT}/plugins/platforms/qwindowsd.dll DESTINATION platforms COMPONENT libraries)
else()
install(FILES ${QT_MINGW_ROOT}/plugins/platforms/qwindows.dll DESTINATION platforms COMPONENT libraries)
endif()
# We need to copy the mingw c++ related libs
set(MINGW_DEP_LIBS libgcc_s_seh-1 libstdc++-6 libwinpthread-1)
copy_libs("${MINGW64_ROOT}/bin" MINGW_DEP_LIBS)
else(WIN32)
install(DIRECTORY ${ALIAS_DEP_ROOT}/lib/ DESTINATION /
COMPONENT libraries FILES_MATCHING PATTERN "*.so*")
endif(WIN32)
# Install the folder where we will install the configuration data
if(WIN32)
set(DEST_INSTALL_DATA_PATH "C:/Users/$ENV{USERNAME}/alias")
else(WIN32)
set(DEST_INSTALL_DATA_PATH $ENV{HOME}/alias)
endif(WIN32)
# install the config file
install(FILES "${ROOT_PROJECT_DIR}/resources/config/init.json" DESTINATION / COMPONENT libraries)
##
## CPACK macros below here
##
set (CPACK_PACKAGE_NAME "alias")
set (CPACK_PACKAGE_VENDOR "agudpp")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "the tagging content tool")
set (CPACK_PACKAGE_VERSION "0.0.1")
set (CPACK_PACKAGE_VERSION_MAJOR "0")
set (CPACK_PACKAGE_VERSION_MINOR "0")
set (CPACK_PACKAGE_VERSION_PATCH "1")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "alias")
# Define components and their display names
set (CPACK_COMPONENTS_ALL applications libraries)
set (CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Alias app")
set (CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Required libraries")
#set (CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
# Human readable component descriptions
set (CPACK_COMPONENT_APPLICATIONS_DESCRIPTION
"Alias qt client app")
set (CPACK_COMPONENT_LIBRARIES_DESCRIPTION
"Required libraries to run qt client app")
#set (CPACK_COMPONENT_HEADERS_DESCRIPTION
# "C/C++ header files for use with MyLib")
# Define dependencies between components
set (CPACK_COMPONENT_APPLICATIONS_DEPENDS libraries)
# Define groups
set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
set(CPACK_COMPONENT_LIBRARIES_GROUP "Runtime")
#set(CPACK_COMPONENT_HEADERS_GROUP "Development")
set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
"All of the tools you'll ever need to develop software")
# Define NSIS installation types
set(CPACK_ALL_INSTALL_TYPES Full)
set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Full)
#set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
# Must be after the last CPACK macros
include(CPack)