-
Notifications
You must be signed in to change notification settings - Fork 20
/
CMakeLists.txt
532 lines (476 loc) · 20.6 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
## Note: pthreads4w requires 3.14 or better.
cmake_minimum_required(VERSION 3.14)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
""
"!!! DO NOT BUILD CMake artifacts in the SIMH source directory !!!\n"
""
"Create a subdirectory and build in that subdirectory, e.g.:"
"\n"
" $ mkdir cmake-build\n"
" $ cd cmake-build\n"
" $ cmake -G \"your generator here\" ..\n"
""
"Preventing in-tree source build.")
endif ()
if (CMAKE_VERSION VERSION_LESS "3.21" AND NOT DEFINED SIMH_INSTALLER_WARNING)
message(WARNING "!!! DO NOT CREATE INSTALLERS WITH THIS VERSION OF CMAKE (${CMAKE_VERSION}) !!!"
"\n"
"Do not create a release or installers with this version of CMake. It does not have "
"the required install(RUNTIME_DEPENDENCY_SET) or install(IMPORTED_RUNTIME_ARTIFACTS) "
"functionality to collect runtime executable dependencies as part of the installation"
" packages, such as Mac OS bundles or Windows DLLs."
"\n"
"Minimum version for creating installers with CPack is 3.21."
)
set(SIMH_INSTALLER_WARNING TRUE CACHE BOOL "Installer/CPack warning issued when CMAKE_VERSION < 3.21" FORCE)
endif ()
## SIMH Version variables:
set(SIMH_VERSION_MAJOR 4)
set(SIMH_VERSION_MINOR 1)
set(SIMH_VERSION_PATCH 0)
set(SIMH_VERSION "${SIMH_VERSION_MAJOR}.${SIMH_VERSION_MINOR}.${SIMH_VERSION_PATCH}"
CACHE PATH "Open-Simh version string.")
# Places to look for CMake modules/includes
set(SIMH_INCLUDE_PATH_LIST
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/installer-customizations)
list(APPEND CMAKE_MODULE_PATH ${SIMH_INCLUDE_PATH_LIST})
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
## vcpkg sanity checking: Cannot use vcpkg and XP toolkit together. If this is
## a XP build, disable vcpkg:
set(USING_VCPKG FALSE)
if (DEFINED ENV{VCPKG_ROOT})
if (CMAKE_GENERATOR_TOOLSET MATCHES "v[0-9][0-9][0-9]_xp")
message(FATAL_ERROR
"Configuration conflict: Cannot build XP binaries with vcpkg. Either "
"unset VCPKG_ROOT in your environment or remove the '-T' toolkit option."
"\n"
"Also remove CMakeCache.txt and recursively remove the CMakeFiles "
"subdirectory in your build folder before reconfiguring.")
endif ()
set(USING_VCPKG TRUE)
## Defer loading the CMAKE_TOOLCHAIN_FILE:
set(SIMH_CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
if(DEFINED CMAKE_TOOLCHAIN_FILE)
## Use the user's provided toolchain file, but load it later.
message(STATUS "Deferring CMAKE_TOOLCHAIN_FILE load.")
set(SIMH_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}")
unset(CMAKE_TOOLCHAIN_FILE)
unset(CMAKE_TOOLCHAIN_FILE CACHE)
endif()
file(TO_CMAKE_PATH "${SIMH_CMAKE_TOOLCHAIN_FILE}" SIMH_CMAKE_TOOLCHAIN_FILE)
message(STATUS "SIMH_CMAKE_TOOLCHAIN_FILE is ${SIMH_CMAKE_TOOLCHAIN_FILE}")
endif ()
## Respect MSVC_RUNTIME_LIBRARY's setting. the policy has to be set before
## project(), otherwise it'd have been put into platform-quirks.
##
## Note: See cmake\build_dep_matrix.cmake to see how this is propagated down
## into the dependency libraries.
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
cmake_policy(SET CMP0091 NEW)
endif()
project(simh VERSION "${SIMH_VERSION}" LANGUAGES C CXX)
include(vcpkg-setup)
include(GNUInstallDirs)
## Provide a default CMAKE_BUILD_TYPE if CMAKE_CONFIGURATION_TYPES is empty or not defined.
if (NOT CMAKE_CONFIGURATION_TYPES)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "CMAKE_BUILD_TYPE defaulted to ${CMAKE_BUILD_TYPE}")
else (NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
endif (NOT CMAKE_BUILD_TYPE)
endif ()
# SIMH_SYSTEM_ID: Roughly analogous to the autoconf system triple. Used (almost exclusively)
# as part of the depedencies' top-level directory name.
set(SIMH_SYSTEM_ID ${CMAKE_SYSTEM_NAME})
string(REPLACE "." ";" version_list ${CMAKE_SYSTEM_VERSION})
list(GET version_list 0 version_major)
string(APPEND SIMH_SYSTEM_ID "-" ${version_major})
if (CMAKE_C_LIBRARY_ARCHITECTURE)
string(APPEND SIMH_SYSTEM_ID -${CMAKE_C_LIBRARY_ARCHITECTURE})
endif (CMAKE_C_LIBRARY_ARCHITECTURE)
string(APPEND SIMH_SYSTEM_ID -${CMAKE_C_COMPILER_ID})
string(REPLACE "." ";" version_list ${CMAKE_C_COMPILER_VERSION})
list(GET version_list 0 version_major)
list(GET version_list 1 version_minor)
if (NOT version_minor)
set(version_minor 0)
endif ()
string(APPEND SIMH_SYSTEM_ID "-${version_major}.${version_minor}")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
string(APPEND SIMH_SYSTEM_ID "-64")
else ()
string(APPEND SIMH_SYSTEM_ID "-32")
endif ()
if (CMAKE_GENERATOR MATCHES "Visual Studio .*" AND CMAKE_GENERATOR_TOOLSET MATCHES "v[0-9][0-9][0-9]_xp")
string(APPEND SIMH_SYSTEM_ID "-XP")
endif ()
# SIMH_DEP_TOPDIR: This is the top-level directory where dependencies live. It's cached so that
# scripts (e.g., cmake-builder.ps1) can update PATH to find shared objects and DLLs.
#
# Only add to search paths if NO_DEP_BUILD is False
set(SIMH_DEP_TOPDIR
${CMAKE_SOURCE_DIR}/cmake/dependencies/${SIMH_SYSTEM_ID}
CACHE PATH "Top-level directory for SIMH library dependencies")
# SIMH_DEP_PATCHES: This is where various external package patches live. Also cached just in case
# it's needed by a script.
set(SIMH_DEP_PATCHES ${CMAKE_SOURCE_DIR}/cmake/patches
CACHE PATH "Top-level directory for external dependency patches")
##-- Options --##
set(NO_DEP_BUILD_OPTVAL FALSE)
if (NOT DEFINED NO_DEP_BUILD)
## For Windows, always build dependencies
if (WIN32 AND NOT DEFINED ENV{MSYSTEM} AND NOT USING_VCPKG)
message(STATUS "Setting NO_DEP_BUILD to FALSE, will BUILD missing dependencies")
set(NO_DEP_BUILD_OPTVAL FALSE)
else ()
message(STATUS "Setting NO_DEP_BUILD to TRUE, will NOT BUILD missing dependencies")
set(NO_DEP_BUILD_OPTVAL TRUE)
endif ()
else ()
set(NO_DEP_BUILD_OPTVAL ${NO_DEP_BUILD})
if (NO_DEP_BUILD_OPTVAL)
message(STATUS "Missing dependencies WILL NOT BE BUILT.")
else ()
message(STATUS "Missing dependencies WILL BE BUILT.")
endif ()
endif ()
set(MAC_UNIVERSAL_OPTVAL FALSE)
if (NOT DEFINED MAC_UNIVERSAL)
if (APPLE)
message("macOS universal binaries WILL NOT BE BUILT")
endif ()
else ()
set(MAC_UNIVERSAL_OPTVAL ${MAC_UNIVERSAL})
if (MAC_UNIVERSAL_OPTVAL)
message(STATUS "macOS unversal binaries WILL BE BUILT.")
else ()
message(STATUS "macOS unversal binaries NOT WILL BE BUILT.")
endif ()
endif ()
option(NO_DEP_BUILD
"Enable (=1)/disable (=0) Dependency library builds (def: enabled)"
${NO_DEP_BUILD_OPTVAL})
option(BUILD_SHARED_DEPS
"Enable (=1)/disable (=0) building dependencies as shared libraries/DLLs (def: disabled)"
FALSE)
option(WITH_ASYNC
"Enable (=1)/disable (=0) Asynchronous I/O and threading."
TRUE)
option(WITH_REGEX
"Enable (=1)/disable (=0) PCRE/PCRE2 regular expression support (def: enabled)"
TRUE)
option(PREFER_PCRE
"Prefer (=1)/ignore (=0) Prefer PCRE over PCRE2 (def: ignore)"
TRUE)
option(WITH_NETWORK
"Enable (=1)/disable (=0) simulator networking support. (def: enabled)"
TRUE)
option(WITH_PCAP
"Enable (=1)/disable (=0) libpcap (packet capture) support. (def: enabled)"
TRUE)
option(WITH_SLIRP
"Enable (=1)/disable (=0) SLIRP network support. (def: enabled)"
TRUE)
option(WITH_VDE
"Enable (=1)/disable (=0) VDE2/VDE4 network support. (def: enabled)"
TRUE)
option(WITH_TAP
"Enable (=1)/disable (=0) TAP/TUN device network support. (def: enabled)"
TRUE)
option(WITH_VIDEO
"Enable (=1)/disable (=0) simulator display and graphics support (def: enabled)"
TRUE)
option(PANDA_LIGHTS
"Enable (=1)/disable (=0) KA-10/KI-11 simulator's Panda display. (def: disabled)"
FALSE)
option(DONT_USE_ROMS
"Enable (=1)/disable (=0) building support ROMs. (def: disabled)"
FALSE)
option(ENABLE_CPPCHECK
"Enable (=1)/disable (=0) 'cppcheck' static code analysis. (def: disabled.)"
FALSE)
option(WINAPI_DEPRECATION
"Show (=1)/mute (=0) Various WinAPI deprecation warning (def: mute.)"
FALSE)
option(WARNINGS_FATAL
"Compile-time warnings are errors (e.g., \"-Werror\" on GCC)"
FALSE)
option(RELEASE_LTO
"Use Link Time Optimization (LTO) in Release builds."
FALSE)
option(DEBUG_WALL
"Turn on maximal compiler warnings in Debug builds (e.g., \"-Wall\" or \"/W4\")"
FALSE)
option(SIMH_PACKAGE_SUFFIX
"The packaging suffix for CPack artifacts, e.g. simh-SIMH_VERSION-SIMH_PACKAGE_SUFFIX."
"")
option(MAC_UNIVERSAL
"macOS universal binary flag: TRUE -> build universal binaries, FALSE -> don't."
${MAC_UNIVERSAL_OPTVAL})
# Places where CMake should look for dependent package configuration fragments and artifacts:
set(SIMH_PREFIX_PATH_LIST)
if (NOT (USING_VCPKG OR NO_DEP_BUILD))
list(APPEND CMAKE_INCLUDE_PATH ${SIMH_DEP_TOPDIR})
list(APPEND SIMH_PREFIX_PATH_LIST ${SIMH_DEP_TOPDIR})
list(APPEND CMAKE_PREFIX_PATH ${SIMH_PREFIX_PATH_LIST})
endif ()
## libpcap, if not found, will put its headers in $CMAKE_BINARY_DIR/include.
## Make sure we can find them.
list(APPEND CMAKE_INCLUDE_PATH "${CMAKE_BINARY_DIR}/include")
## Additional command line arguments for dependencies. Need this because Powershell will report
## an error if anything is sent to stderr and $ErrorDefaultAction is set to "Stop".
set(DEP_CMAKE_ARGS "-Wno-dev" "--no-warn-unused-cli")
## build-stage directory hierarchy for dependency installs:
if (NOT (USING_VCPKG OR NO_DEP_BUILD) AND NOT EXISTS ${SIMH_DEP_TOPDIR})
message(STATUS "Creating dependency library directory hierarchy")
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${SIMH_DEP_TOPDIR} ${SIMH_DEP_TOPDIR}/include ${SIMH_DEP_TOPDIR}/lib
${SIMH_DEP_TOPDIR}/bin
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif ()
## Default install location is ${CMAKE_SOURCE_DIR}/SIMH-install if not otherwise set
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/SIMH-install" CACHE PATH "${CMAKE_SOURCE_DIR}/SIMH-install default install prefix" FORCE)
endif()
## The default runtime output directory is the BIN subdirectory in the source tree's top
set(SIMH_LEGACY_INSTALL "${CMAKE_SOURCE_DIR}/BIN")
if (WIN32)
string(APPEND SIMH_LEGACY_INSTALL "/Win32")
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SIMH_LEGACY_INSTALL})
## Source directory is always on the global include path.
include_directories(${CMAKE_SOURCE_DIR})
if (NOT USING_VCPKG AND NOT NO_DEP_BUILD)
# Make sure we can include and link from the dependency directory
list(APPEND CMAKE_LIBRARY_PATH ${SIMH_DEP_TOPDIR}/lib)
link_directories(${SIMH_DEP_TOPDIR}/lib)
list(APPEND CMAKE_INCLUDE_PATH ${SIMH_DEP_TOPDIR}/include)
include_directories(${SIMH_DEP_TOPDIR}/include)
endif ()
## CMake policy tweaks
if (CMAKE_VERSION GREATER_EQUAL 3.24)
## Until I figure out a way to add DOWNLOAD_EXTRACT_TIMESTAMP to the call to
## ExternalProject_Add cleanly..
cmake_policy(SET CMP0135 NEW)
endif()
## "Standard" includes
include(CheckCSourceCompiles)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckTypeSize)
include(CheckCCompilerFlag)
include(FindPackageHandleStandardArgs)
## Deal with platform quirkiness
include(platform-quirks)
# Find packages, arrange for dependency download/compile/install:
#
# SIMH_BUILD_DEPS is the list of the dependecies' names, for pretty-printing.
# SIMH_DEP_TARGETS is the list of dependency targets' names that we'll actually build.
set(SIMH_BUILD_DEPS)
set(SIMH_DEP_TARGETS)
set(THREADING_PKG_STATUS "unknown")
set(ZLIB_PKG_STATUS "unknown")
set(PCRE_PKG_STATUS "unknown")
set(VIDEO_PKG_STATUS)
set(NETWORK_PKG_STATUS)
# if (USING_VCPKG)
# ## Sanity checking output: Ensure that vcpkg picked up the correct triplet
# message(STATUS "VCPKG sanity check:\n"
# " .. VCPKG target triplet is ${VCPKG_TARGET_TRIPLET}\n"
# " .. VCPKG_CRT_LINKAGE is ${VCPKG_CRT_LINKAGE}"
# ## " .. CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}\n"
# ## " .. CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
# )
# endif ()
# SIMH local packages:
include(build_dep_matrix)
include(os-features)
include(dep-locate)
include(dep-link)
if (VIDEO_PKG_STATUS)
string(REPLACE ";" ", " VIDEO_PKG_STATUS "${VIDEO_PKG_STATUS}")
else (VIDEO_PKG_STATUS)
set(VIDEO_PKG_STATUS "unknown")
endif (VIDEO_PKG_STATUS)
if (NETWORK_PKG_STATUS)
string(REPLACE ";" ", " NETWORK_PKG_STATUS "${NETWORK_PKG_STATUS}")
else (NETWORK_PKG_STATUS)
set(NETWORK_PKG_STATUS "unknown")
endif (NETWORK_PKG_STATUS)
set(CPPCHECK_STATUS "disabled.")
if (ENABLE_CPPCHECK)
find_program(cppcheck_cmd NAMES cppcheck)
if (cppcheck_cmd)
list(APPEND cppcheck_cmd
"--language=c"
"--enable=warning,style,performance,portability,information,missingInclude"
"--suppress=missingIncludeSystem"
"--inline-suppr"
"--std=c99"
"--force")
set(CPPCHECK_STATUS "found and enabled.")
if (WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND cppcheck_cmd
"--platform=win64")
set(CPPCHECK_STATUS "found, Win64 platform.")
else ()
list(APPEND cppcheck_cmd
"--platform=win32A")
set(CPPCHECK_STATUS "found, Win32 ASCII platform.")
endif ()
endif ()
else (cppcheck_cmd)
set(CPPCHECK_STATUS "'cppcheck' not installed.")
endif ()
endif ()
set(_feature_text "Libraries and features:\n")
string(APPEND _feature_text "\n * Build with video/graphics support. ${BUILD_WITH_VIDEO}")
string(APPEND _feature_text "\n * Build with networking support .... ${BUILD_WITH_NETWORK}")
string(APPEND _feature_text "\n * Build internal ROMS .............. ")
if (DONT_SET_ROMS)
string(APPEND _feature_text "No")
else ()
string(APPEND _feature_text "Yes")
endif ()
string(APPEND _feature_text "\n * Thread support ................... ${THREADING_PKG_STATUS}")
string(APPEND _feature_text "\n * zlib ............................. ${ZLIB_PKG_STATUS}")
string(APPEND _feature_text "\n * Perl-Compatible RegExps........... ${PCRE_PKG_STATUS}")
string(APPEND _feature_text "\n * PNG, Freetype, SDL2, SDL2_ttf .... ${VIDEO_PKG_STATUS}")
string(APPEND _feature_text "\n * Network support .................. ${NETWORK_PKG_STATUS}")
get_target_property(OS_FEATURE_DEFS os_features INTERFACE_COMPILE_DEFINITIONS)
list(LENGTH OS_FEATURE_DEFS len_os_features)
string(APPEND _feature_text "\n * OS Feature definitions")
if (OS_FEATURE_DEFS)
string(APPEND _feature_text ":")
foreach (feature ${OS_FEATURE_DEFS})
string(APPEND _feature_text "\n .. ${feature}")
endforeach()
else ()
string(APPEND _feature_text " ........... None defined.")
endif ()
get_target_property(OS_FEATURE_LIBS os_features INTERFACE_LINK_LIBRARIES)
list(LENGTH OS_FEATURE_LIBS len_os_features)
string(APPEND _feature_text "\n * OS Feature libraries")
if (OS_FEATURE_LIBS)
string(APPEND _feature_text ":")
foreach (feature ${OS_FEATURE_LIBS})
string(APPEND _feature_text "\n .. ${feature}")
endforeach ()
else ()
string(APPEND _feature_text " ............. None required.")
endif ()
string(APPEND _feature_text "\n * 'cppcheck' ....................... ${CPPCHECK_STATUS}")
string(APPEND _feature_text "\n")
message(STATUS ${_feature_text})
unset(_feature_text)
unset(ROM_STATUS)
if (NO_DEP_BUILD AND SIMH_BUILD_DEPS)
## Don't build dependencies. Just wail about them.
message("")
message("Missing SIMH dependencies:")
foreach (dep ${SIMH_BUILD_DEPS})
message(STATUS " ${dep}")
endforeach()
message("")
message("Please install the above dependencies via your platform package management or")
message("software installation system and reconfigure.")
message("")
message("Also see the .travis/deps.h file for Brew and apt packages installed during")
message("github.com workflow actions.")
message(FATAL_ERROR "Missing dependencies, cannot continue.")
## TODO: Assume that these dependencies are optional?
endif ()
if (NOT DEFINED DO_DEPENDENCY_BUILD OR SIMH_BUILD_DEPS)
if (DEFINED DO_DEPENDENCY_BUILD AND NOT DO_DEPENDENCY_BUILD AND SIMH_BUILD_DEPS)
message(FATAL_ERROR "Dependency libraries did not build successfully!!??")
endif()
if (SIMH_BUILD_DEPS)
message(STATUS "Building dependency libraries as a superbuild")
set(DO_DEPENDENCY_BUILD ON CACHE BOOL "Superbuild flag" FORCE)
else ()
set(DO_DEPENDENCY_BUILD OFF CACHE BOOL "Superbuild flag" FORCE)
endif ()
else ()
set(DO_DEPENDENCY_BUILD ${DO_DEPENDENCY_BUILD} CACHE BOOL "Superbuild flag" FORCE)
endif ()
if (NOT DO_DEPENDENCY_BUILD)
include (add_simulator)
if (WITH_SLIRP)
add_subdirectory(slirp)
endif (WITH_SLIRP)
## Don't delete yet ## set(Python_ADDITIONAL_VERSIONS 3)
## Don't delete yet ## include(FindPythonInterp)
## Don't delete yet ## if (PYTHONINTERP_FOUND AND PYTHON_VERSION_MAJOR GREATER_EQUAL 3)
## Don't delete yet ## add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/cmake/simh-simulators.cmake
## Don't delete yet ## COMMAND ${PYTHON_EXECUTABLE} "-m" generate "--srcdir" "${CMAKE_SOURCE_DIR}"
## Don't delete yet ## MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/makefile
## Don't delete yet ## COMMENT "Updating cmake/simh-simulators.cmake"
## Don't delete yet ## WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake
## Don't delete yet ## COMMAND_EXPAND_LISTS)
## Don't delete yet ## message(STATUS "Added makefile update rule.")
## Don't delete yet ## endif (PYTHONINTERP_FOUND AND PYTHON_VERSION_MAJOR GREATER_EQUAL 3)
## Don't delete yet ##
## Don't delete yet ## if (${CMAKE_SOURCE_DIR}/makefile IS_NEWER_THAN ${CMAKE_SOURCE_DIR}/cmake/simh-simulators.cmake)
## Don't delete yet ## if (NOT PYTHONINTERP_FOUND OR PYTHON_VERSION_MAJOR LESS 3)
## Don't delete yet ## if (NOT PYTHONINTERP_FOUND)
## Don't delete yet ## message("!! Python not found")
## Don't delete yet ## elseif (PYTHON_VERSION_MAJOR LESS 3)
## Don't delete yet ## message("!! Python is not python3")
## Don't delete yet ## endif (NOT PYTHONINTERP_FOUND)
## Don't delete yet ##
## Don't delete yet ## message("!!")
## Don't delete yet ## message("!! Cannot update cmake/simh-simulators.cmake, using older version.")
## Don't delete yet ## message("!! Proceed with caution: This build might not succeed.")
## Don't delete yet ## message("!!")
## Don't delete yet ## message(STATUS "Keeping existing cmake/simh-simulators.cmake")
## Don't delete yet ## else (NOT PYTHONINTERP_FOUND OR PYTHON_VERSION_MAJOR LESS 3)
## Don't delete yet ## message(STATUS "Updating cmake/simh-simulators.cmake")
## Don't delete yet ## execute_process(COMMAND ${PYTHON_EXECUTABLE} "-m" generate "--srcdir" "${CMAKE_SOURCE_DIR}"
## Don't delete yet ## WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake)
## Don't delete yet ## endif (NOT PYTHONINTERP_FOUND OR PYTHON_VERSION_MAJOR LESS 3)
## Don't delete yet ## endif ()
message(STATUS "Adding simulators")
include(simh-simulators)
include(cpack-setup)
include(simh-packaging)
else ()
message(STATUS "")
message(STATUS "Building the following dependency libraries:")
message(STATUS "")
foreach(dep ${SIMH_BUILD_DEPS})
message(STATUS " ${dep}")
endforeach ()
message(STATUS "")
ExternalProject_Add (simh_superbuild
DEPENDS
${SIMH_DEP_TARGETS}
SOURCE_DIR
${CMAKE_SOURCE_DIR}
CMAKE_ARGS
-DDO_DEPENDENCY_BUILD:BOOL=OFF
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
INSTALL_COMMAND ""
BINARY_DIR
${CMAKE_BINARY_DIR}
USES_TERMINAL_CONFIGURE TRUE
USES_TERMINAL_BUILD TRUE
)
## Ensure that the next build rechecks the dependency
## libraries that were just built and finds them.
unset(Freetype_FOUND CACHE)
unset(PCAP_FOUND CACHE)
unset(PCRE_FOUND CACHE)
unset(PCRE2_FOUND CACHE)
unset(PNG_FOUND CACHE)
unset(PTW_FOUND CACHE)
unset(SDL2_FOUND CACHE)
unset(SDL2_ttf_FOUND CACHE)
unset(ZLIB_FOUND CACHE)
endif ()