1
0
mirror of https://github.com/open-simh/simh.git synced 2026-01-26 04:02:39 +00:00

CMake: Updates

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/cmake-builder.sh

  - New "--no-aio" flag: Build simulators without async I/O.

  - New "--no-aio-intrinsics" flag: Don't build async I/O using compiler
    compare-exchange, atomic load intrinsics.

- cmake/cmake-builder.ps1

  - New "-noaio" flag: Build simulators without async I/O.

  - New "-noaiointrinsics" flag: Don't build async I/O using compiler
    compare-exchange, atomic load intrinsics.

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.
This commit is contained in:
B. Scott Michel
2023-12-04 11:33:00 -08:00
committed by Paul Koning
parent f4c39a325c
commit d9d0e8bd74
18 changed files with 324 additions and 139 deletions

View File

@@ -42,67 +42,78 @@ set(SIM_VIDEO_SOURCES
${CMAKE_SOURCE_DIR}/display/display.c
${CMAKE_SOURCE_DIR}/display/sim_ws.c)
## Build a simulator core library, with and without AIO support. The AIO variant
## has "_aio" appended to its name, e.g., "simhz64_aio" or "simhz64_video_aio".
function(build_simcore _targ)
cmake_parse_arguments(SIMH "VIDEO;INT64;ADDR64;BESM6_SDL_HACK" "" "" ${ARGN})
# Additional library targets that depend on simulator I/O:
add_library(${_targ} STATIC ${SIM_SOURCES})
set(sim_aio_lib "${_targ}_aio")
add_library(${sim_aio_lib} STATIC ${SIM_SOURCES})
# Components that need to be turned on while building the library, but
# don't export out to the dependencies (hence PRIVATE.)
set_target_properties(${_targ} PROPERTIES
C_STANDARD 99
)
target_compile_definitions(${_targ} PRIVATE USE_SIM_CARD USE_SIM_IMD)
target_compile_options(${_targ} PRIVATE ${EXTRA_TARGET_CFLAGS})
target_link_options(${_targ} PRIVATE ${EXTRA_TARGET_LFLAGS})
foreach (lib IN ITEMS "${_targ}" "${sim_aio_lib}")
set_target_properties(${lib} PROPERTIES
C_STANDARD 99
EXCLUDE_FROM_ALL True
)
target_compile_definitions(${lib} PRIVATE USE_SIM_CARD USE_SIM_IMD)
target_compile_options(${lib} PRIVATE ${EXTRA_TARGET_CFLAGS})
target_link_options(${lib} PRIVATE ${EXTRA_TARGET_LFLAGS})
# Make sure that the top-level directory is part of the libary's include path:
target_include_directories("${_targ}" PUBLIC "${CMAKE_SOURCE_DIR}")
# Make sure that the top-level directory is part of the libary's include path:
target_include_directories("${lib}" PUBLIC "${CMAKE_SOURCE_DIR}")
if (SIMH_INT64)
target_compile_definitions(${_targ} PUBLIC USE_INT64)
endif (SIMH_INT64)
if (SIMH_INT64)
target_compile_definitions(${lib} PUBLIC USE_INT64)
endif (SIMH_INT64)
if (SIMH_ADDR64)
target_compile_definitions(${_targ} PUBLIC USE_ADDR64)
endif (SIMH_ADDR64)
if (SIMH_ADDR64)
target_compile_definitions(${lib} PUBLIC USE_ADDR64)
endif (SIMH_ADDR64)
if (SIMH_VIDEO)
if (WITH_VIDEO)
# It's the video library
target_sources(${_targ} PRIVATE ${SIM_VIDEO_SOURCES})
target_link_libraries(${_targ} PUBLIC simh_video)
if (SIMH_VIDEO)
if (WITH_VIDEO)
# It's the video library
target_sources(${lib} PRIVATE ${SIM_VIDEO_SOURCES})
target_link_libraries(${lib} PUBLIC simh_video)
endif ()
if (CMAKE_HOST_APPLE AND NOT SIMH_BESM6_SDL_HACK)
## (a) The BESM6 SDL hack is temporary. If SDL_MAIN_AVAILABLE needs
## to be defined, it belongs in the simh_video interface library.
## (b) BESM6 doesn't use SIMH's video capabilities correctly and
## the makefile filters out SDL_MAIN_AVAILABLE on macOS.
## (c) This shouldn't be just an Apple platform quirk; SDL_main should
## be used by all platforms. <sigh!>
target_compile_definitions("${lib}" PUBLIC SDL_MAIN_AVAILABLE)
endif ()
endif ()
if (CMAKE_HOST_APPLE AND NOT SIMH_BESM6_SDL_HACK)
## (a) The BESM6 SDL hack is temporary. If SDL_MAIN_AVAILABLE needs
## to be defined, it belongs in the simh_video interface library.
## (b) BESM6 doesn't use SIMH's video capabilities correctly and
## the makefile filters out SDL_MAIN_AVAILABLE on macOS.
## (c) This shouldn't be just an Apple platform quirk; SDL_main should
## be used by all platforms. <sigh!>
target_compile_definitions("${_targ}" PUBLIC SDL_MAIN_AVAILABLE)
# Define SIM_BUILD_TOOL for the simulator'
target_compile_definitions("${lib}" PRIVATE
"SIM_BUILD_TOOL=CMake (${CMAKE_GENERATOR})"
)
target_link_libraries(${lib} PUBLIC
simh_network
simh_regexp
os_features
thread_lib
)
# Ensure that sim_rev.h picks up .git-commit-id.h if the git command is
# available.
if (GIT_COMMAND)
target_compile_definitions("${lib}" PRIVATE SIM_NEED_GIT_COMMIT_ID)
endif ()
endif ()
target_link_libraries(${_targ} PUBLIC
simh_network
simh_regexp
os_features
thread_lib
)
add_dependencies(${lib} update_sim_commit)
endforeach ()
# Define SIM_BUILD_TOOL for the simulator'
target_compile_definitions("${_targ}" PRIVATE
"SIM_BUILD_TOOL=CMake (${CMAKE_GENERATOR})"
)
# Ensure that sim_rev.h picks up .git-commit-id.h if the git command is
# available.
if (GIT_COMMAND)
target_compile_definitions("${_targ}" PRIVATE SIM_NEED_GIT_COMMIT_ID)
endif ()
add_dependencies(${_targ} update_sim_commit)
target_compile_definitions(${sim_aio_lib} PUBLIC ${AIO_FLAGS})
# Create target cppcheck rule, if detected.
if (ENABLE_CPPCHECK AND cppcheck_cmd)
@@ -142,6 +153,7 @@ list(APPEND ADD_SIMULATOR_OPTIONS
"FEATURE_DISPLAY"
"NO_INSTALL"
"BESM6_SDL_HACK"
"USES_AIO"
)
## TEST: The test script name that will be executed by the simulator within CTest.
@@ -172,6 +184,12 @@ function (simh_executable_template _targ)
message(FATAL_ERROR "${_targ}: No source files?")
endif (NOT DEFINED SIMH_SOURCES)
if (SIMH_USES_AIO AND NOT WITH_ASYNC)
message(WARNING
"!!! ${_targ}: Asynchronous I/O not enabled, but this simulator specifies USES_AIO\n"
"!!! Some features will be crippled, notably networking.")
endif ()
add_executable("${_targ}" "${SIMH_SOURCES}")
set_target_properties(${_targ} PROPERTIES
C_STANDARD 99
@@ -227,6 +245,11 @@ function (simh_executable_template _targ)
endif ()
endif ()
# Uses AIO...
if (SIMH_USES_AIO)
set(SIMH_SIMLIB "${SIMH_SIMLIB}_aio")
endif()
target_link_libraries("${_targ}" PUBLIC "${SIMH_SIMLIB}")
endfunction ()

View File

@@ -74,10 +74,13 @@ param (
## ------------------
## vs2022 Visual Studio 2022 (default)
## vs2022-xp Visual Studio 2022 XP compat
## vs2022-x64 Visual Studio 2022 64-bit
## vs2019 Visual Studio 2019
## vs2019-xp Visual Studio 2019 XP compat
## vs2019-x64 Visual Studio 2019 64-bit
## vs2017 Visual Studio 2017
## vs2017-xp Visual Studio 2017 XP compat
## vs2017-x64 Visual Studio 2017 64-bit
## vs2015 Visual Studio 2015
## mingw-make MinGW GCC/mingw32-make
## mingw-ninja MinGW GCC/ninja
@@ -115,6 +118,15 @@ param (
[Parameter(Mandatory=$false)]
[switch] $novideo = $false,
## Compile the SIMH simulator without AIO support.
[Parameter(Mandatory=$false)]
[switch] $noaio = $false,
## Compile the SIMH simulator without AIO instrinsics ("lock-free" AIO),
## using lock-based AIO via thread mutexes instead.
[Parameter(Mandatory=$false)]
[switch] $noaiointrinsics = $false,
## Disable the build's tests.
[Parameter(Mandatory=$false)]
[switch] $notest = $false,
@@ -196,10 +208,13 @@ $singleConfig = $true
$cmakeGenMap = @{
"vs2022" = [GeneratorInfo]::new("Visual Studio 17 2022", $multiConfig, $false, "", @("-A", "Win32"));
"vs2022-xp" = [GeneratorInfo]::new("Visual Studio 17 2022", $multiConfig, $false, "", @("-A", "Win32", "-T", "v141_xp"));
"vs2022-x64" = [GeneratorInfo]::new("Visual Studio 17 2022", $multiConfig, $false, "", @("-A", "x64", "-T", "host=x64"));
"vs2019" = [GeneratorInfo]::new("Visual Studio 16 2019", $multiConfig, $false, "", @("-A", "Win32"));
"vs2019-xp" = [GeneratorInfo]::new("Visual Studio 16 2019", $multiConfig, $false, "", @("-A", "Win32", "-T", "v141_xp"));
"vs2019-x64" = [GeneratorInfo]::new("Visual Studio 17 2022", $multiConfig, $false, "", @("-A", "x64", "-T", "host=x64"));
"vs2017" = [GeneratorInfo]::new("Visual Studio 15 2017", $multiConfig, $false, "", @("-A", "Win32"));
"vs2017-xp" = [GeneratorInfo]::new("Visual Studio 15 2017", $multiConfig, $false, "", @("-A", "Win32", "-T", "v141_xp"));
"vs2017-x64" = [GeneratorInfo]::new("Visual Studio 17 2022", $multiConfig, $false, "", @("-A", "x64", "-T", "host=x64"));
"vs2015" = [GeneratorInfo]::new("Visual Studio 14 2015", $multiConfig, $false, "", @());
"mingw-make" = [GeneratorInfo]::new("MinGW Makefiles", $singleConfig, $false, "", @());
"mingw-ninja" = [GeneratorInfo]::new("Ninja", $singleConfig, $false, "", @())
@@ -411,6 +426,14 @@ if (($scriptPhases -contains "generate") -or ($scriptPhases -contains "build"))
{
$generateArgs += @("-DWITH_VIDEO:Bool=Off")
}
if ($noaio)
{
$generateArgs += @("-DWITH_ASYNC:Bool=Off")
}
if ($noaiointrinsics)
{
$generateArgs += @("-DDONT_USE_AIO_INTRINSICS:Bool=On")
}
if ($lto)
{
$generateArgs += @("-DRELEASE_LTO:Bool=On")

View File

@@ -7,23 +7,18 @@ showHelp()
cat <<EOF
Configure and build simh simulators on Linux and *nix-like platforms.
Subdirectories:
cmake/build-unix: Makefile-based build simulators
cmake/build-ninja: Ninja build-based simulators
Options:
--------
-Compile/Build options:
-----------------------
--clean (-x) Remove the build subdirectory
--generate (-g) Generate the build environment, don't compile/build
--cache '--generate' and show CMake's variable cache
--parallel (-p) Enable build parallelism (parallel builds)
--nonetwork Build simulators without network support
--novideo Build simulators without video support
--notest Do not execute 'ctest' test cases
--noinstall Do not install SIMH simulators.
--testonly Do not build, execute the 'ctest' test cases
--installonly Do not build, install the SIMH simulators
--flavor (-f) Specifies the build flavor. Valid flavors are:
--flavor (-f) [Required] Specifies the build flavor. Valid flavors are:
unix
ninja
xcode
@@ -46,6 +41,19 @@ Options:
--verbose Turn on verbose build output
SIMH feature control options:
-----------------------------
--nonetwork Build simulators without network support
--novideo Build simulators without video support
--no-aio Build simulators without AIO (asynchronous I/O). NOTE: This will
impact certain devices' functionality, notably networking.
--no-aio-intrinsics
Do not use compiler/platform intrinsics to implement AIO
functions (aka "lock-free" AIO), reverts to lock-based AIO
if threading libraries are detected.
Other options:
--------------
--help (-h) Print this help.
EOF
@@ -57,8 +65,8 @@ generateArgs=
buildArgs=
buildPostArgs=""
buildClean=
buildFlavor="Unix Makefiles"
buildSubdir=build-unix
buildFlavor=
buildSubdir=
buildConfig=Release
testArgs=
notest=no
@@ -152,6 +160,7 @@ fi
longopts=clean,help,flavor:,config:,nonetwork,novideo,notest,parallel,generate,testonly
longopts=${longopts},noinstall,installonly,verbose,target:,lto,debugWall,cppcheck,cpack_suffix:
longopts=${longopts},cache,no-aio,no-aio-intrinsics
ARGS=$(${getopt_prog} --longoptions $longopts --options xhf:c:pg -- "$@")
if [ $? -ne 0 ] ; then
@@ -219,6 +228,14 @@ while true; do
generateArgs="${generateArgs} -DWITH_VIDEO:Bool=Off"
shift
;;
--no-aio)
generateArgs="${generateArgs} -DWITH_ASYNC:Bool=Off"
shift
;;
--no-aio-intrinsics)
generateArgs="${generateArgs} -DDONT_USE_AIO_INTRINSICS:Bool=On"
shift
;;
--notest)
notest=yes
shift
@@ -251,6 +268,11 @@ while true; do
generateOnly=yes
shift
;;
--cache)
generateOnly=yes
generateArgs="${generateArgs} -LA"
shift
;;
--testonly)
testOnly=yes
shift
@@ -276,6 +298,14 @@ while true; do
esac
done
# Sanity check: buildSubdir should be set, unless the '-f' flag wasn't present.
if [ "x${buildSubdir}" = x ]; then
echo ""
echo "${scriptName}: Build flavor is NOT SET -- see the \"--flavor\"/\"-f\" flag in the help."
echo ""
showHelp
fi
## Determine the SIMH top-level source directory:
simhTopDir=$(${dirname} $(${realpath} $0))
while [ "x${simhTopDir}" != x -a ! -f "${simhTopDir}/CMakeLists.txt" ]; do
@@ -296,6 +326,7 @@ if [[ x"$buildClean" != x ]]; then
echo "${scriptName}: Cleaning ${buildSubdir}"
rm -rf ${buildSubdir}
fi
if [[ ! -d ${buildSubdir} ]]; then
mkdir ${buildSubdir}
fi

