Skip to content

Commit

Permalink
CMake: Updates
Browse files Browse the repository at this point in the history
Issue #294: "apple silicon build problem(s?)": If the "--flavor/-f" flag
is not specified on the command line, then complain loudly, print help
and exit. The script used to default to "Unix Makefiles".

Updates:

- Add missing "-DHAVE_LIBPNG" compiler command line define when the PNG
  library is detected/present for screen capture support.

- Add "clang64" to the list of MinGW64 platforms for which the
  .travis/deps.sh script can install build dependencies.

- Add PThread4W_FOUND to the condition that sets async I/O for Win32
  when using vcpkg for build dependencies.

- Add vs2022-x64, vs2019-x64 and vs2017-x64 build environments to
  build 64-bit Windows executables.

- Use simulator AIO only where needed by the simulator (i.e., the
  simulator calls/uses AIO_CHECK_EVENT in sim_instr())

  - Add "USES_AIO" flag to add_simulator() to mark a simulator that
    acutally uses asynchronous I/O.

  - Build "_aio" SIMH core library variants that have AIO turned on,
    link with the "_aio" variant when a simulator sets USES_AIO.

  - Emit a warning message when WITH_ASYNC is False (CMake configuration
    option) to notify the user/developer that some functionality will be
    crippled.

  Affected simulator builds: 3b2 family, PDP-6, PDP-11, VAX family,
  IMLAC and TT2500. The makefile and cmake/generate.py also updated
  to remain in sync with CMake.

  N.B.: Simulators still link with the underlying platform's threading
  library. SEL32 requires pthreads or equivalent threading library,
  independent of AIO.

CMake 3.28.1 INTERFACE_LINK_LIBRARIES behavior change: The file name
must now be an absolute path. Relative paths no longer accepted.
Internally, SIMH enforces this if CMAKE_VERSION >= 3.19, when REAL_PATH
was first implemented.
  • Loading branch information
bscottm committed Jan 13, 2024
1 parent c077c22 commit 3640fd5
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 133 deletions.
16 changes: 15 additions & 1 deletion .travis/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,22 @@ install_ucrt64() {
mingw-w64-ucrt-x86_64-libpcap
}

install_clang64() {
pacman -S --needed mingw-w64-clang-x86_64-ninja \
mingw-w64-clang-x86_64-cmake \
mingw-w64-clang-x86_64-extra-cmake-modules \
mingw-w64-clang-x86_64-clang \
mingw-w64-clang-x86_64-make \
mingw-w64-clang-x86_64-pcre \
mingw-w64-clang-x86_64-freetype \
mingw-w64-clang-x86_64-SDL2 \
mingw-w64-clang-x86_64-SDL2_ttf \
mingw-w64-clang-x86_64-libpcap
}


case "$1" in
osx|linux|mingw64|ucrt64)
osx|linux|mingw64|ucrt64|clang64)
install_"$1"
;;
*)
Expand Down
2 changes: 2 additions & 0 deletions 3B2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ add_simulator(3b2
DEFINES
REV2
FEATURE_FULL64
USES_AIO
LABEL 3B2
PKG_FAMILY att3b2_family
TEST 3b2)
Expand Down Expand Up @@ -65,6 +66,7 @@ add_simulator(3b2-700
DEFINES
REV3
FEATURE_FULL64
USES_AIO
LABEL 3B2
PKG_FAMILY att3b2_family
TEST 3b2-700)
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ if (CMAKE_VERSION VERSION_LESS "3.21" AND NOT DEFINED SIMH_INSTALLER_WARNING)
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
Expand Down Expand Up @@ -73,12 +80,6 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
cmake_policy(SET CMP0091 NEW)
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}")

project(simh VERSION "${SIMH_VERSION}" LANGUAGES C CXX)

