-
Notifications
You must be signed in to change notification settings - Fork 20
/
CMakeLists.txt
259 lines (226 loc) · 10.9 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
cmake_minimum_required(VERSION 3.23.0)
set(VCPKG_FILES_DIR "${CMAKE_BINARY_DIR}" CACHE STRING "Folder for vcpkg download, build and installed files")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(VCPKG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg)
set(VCPKG_INSTALLED_DIR "${VCPKG_FILES_DIR}/vcpkg_installed")
set(VCPKG_INSTALL_OPTIONS "--downloads-root=${VCPKG_FILES_DIR}/vcpkg_downloads;--x-buildtrees-root=${VCPKG_FILES_DIR}/vcpkg_buildtrees;--x-packages-root=${VCPKG_FILES_DIR}/vcpkg_packages")
PROJECT(ECLIDE)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# General Options ---
option(EMBED_64BIT_CLIENTTOOLS "Embed 64bit client tools (OFF=32bit)" ON)
# Build tag generation ---
INCLUDE("${PROJECT_SOURCE_DIR}/version.cmake")
# Install Targets ---
SET (EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Location of BIN files")
SET (LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Location of LIB files")
# Third Party Libraries ---
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
FIND_PACKAGE(Boost REQUIRED COMPONENTS date_time filesystem program_options serialization signals thread)
FIND_PATH(WTL_INCLUDE_DIR wtl/atlapp.h)
FIND_PATH(VCPKG_ROOT_DIR include/wtl/atlapp.h)
SET(GSOAP_DIR ${VCPKG_ROOT_DIR}/share/gsoap)
FIND_PATH(SCINTILLA_INCLUDE_DIR Platform.h HINTS ${VCPKG_ROOT_DIR}/include/scintilla/include)
FIND_PATH(SCINTILLA_SOURCE_DIR AutoComplete.cxx HINTS ${VCPKG_ROOT_DIR}/share/scintilla/src)
FIND_PATH(SCINTILLA_LEXLIB_DIR Accessor.cxx HINTS ${VCPKG_ROOT_DIR}/share/scintilla/LexLib)
FIND_PATH(SCINTILLA_WIN32_DIR PlatWin.cxx HINTS ${VCPKG_ROOT_DIR}/share/scintilla/Win32)
FIND_PATH(BUGTRAP_DIR BugTrap.h HINTS ${VCPKG_ROOT_DIR}/share/bugtrap/source/Client)
FIND_PATH(BUGTRAP_ZLIB_DIR zlib.def HINTS ${VCPKG_ROOT_DIR}/share/bugtrap/source/zlib)
MESSAGE("includes")
MESSAGE(" - boost: ${Boost_INCLUDE_DIRS}")
MESSAGE(" - wtl: ${WTL_INCLUDE_DIR}")
MESSAGE(" - Scintilla: ${SCINTILLA_INCLUDE_DIR}")
MESSAGE("sources")
MESSAGE(" - Scintilla")
MESSAGE(" - src: ${SCINTILLA_SOURCE_DIR}")
MESSAGE(" - LexLib: ${SCINTILLA_LEXLIB_DIR}")
MESSAGE(" - Win32: ${SCINTILLA_WIN32_DIR}")
MESSAGE(" - gsoap")
MESSAGE(" - dir: ${GSOAP_DIR}")
MESSAGE(" - bugtrap")
MESSAGE(" - src: ${BUGTRAP_DIR}")
MESSAGE(" - zlib: ${BUGTRAP_ZLIB_DIR}")
# Compiler Flags ---
ADD_DEFINITIONS(-DBOOST_SIGNALS_NO_DEPRECATION_WARNING -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -DUNICODE -D_UNICODE)
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(PrecompiledBinary "$(IntDir)/${PrecompiledBasename}.pch")
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
OBJECT_OUTPUTS "${PrecompiledBinary}"
)
SET_SOURCE_FILES_PROPERTIES(${Sources}
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
OBJECT_DEPENDS "${PrecompiledBinary}"
)
# Add precompiled header to SourcesVar
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
LIST(APPEND ${SourcesVar} ${PrecompiledHeader})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FI\"${PrecompiledHeader}\"")
ENDIF(MSVC)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
# Projects ---
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
ADD_SUBDIRECTORY (BugTrap)
SET_PROPERTY(TARGET BUGTRAP PROPERTY FOLDER "3rdParty")
ADD_SUBDIRECTORY (en_us)
ADD_SUBDIRECTORY (clib)
ADD_SUBDIRECTORY (EclLib)
ADD_SUBDIRECTORY (sgrid)
ADD_SUBDIRECTORY (EclEditor)
ADD_SUBDIRECTORY (comms)
ADD_SUBDIRECTORY (wlib)
ADD_SUBDIRECTORY (eclide)
ADD_SUBDIRECTORY (amt)
# Documents ---
IF(EXISTS "${PROJECT_SOURCE_DIR}/docs/ECLReference.chm")
INSTALL (PROGRAMS ${PROJECT_SOURCE_DIR}/docs/ECLReference.chm DESTINATION bin)
ELSE ()
MESSAGE("Skipping ${PROJECT_SOURCE_DIR}/docs/ECLReference.chm (file does not exist)")
ENDIF ()
IF(EXISTS "${PROJECT_SOURCE_DIR}/docs/ECLReference_PT_BR.chm")
INSTALL (PROGRAMS ${PROJECT_SOURCE_DIR}/docs/ECLReference_PT_BR.chm DESTINATION bin)
ELSE ()
MESSAGE("Skipping ${PROJECT_SOURCE_DIR}/docs/ECLReference_PT_BR.chm (file does not exist)")
ENDIF ()
SET(DOC_FILES
${PROJECT_SOURCE_DIR}/docs/LangColorDUD.xml
${PROJECT_SOURCE_DIR}/docs/LangColorECL.xml
${PROJECT_SOURCE_DIR}/docs/LangColorESDL.xml
${PROJECT_SOURCE_DIR}/docs/LangColorKEL.xml
${PROJECT_SOURCE_DIR}/docs/LangColorSalt.xml
${PROJECT_SOURCE_DIR}/docs/LanguageColor.xml
${PROJECT_SOURCE_DIR}/docs/LanguageReference.xml
${PROJECT_SOURCE_DIR}/docs/LanguageRefDUD.xml
${PROJECT_SOURCE_DIR}/docs/LanguageRefECL.xml
${PROJECT_SOURCE_DIR}/docs/LanguageRefESDL.xml
${PROJECT_SOURCE_DIR}/docs/LanguageRefKEL.xml
${PROJECT_SOURCE_DIR}/docs/LanguageRefSalt.xml
${PROJECT_SOURCE_DIR}/docs/SyntaxColorSamples.xml
)
INSTALL (FILES ${DOC_FILES} DESTINATION bin)
INSTALL (FILES ${PROJECT_SOURCE_DIR}/LICENSE.txt DESTINATION ".")
# Build tag generation ---
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(ARCH64BIT 1)
ELSE ()
SET(ARCH64BIT 0)
ENDIF ()
MESSAGE ("-- 64bit architecture is ${ARCH64BIT}")
SET(projname ${HPCC_PROJECT})
SET(audience ${HPCC_AUDIENCE})
SET(majorver ${HPCC_MAJOR})
SET(minorver ${HPCC_MINOR})
SET(point ${HPCC_POINT})
IF("${HPCC_MATURITY}" STREQUAL "release")
SET(stagever "${HPCC_SEQUENCE}")
ELSE()
SET(stagever "${HPCC_MATURITY}${HPCC_SEQUENCE}")
ENDIF()
SET(version ${majorver}.${minorver}.${point})
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
SET(stagever "${stagever}-Debug")
ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
# CPack ---
INCLUDE("InstallRequiredSystemLibraries")
INSTALL(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Debug/ CONFIGURATIONS Debug DESTINATION bin FILES_MATCHING PATTERN "*.dll")
INSTALL(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/MinSizeRel/ CONFIGURATIONS MinSizeRel DESTINATION bin FILES_MATCHING PATTERN "*.dll")
INSTALL(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Release/ CONFIGURATIONS Release DESTINATION bin FILES_MATCHING PATTERN "*.dll")
INSTALL(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/RelWithDebInfo/ CONFIGURATIONS RelWithDebInfo DESTINATION bin FILES_MATCHING PATTERN "*.dll")
SET(CPACK_PACKAGE_VENDOR "HPCC Systems")
SET(CPACK_PACKAGE_NAME "hpccsystems-${projname}")
SET(CPACK_PACKAGE_VERSION_MAJOR ${majorver})
SET(CPACK_PACKAGE_VERSION_MINOR ${minorver})
SET(CPACK_PACKAGE_VERSION_PATCH ${point}${stagever})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HPCC Systems ECL IDE.")
SET(CPACK_PACKAGE_CONTACT "HPCCSystems <[email protected]>")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/CPackReadMe.txt")
SET(CPACK_RPM_PACKAGE_VERSION "${audience}")
IF(${ARCH64BIT} EQUAL 1)
SET(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
ELSE(${ARCH64BIT} EQUAL 1)
SET(CPACK_RPM_PACKAGE_ARCHITECTURE "i386")
ENDIF (${ARCH64BIT} EQUAL 1)
SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CPACK_RPM_PACKAGE_ARCHITECTURE}")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
SET(CPACK_STRIP_FILES TRUE)
ENDIF()
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}_${version}-${stagever}${CPACK_SYSTEM_NAME}")
MESSAGE ("-- Current release version is ${CPACK_PACKAGE_FILE_NAME}")
SET(CT_ARCH "i386")
IF (EMBED_64BIT_CLIENTTOOLS)
SET(CT_ARCH "x86_64")
ENDIF ()
find_file(CLIENTTOOLS_PACKAGE_FILE "hpccsystems-clienttools-community_${version}-${stagever}${CMAKE_SYSTEM_NAME}-${CT_ARCH}.exe" HINTS ${CMAKE_CURRENT_BINARY_DIR}/../HPCC-Platform ${CMAKE_CURRENT_BINARY_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/.. )
MESSAGE ("-- Clienttools package: ${CLIENTTOOLS_PACKAGE_FILE}")
if (CLIENTTOOLS_PACKAGE_FILE)
install ( PROGRAMS ${CLIENTTOOLS_PACKAGE_FILE} DESTINATION tmp )
get_filename_component(CLIENTTOOLS_PACKAGE_FILE_NAME ${CLIENTTOOLS_PACKAGE_FILE} NAME)
list ( APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
ExecWait '$INSTDIR\\\\tmp\\\\${CLIENTTOOLS_PACKAGE_FILE_NAME} /S'
")
endif (CLIENTTOOLS_PACKAGE_FILE)
# Calculate GIT Build Tag ---
SET(BUILD_TAG "${CPACK_RPM_PACKAGE_VERSION}_${version}-${stagever}")
IF(USE_GIT_DESCRIBE OR CHECK_GIT_TAG)
FETCH_GIT_TAG (${CMAKE_SOURCE_DIR} ${CPACK_RPM_PACKAGE_VERSION}_${version} GIT_BUILD_TAG)
MESSAGE ("-- Git tag is '${GIT_BUILD_TAG}'")
IF(NOT "${GIT_BUILD_TAG}" STREQUAL "${BUILD_TAG}")
IF(CHECK_GIT_TAG)
MESSAGE(FATAL_ERROR "Git tag '${GIT_BUILD_TAG}' does not match source version '${BUILD_TAG}'")
ELSE()
IF(NOT "${GIT_BUILD_TAG}" STREQUAL "") # probably means being built from a tarball...
SET(BUILD_TAG "${BUILD_TAG}[${GIT_BUILD_TAG}]")
ENDIF()
ENDIF()
ENDIF()
ENDIF()
MESSAGE ("-- Build tag is '${BUILD_TAG}'")
SET(DIR_NAME "HPCCSystems")
SET(version ${HPCC_MAJOR}.${HPCC_MINOR}.${HPCC_POINT})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${DIR_NAME}\\\\${version}\\\\eclide")
#### Change the following if you _don't_ want the installer to uninstall previous versions ####
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "eclide_${HPCC_MAJOR}")
SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\hpccsystems.com")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\eclide.exe")
SET(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
IF("${FB_PLATFORM_ARCH_NAME}" EQUAL "x86_64")
SET (CPACK_NSIS_DISPLAY_NAME "ECL IDE x64")
ELSE ()
SET (CPACK_NSIS_DISPLAY_NAME "ECL IDE")
ENDIF ()
LIST (APPEND CPACK_NSIS_CREATE_ICONS_EXTRA "
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\ECL IDE.lnk\\\" \\\"$INSTDIR\\\\bin\\\\eclide.exe\\\"
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\ECL Reference Help.lnk\\\" \\\"\$INSTDIR\\\\bin\\\\ECLReference.chm\\\"
")
LIST (APPEND CPACK_NSIS_DELETE_ICONS_EXTRA "
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\ECL IDE.lnk\\\"
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\ECL Reference Help.lnk\\\"
")
SET(CPACK_NSIS_DEFINES "
!define MUI_STARTMENUPAGE_DEFAULTFOLDER \\\"${CPACK_PACKAGE_VENDOR}\\\\${version}\\\\${CPACK_NSIS_DISPLAY_NAME}\\\"
!define MUI_FINISHPAGE_NOAUTOCLOSE
")
IF (EXISTS "${PROJECT_SOURCE_DIR}/../sign/passphrase.txt")
FILE(STRINGS "${PROJECT_SOURCE_DIR}/../sign/passphrase.txt" PFX_PASSWORD LIMIT_COUNT 1)
ADD_CUSTOM_TARGET(SIGN
COMMAND signtool sign /f "${PROJECT_SOURCE_DIR}/../sign/hpcc_code_signing.pfx" /fd "SHA256" /p "${PFX_PASSWORD}" /tr "http://timestamp.digicert.com" "${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_NAME}*.exe"
COMMENT "Digital Signature"
)
ADD_DEPENDENCIES(SIGN PACKAGE)
SET_PROPERTY(TARGET SIGN PROPERTY FOLDER "CMakePredefinedTargets")
ENDIF ()
INCLUDE (CPack)
# Configure Scripts ---
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/config.h"
)
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/doStageECLIDE.bat.in"
"${PROJECT_SOURCE_DIR}/doStageECLIDE.bat"
)