From 38a7c3f0340582f8fb2ca7f0f829e1a255b70fad Mon Sep 17 00:00:00 2001 From: "B. Scott Michel" Date: Mon, 4 Dec 2023 11:33:00 -0800 Subject: [PATCH] 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. 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. --- .travis/deps.sh | 16 +++++++++++++++- cmake/cmake-builder.sh | 19 ++++++++++++------- cmake/dep-link.cmake | 15 +++++++++++++++ cmake/pthreads-dep.cmake | 2 +- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/.travis/deps.sh b/.travis/deps.sh index fb18ddf77..f9cf1251c 100755 --- a/.travis/deps.sh +++ b/.travis/deps.sh @@ -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" ;; *) diff --git a/cmake/cmake-builder.sh b/cmake/cmake-builder.sh index 0ea8d6eef..2b8473c6e 100755 --- a/cmake/cmake-builder.sh +++ b/cmake/cmake-builder.sh @@ -7,10 +7,6 @@ showHelp() cat < \"${stripped_lib}\"") endforeach () @@ -34,6 +38,10 @@ function (fix_libraries _lib) set(fixed_libs) foreach(each_lib IN LISTS ${_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 () list(APPEND fixed_libs ${stripped_lib}) endforeach () set(${_lib} ${fixed_libs} PARENT_SCOPE) @@ -48,6 +56,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 +141,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") diff --git a/cmake/pthreads-dep.cmake b/cmake/pthreads-dep.cmake index 1ea0723a6..14978eac2 100644 --- a/cmake/pthreads-dep.cmake +++ b/cmake/pthreads-dep.cmake @@ -64,7 +64,7 @@ if (WITH_ASYNC) set(THREADING_PKG_STATUS "Platform-detected threading support") endif () - if (THREADS_FOUND OR PTW_FOUND) + if (THREADS_FOUND OR PTW_FOUND OR PThreads4W_FOUND) target_compile_definitions(thread_lib INTERFACE USE_READER_THREAD SIM_ASYNCH_IO) else () target_compile_definitions(thread_lib INTERFACE DONT_USE_READER_THREAD)