include(vcpkg-setup)
Expand Down
1 change: 1 addition & 0 deletions PDP10/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ add_simulator(pdp6
FEATURE_INT64
FEATURE_VIDEO
FEATURE_DISPLAY
USES_AIO
LABEL PDP10
PKG_FAMILY decpdp_family
TEST pdp6)
1 change: 1 addition & 0 deletions PDP11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ add_simulator(pdp11
VM_PDP11
FEATURE_VIDEO
FEATURE_DISPLAY
USES_AIO
BUILDROMS
LABEL PDP11
PKG_FAMILY pdp11_family
Expand Down
41 changes: 32 additions & 9 deletions README-CMake.md
Original file line number Diff line number Diff line change
Expand Up @@ -1189,13 +1189,15 @@ add_simulator(3b2
convention `[sim]_test.ini` -- the argument to the `TEST` parameter is the
`[sim]` portion of the test script's name.
- Option keywords: These determine which of [six (6) simulator core libraries](#simulator-core-libraries) is
- Option keywords: These determine which of [simulator core libraries](#simulator-core-libraries) is
linked with the simulator.
- `FEATURE_INT64`: 64-bit integers, 32-bit pointers
- `FEATURE_FULL64`: 64-bit integers, 64-bit pointers
- `FEATURE_VIDEO`: Simulator video support.
- `FEATURE_DISPLAY`: Video display support.
- `USES_AIO`: Asynchronous I/O support (primarily useful for simulator
network devices.)
- `PKG_FAMILY` option: This option adds the simulator to a package "family" or
simulator packaging group, e.g., "DEC PDP simulators". The default package
Expand All @@ -1213,14 +1215,31 @@ The `CMake` build infrastructure avoids repeatedly compiling the simulator
libraries that represents the combination of required features: 32/64 bit
support and video:
| Library | Video | Integer size | Address size | `add_simulator` flags |
| :--------------- | :---: | -----------: | -----------: | :-------------------- |
| simhcore.a | N | 32 | 32 | |
| simhi64.a | N | 64 | 32 | `FEATURE_INT64` |
| simhz64.a | N | 64 | 64 | `FEATURE_FULL64` |
| simhcore_video.a | Y | 32 | 32 | `FEATURE_VIDEO` |
| simhi64_video.a | Y | 64 | 32 | `FEATURE_INT64`, `FEATURE_VIDEO` |
| simhz64_video.a | Y | 64 | 64 | `FEATURE_FULL64`, `FEATURE_VIDEO` |
| Library | Video | Integer size | Address size | `add_simulator` flags |
| :---------------- | :---: | -----------: | -----------: | :-------------------- |
| simhcore.a | N | 32 | 32 | |
| simhi64.a | N | 64 | 32 | `FEATURE_INT64` |
| simhz64.a | N | 64 | 64 | `FEATURE_FULL64` |
| simhcore\_video.a | Y | 32 | 32 | `FEATURE_VIDEO` |
| simhi64\_video.a | Y | 64 | 32 | `FEATURE_INT64`, `FEATURE_VIDEO` |
| simhz64\_video.a | Y | 64 | 64 | `FEATURE_FULL64`, `FEATURE_VIDEO` |
In addition to these six libraries, there are six asynchronous I/O (AIO)
variants that are built and linked into a simulator when the `USES_AIO` feature
flag is present in `add_simulator()`'s arguments:
| Library variant | Description |
| :--------------------- | :---------: |
| simhcore\_aio.a | simhcore.a with AIO support. |
| simhi64\_aio.a | simhi64.a with AIO support. |
| simhz64\_aio.a | simhz64.a with AIO support. |
| simhcore\_video\_aio.a | simhcore\_video.a with AIO support. |
| simhi64\_video\_aio.a | simhi64\_video.a with AIO support. |
| simhz64\_video\_aio.a | simhz64\_video.a with AIO support. |
The `EXCLUDE_FROM_ALL` property is set on each of theses libraries in CMake to
avoid building the entire matrix. Practically speaking, 10 out of the 12 total
libraries actually build for the entire simulator suite.
Internally, these core libraries are [`CMake` interface libraries][cmake_interface_library] -- when they
are added to a simulator's executable via `target_link_libraries`, the simulator
Expand Down Expand Up @@ -1265,6 +1284,10 @@ add_simulator(simulator_name
## in conjunction with FEATURE_VIDEO
FEATURE_DISPLAY
## Simulator uses asynchronous I/O, i.e., calls AIO_CHECK_EVENT
## in its sim_instr() instruction simulation loop:
USES_AIO
## Packaging "family" (group) to which the simulator belongs,
## for packagers that support grouping (Windows: NSIS .exe,
## WIX .msi; macOS)
Expand Down
20 changes: 20 additions & 0 deletions VAX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ add_simulator(infoserver100
VAX_411
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -169,6 +170,7 @@ add_simulator(infoserver1000
VM_VAX
IS_1000
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -186,6 +188,7 @@ add_simulator(infoserver150vxt
VAX_412
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -230,6 +233,7 @@ add_simulator(microvax1
VAX_610
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -246,6 +250,7 @@ add_simulator(microvax2
VAX_630
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -283,6 +288,7 @@ add_simulator(microvax2000
VAX_410
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -300,6 +306,7 @@ add_simulator(microvax3100
VAX_41A
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -317,6 +324,7 @@ add_simulator(microvax3100e
VAX_41D
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -332,6 +340,7 @@ add_simulator(microvax3100m80
VAX_440
VAX_47
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -362,6 +371,7 @@ add_simulator(vax
VM_VAX
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -435,6 +445,7 @@ add_simulator(vax730
VM_VAX
VAX_730
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -485,6 +496,7 @@ add_simulator(vax750
VM_VAX
VAX_750
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -536,6 +548,7 @@ add_simulator(vax780
VM_VAX
VAX_780
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -584,6 +597,7 @@ add_simulator(vax8200
VM_VAX
VAX_820
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -633,6 +647,7 @@ add_simulator(vax8600
VM_VAX
VAX_860
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -650,6 +665,7 @@ add_simulator(vaxstation3100m30
VAX_42A
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -667,6 +683,7 @@ add_simulator(vaxstation3100m38
VAX_42B
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down Expand Up @@ -702,6 +719,7 @@ add_simulator(vaxstation3100m76
VAX_43
FEATURE_FULL64
FEATURE_VIDEO
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -717,6 +735,7 @@ add_simulator(vaxstation4000m60
VAX_440
VAX_46
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand All @@ -732,6 +751,7 @@ add_simulator(vaxstation4000vlc
VAX_440
VAX_48
FEATURE_FULL64
USES_AIO
BUILDROMS
LABEL VAX
PKG_FAMILY vax_family
Expand Down
Loading

0 comments on commit 3640fd5

Please sign in to comment.