View File

@@ -20,7 +20,14 @@ get_target_property(_aliased ${_targ} ALIASED_TARGET)
set(fixed_libs)
get_property(orig_libs TARGET ${_targ} PROPERTY INTERFACE_LINK_LIBRARIES)
foreach(each_lib IN LISTS ${_lib})
string(STRIP ${each_lib} stripped_lib)
get_filename_component(stripped_lib "${each_lib}" DIRECTORY)
if (stripped_lib)
string(STRIP ${each_lib} stripped_lib)
file(TO_CMAKE_PATH "${stripped_lib}" stripped_lib)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
file(REAL_PATH "${stripped_lib}" stripped_lib)
endif ()
endif ()
list(APPEND fixed_libs ${stripped_lib})
message("** \"${each_lib}\" -> \"${stripped_lib}\"")
endforeach ()
@@ -33,7 +40,14 @@ endfunction ()
function (fix_libraries _lib)
set(fixed_libs)
foreach(each_lib IN LISTS ${_lib})
string(STRIP ${each_lib} stripped_lib)
get_filename_component(stripped_lib "${each_lib}" DIRECTORY)
if (stripped_lib)
string(STRIP ${stripped_lib} stripped_lib)
file(TO_CMAKE_PATH "${stripped_lib}" stripped_lib)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
file(REAL_PATH "${stripped_lib}" stripped_lib)
endif ()
endif ()
list(APPEND fixed_libs ${stripped_lib})
endforeach ()
set(${_lib} ${fixed_libs} PARENT_SCOPE)
@@ -48,6 +62,11 @@ IF (WITH_VIDEO)
foreach (lname ${FREETYPE_LIBRARIES} ${FREETYPE_LIBRARY} ${HARFBUZZ_LIBRARIES} ${HARFBUZZ_LIBRARY})
get_filename_component(dirname "${lname}" DIRECTORY)
if (dirname)
string(STRIP ${dirname} dirname)
file(TO_CMAKE_PATH "${dirname}" dirname)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
file(REAL_PATH "${dirname}" dirname)
endif ()
list(APPEND ldirs ${dirname})
endif()
endforeach ()
@@ -128,6 +147,8 @@ IF (WITH_VIDEO)
ENDIF ()
IF (PNG_FOUND)
target_compile_definitions(simh_video INTERFACE HAVE_LIBPNG)
if (TARGET PNG::PNG)
target_link_libraries(simh_video INTERFACE PNG::PNG)
list(APPEND VIDEO_PKG_STATUS "interface PNG")

