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.
88 lines
3.6 KiB
CMake
88 lines
3.6 KiB
CMake
##+=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
|
|
## vcpkg setup for MSVC. MinGW builds should use 'pacman' to install
|
|
## required dependency libraries.
|
|
##-=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
|
|
|
|
if (NOT USING_VCPKG)
|
|
return ()
|
|
endif ()
|
|
|
|
if (NOT DEFINED VCPKG_TARGET_TRIPLET)
|
|
if (DEFINED ENV{VCPKG_DEFAULT_TRIPLET})
|
|
## User has a target triplet in mind, so use it.
|
|
set(VCPKG_TARGET_TRIPLET ENV{VCPKG_DEFAULT_TRIPLET})
|
|
else ()
|
|
## Set the target triplet:
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
## Default to x64, unless otherwise directed:
|
|
set(SIMH_VCPKG_ARCH "x64")
|
|
if(CMAKE_GENERATOR_PLATFORM MATCHES "[Ww][Ii][Nn]32")
|
|
set(SIMH_VCPKG_ARCH "x86")
|
|
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")
|
|
set(SIMH_VCPKG_PLATFORM "windows")
|
|
set(SIMH_VCPKG_RUNTIME "")
|
|
if (NOT BUILD_SHARED_DEPS)
|
|
set(SIMH_VCPKG_RUNTIME "static")
|
|
endif ()
|
|
elseif (MINGW OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
set(SIMH_VCPKG_PLATFORM "mingw")
|
|
set(SIMH_VCPKG_RUNTIME "dynamic")
|
|
endif ()
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
|
set(SIMH_VCPKG_ARCH "arm64")
|
|
else ()
|
|
set(SIMH_VCPKG_ARCH "x64")
|
|
endif ()
|
|
|
|
set (SIMH_VCPKG_PLATFORM "linux")
|
|
else ()
|
|
message(FATAL_ERROR "Could not determine VCPKG platform and system triplet."
|
|
"\n"
|
|
"(a) Are you sure that VCPKG is usable on this system? Check VCPKG_ROOT and ensure that"
|
|
"you have properly boostrapped VCPKG."
|
|
"\n"
|
|
"(b) If VCPKG is not usable on this system, unset the VCPKG_ROOT environment variable.")
|
|
endif ()
|
|
|
|
## Set the default triplet in the environment; older vcpkg installs on
|
|
## appveyor don't necessarily support the "--triplet" command line argument.
|
|
set(use_triplet "${SIMH_VCPKG_ARCH}-${SIMH_VCPKG_PLATFORM}")
|
|
if (SIMH_VCPKG_RUNTIME)
|
|
string(APPEND use_triplet "-${SIMH_VCPKG_RUNTIME}")
|
|
endif ()
|
|
|
|
set(VCPKG_TARGET_TRIPLET "${use_triplet}" CACHE STRING "Vcpkg target triplet (ex. x86-windows)" FORCE)
|
|
unset(use_triplet)
|
|
|
|
set(ENV{VCPKG_DEFAULT_TRIPLET} ${VCPKG_TARGET_TRIPLET})
|
|
endif ()
|
|
endif ()
|
|
|
|
## Set VCPKG_CRT_LINKAGE to pass down so that SIMH matches the triplet's link
|
|
## environment. Otherwise, the build will get a lot of "/NODEFAULTLIB" warnings.
|
|
set(VCPKG_CRT_LINKAGE "dynamic")
|
|
if (VCPKG_TARGET_TRIPLET MATCHES ".*-static")
|
|
set(VCPKG_CRT_LINKAGE "static")
|
|
endif ()
|
|
|
|
message(STATUS "Executing deferred vcpkg toolchain initialization.\n"
|
|
" .. VCPKG target triplet is ${VCPKG_TARGET_TRIPLET}\n"
|
|
" .. VCPKG_CRT_LINKAGE is ${VCPKG_CRT_LINKAGE}")
|
|
|
|
## 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...
|
|
if (NOT ("--no-print-usage" IN_LIST VCPKG_INSTALL_OPTIONS))
|
|
list(APPEND VCPKG_INSTALL_OPTIONS
|
|
"--no-print-usage"
|
|
)
|
|
endif ()
|
|
|
|
include(${SIMH_CMAKE_TOOLCHAIN_FILE})
|