forked from adam-stokes/deprecated-matahari-bm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (83 loc) · 4.29 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
cmake_minimum_required(VERSION 2.6)
project (MATAHARI)
set(CMAKE_VERBOSE_MAKEFILE OFF)
file(STRINGS ".version" PROJECT_VERSION)
string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION}")
string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\2" CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION}")
string(REGEX REPLACE "^([^.]+)[.]([^.]+)[.]([^.]+)$" "\\3" CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION}")
MACRO (inherit_value theSymbol theValue)
if (NOT DEFINED ${theSymbol})
set (${theSymbol} ${theValue})
# message ("Set symbol '${theSymbol}' to value '${theValue}'")
set (${theSymbol}_inherited = "true")
endif (NOT DEFINED ${theSymbol})
ENDMACRO (inherit_value)
# Various defines
inherit_value(MATAHARI_PORT "49000")
inherit_value(MATAHARI_BROKER "127.0.0.1")
inherit_value(SUPPORT_TRACING 0)
# Build Paths
inherit_value(MINGW_ROOT "/usr/i686-pc-mingw32/sys-root/mingw")
inherit_value(PCRE_PATH "D:/Users/mcpierce/Programming/pcre-7.0")
inherit_value(QPID_PATH "C:/Program Files/Apache/qpid-0.6")
# Build Prefixes
inherit_value(localstatedir "/var")
inherit_value(sysconfdir "${SYSCONF_INSTALL_DIR}")
inherit_value(initdir "${SYSCONF_INSTALL_DIR}/init.d")
inherit_value(systemdunitdir "/lib/systemd/system")
# Add sub-directories
add_subdirectory(src)
# Installer
set(CPACK_PACKAGE_NAME "matahari")
set(CPACK_PACKAGE_VENDOR "Red Hat")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Matahari QMF Agent")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "matahari-${CPACK_PACKAGE_VERSION}")
if(WIN32)
set (CPACK_GENERATOR "NSIS")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set (CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-icon.ico")
set (CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-icon.ico")
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-install-banner.bmp")
set (CPACK_NSIS_URL_INFO_ABOUT "http://matahariproject.org")
# Needs this to correctly set up Start menu links later.
set (CPACK_PACKAGE_EXECUTABLES "")
# Cant supply arguments within quotes, use batch files to support --port etc
set (CPACK_NSIS_MENU_LINKS "")
# The comments and spacing are apparnetly critical to all this working, don't ask me why
set( CPACK_NSIS_EXTRA_INSTALL_COMMANDS "\\n")
set( CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
" Some comment\\n ReadRegStr $1 HKLM SYSTEM\\\\CurrentControlSet\\\\services\\\\Matahari Broker\\n"
" Some comment\\n DetailPrint \\\"Current broker is: $1\\\"\\n"
" Some comment\\n StrCmp $1 \\\"\\\" 0 +2\\n"
" Some comment\\n WriteRegStr HKLM SYSTEM\\\\CurrentControlSet\\\\services\\\\Matahari Broker 127.0.0.1\\n"
" Some comment\\n ExecWait \\\"$INSTDIR\\\\sbin\\\\install.bat\\\"\\n"
" Some comment\\n Sleep 100\\n"
)
# The comments and spacing are apparnetly critical to all this working, don't ask me why
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "\\n")
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
" Some comment\\n DetailPrint \\\"Stopping Matahari services\\\"\\n"
" Some comment\\n ExecWait \\\"$INSTDIR\\\\sbin\\\\uninstall.bat\\\"\\n"
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/windows/autorun.inf.in
${CMAKE_CURRENT_BINARY_DIR}/src/windows/autorun.inf)
# Assume all installed DLLs are needed by matahari/qpid.
# Determining a detailed list here is unnecessary. Package builds are done
# in a dedicate chroot, so the only DLLs present will be the ones that were
# installed as dependencies.
file(GLOB_RECURSE DLL_LIST ${MINGW_ROOT}/*/*.dll)
install(FILES ${DLL_LIST} DESTINATION sbin)
file(GLOB_RECURSE GSPAWN_HELPERS ${MINGW_ROOT}/*/gspawn-win32-helper*.exe)
install(FILES ${GSPAWN_HELPERS} DESTINATION sbin)
# Util for creating services
file(GLOB_RECURSE SRVANY_EXE ${MINGW_ROOT}/*/srvany.exe)
install(FILES ${SRVANY_EXE} DESTINATION sbin)
install(FILES src/windows/install.bat DESTINATION sbin)
install(FILES src/windows/uninstall.bat DESTINATION sbin)
else(WIN32)
set (CPACK_GENERATOR "TGZ")
add_subdirectory(sys)
endif(WIN32)
INCLUDE(InstallRequiredSystemLibraries)
INCLUDE(CPack)