View File

@@ -6,8 +6,6 @@
set(GIT_COMMIT_ID ${GIT_COMMIT_DEST}/.git-commit-id)
set(GIT_COMMIT_ID_H ${GIT_COMMIT_DEST}/.git-commit-id.h)
message(STATUS "Updating GIT commit ID")
find_program(GIT_COMMAND git)
if (GIT_COMMAND)
execute_process(COMMAND ${GIT_COMMAND} "log" "-1" "--pretty=%H"
@@ -32,15 +30,12 @@ if (GIT_COMMAND AND NOT (HAVE_GIT_COMMIT_HASH OR HAVE_GIT_COMMIT_TIME))
string(REPLACE "T" " " SIMH_GIT_COMMIT_TIME ${SIMH_GIT_COMMIT_TIME})
if (HAVE_UNCOMMITTED_CHANGES)
message(STATUS "Git detected uncommitted changes.")
## message(STATUS "Git detected uncommitted changes.")
string(APPEND SIMH_GIT_COMMIT_HASH "+uncommitted-changes")
else ()
message(STATUS "Clean working directory, no uncommitted changes.")
endif ()
message(STATUS "SIM_GIT_COMMIT_ID: ${SIMH_GIT_COMMIT_HASH}")
message(STATUS "SIM_GIT_COMMIT_TIME: ${SIMH_GIT_COMMIT_TIME}")
set(WRITE_GIT_COMMIT_FILES True)
if (EXISTS ${GIT_COMMIT_ID})
set(EXISTING_GIT_COMMIT_HASH)
@@ -55,12 +50,16 @@ if (GIT_COMMAND AND NOT (HAVE_GIT_COMMIT_HASH OR HAVE_GIT_COMMIT_TIME))
endforeach()
if (EXISTING_GIT_COMMIT_HASH STREQUAL SIMH_GIT_COMMIT_HASH AND
EXISTING_GIT_COMMIT_TIME STREQUAL SIMH_GIT_COMMIT_TIME)
message(STATUS "GIT hash and time match, not writing files.")
## message(STATUS "GIT hash and time match, not writing files.")
set(WRITE_GIT_COMMIT_FILES False)
endif ()
endif ()
if (WRITE_GIT_COMMIT_FILES)
message(STATUS "Updating GIT commit ID")
message(STATUS "SIM_GIT_COMMIT_ID: ${SIMH_GIT_COMMIT_HASH}")
message(STATUS "SIM_GIT_COMMIT_TIME: ${SIMH_GIT_COMMIT_TIME}")
message(STATUS "Writing ${GIT_COMMIT_ID}")
file(WRITE ${GIT_COMMIT_ID}
"SIM_GIT_COMMIT_ID ${SIMH_GIT_COMMIT_HASH}\n"
@@ -70,9 +69,9 @@ if (GIT_COMMAND AND NOT (HAVE_GIT_COMMIT_HASH OR HAVE_GIT_COMMIT_TIME))
file(WRITE ${GIT_COMMIT_ID_H}
"#define SIM_GIT_COMMIT_ID ${SIMH_GIT_COMMIT_HASH}\n"
"#define SIM_GIT_COMMIT_TIME ${SIMH_GIT_COMMIT_TIME}\n")
else ()
message(STATUS "No changes to ${GIT_COMMIT_ID}")
message(STATUS "No changes to ${GIT_COMMIT_ID_H}")
## else ()
## message(STATUS "No changes to ${GIT_COMMIT_ID}")
## message(STATUS "No changes to ${GIT_COMMIT_ID_H}")
endif ()
else ()
message(STATUS "SIM_GIT_COMMIT_ID not set.")

View File

@@ -7,6 +7,7 @@
#~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
add_library(thread_lib INTERFACE)
set(AIO_FLAGS)
if (WITH_ASYNC)
include(ExternalProject)
@@ -64,12 +65,12 @@ if (WITH_ASYNC)
set(THREADING_PKG_STATUS "Platform-detected threading support")
endif ()
if (THREADS_FOUND OR PTW_FOUND)
target_compile_definitions(thread_lib INTERFACE USE_READER_THREAD SIM_ASYNCH_IO)
if (THREADS_FOUND OR PTW_FOUND OR PThreads4W_FOUND)
set(AIO_FLAGS USE_READER_THREAD SIM_ASYNCH_IO)
else ()
target_compile_definitions(thread_lib INTERFACE DONT_USE_READER_THREAD)
set(AIO_FLAGS DONT_USE_READER_THREAD)
endif ()
else (WITH_ASYNC)
else()
target_compile_definitions(thread_lib INTERFACE DONT_USE_READER_THREAD)
set(THREADING_PKG_STATUS "asynchronous I/O disabled.")
endif (WITH_ASYNC)
endif()

View File

@@ -14,12 +14,14 @@ class SIMHBasicSimulator:
self.int64 = False
self.full64 = False
self.buildrom = buildrom
## self.has_display -> True if there is a specific display used by the simulator.
## self.has_display -> True if there is a specific display used by the simulator.
self.has_display = False
## self.uses_video -> True if USE_SIM_VIDEO appears in the simulator's preprocessor defn's.
## self.uses_video -> True if USE_SIM_VIDEO appears in the simulator's preprocessor defn's.
self.uses_video = False
## self.besm6_sdl_hack -> Only set/used by the BESM6 simulator.
self.besm6_sdl_hack = False
## self.uses_aio -> True if the simulator uses AIO
self.uses_aio = False
self.sources = []
self.defines = []
self.includes = []
@@ -47,27 +49,33 @@ class SIMHBasicSimulator:
if use_int64 or use_addr64:
self.int64 = use_int64 and not use_addr64
self.full64 = use_int64 and use_addr64
try:
self.defines.remove('USE_INT64')
except:
pass
try:
self.defines.remove('USE_ADDR64')
except:
pass
for defn in ['USE_INT64', 'USE_ADDR64']:
try:
self.defines.remove(defn)
except:
pass
## Video support:
self.has_display = any(map(lambda s: 'DISPLAY' in SPM.shallow_expand_vars(s, defs), self.sources))
if self.has_display:
try:
self.sources.remove('${DISPLAYL}')
self.sources.remove('$(DISPLAYL)')
except:
pass
for src in ['${DISPLAYL}', '$(DISPLAYL)']:
try:
self.sources.remove(src)
except:
pass
self.uses_video = 'USE_SIM_VIDEO' in self.defines or self.has_display
## AIO support:
self.uses_aio = 'SIM_ASYNCH_IO' in self.defines
if self.uses_aio:
for defn in ['SIM_ASYNCH_IO', 'USE_READER_THREAD']:
try:
self.defines.remove(defn)
except:
pass
def cleanup_defines(self):
"""Remove command line defines that aren't needed (because the CMake interface libraries
already define them.)
@@ -118,6 +126,8 @@ class SIMHBasicSimulator:
stream.write('\n' + indent4 + "FEATURE_DISPLAY")
if self.besm6_sdl_hack:
stream.write('\n' + indent4 + "BESM6_SDL_HACK")
if self.uses_aio:
stream.write('\n' + indent4 + "USES_AIO")
if self.buildrom:
stream.write('\n' + indent4 + "BUILDROMS")
stream.write('\n' + indent4 + "LABEL " + test_label)

View File

@@ -16,12 +16,12 @@ if (NOT DEFINED VCPKG_TARGET_TRIPLET)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
## Default to x64, unless otherwise directed:
set(SIMH_VCPKG_ARCH "x64")
if(CMAKE_GENERATOR_PLATFORM MATCHES "Win32")
if(CMAKE_GENERATOR_PLATFORM MATCHES "[Ww][Ii][Nn]32")
set(SIMH_VCPKG_ARCH "x86")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "ARM")
set(SIMH_VCPKG_ARCH "arm")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "ARM64")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "[Aa][Rr][Mm]64")
set(SIMH_VCPKG_ARCH "arm64")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "[Aa][Rr][Mm]")
set(SIMH_VCPKG_ARCH "arm")
endif()
if (MSVC OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")
@@ -79,8 +79,10 @@ message(STATUS "Executing deferred vcpkg toolchain initialization.\n"
## Initialize vcpkg after CMake detects the compiler and we've to set the platform triplet.
## VCPKG_INSTALL_OPTIONS are additional args to 'vcpkg install'. Don't need to see the
## usage instructions each time...
list(APPEND VCPKG_INSTALL_OPTIONS
"--no-print-usage"
)
if (NOT ("--no-print-usage" IN_LIST VCPKG_INSTALL_OPTIONS))
list(APPEND VCPKG_INSTALL_OPTIONS
"--no-print-usage"
)
endif ()
include(${SIMH_CMAKE_TOOLCHAIN_FILE})