Files
gui/ssh/CMakeLists.txt
Neo-DesktopandClaude Opus 5.5 35d66c85e9 Build the app for Haiku (x86_64)
The Windows app now builds for Haiku over the new Haiku backend of
clang-retro MFC (clang-retro/mfc#176), cross-built on Linux with D-Modem's
Haiku toolchain file and sysroot script.

- cmake/haiku.cmake: the toolchain file. It includes D-Modem's and
  keeps the CMAKE_FIND_ROOT_PATH of the command line, so that libssh
  finds the bundled mbedTLS.
- winport/CMakeLists.txt: the Haiku target and its libraries (libbe,
  libdevice, libnetwork, libbsd).
- ssh/: libssh links libnetwork and libbsd on Haiku, has getaddrinfo,
  and skips the termios values that Haiku does not have.
- Look for a modem (windows/src/ports.cpp, ports_haiku.cpp): lists
  /dev/ports, names the usbN ports from the USB Kit, finds the CDC-ACM
  modems, and tells that Haiku has no driver for the MultiTech
  MT9234MU.
- CI: the winport-haiku job builds the app and uploads
  dmodem-win32-haiku-x86_64.tar.gz; the nightly release takes it.
- docs/haiku.md, and short notes in the README, building.md and
  download.md.

Tested on Haiku R1/beta6 in QEMU: the menus, the pages, the dialogs,
modal dialogs, the keyboard, moving the window, and Look for a modem
with the computer's serial port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTJUdomcnCN8okhJSr
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-28 20:11:33 +00:00

58 lines
2.1 KiB
CMake

# libdmodemssh: D-Modem's SSH client (dmodemssh.h), on libssh 0.11.
# The system's libssh when it is 0.11 or later (and
# -DDMODEM_SSH_BUNDLED=OFF), else libssh and mbedTLS built here from
# their release tarballs: always for the app on Windows and macOS, which
# ships no libraries of the system's.
if(WIN32 OR APPLE)
set(_bundled ON)
else()
set(_bundled AUTO)
endif()
set(DMODEM_SSH_BUNDLED ${_bundled} CACHE STRING "Build libssh and mbedTLS from source (ON, OFF, AUTO: when the system's is older than 0.11)")
if(NOT DMODEM_SSH_BUNDLED STREQUAL "ON")
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(LIBSSH IMPORTED_TARGET libssh>=0.11)
endif()
endif()
if(LIBSSH_FOUND)
add_library(dmodem_libssh INTERFACE)
target_link_libraries(dmodem_libssh INTERFACE PkgConfig::LIBSSH)
elseif(DMODEM_SSH_BUNDLED STREQUAL "OFF")
message(FATAL_ERROR "libssh 0.11 or later not found (or -DDMODEM_SSH_BUNDLED=AUTO)")
else()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/BundledLibssh.cmake)
endif()
add_library(dmodemssh STATIC src/dmodemssh.c src/ppk.c src/agent.c)
# (the Windows 95 build, and the Windows 98 SE and ME builds of the app
# with the modem built in: a gai_strerrorA with no Unicode call)
if(CLANG_RETRO_CONFIG MATCHES "picolibc|^win98|^winme")
target_sources(dmodemssh PRIVATE src/gai_strerror.c)
endif()
target_include_directories(dmodemssh PUBLIC include)
target_link_libraries(dmodemssh PUBLIC dmodem_libssh)
if(WIN32)
target_link_libraries(dmodemssh PUBLIC ws2_32 user32 advapi32)
elseif(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(dmodemssh PUBLIC Threads::Threads)
# Haiku has the sockets in libnetwork and strsep (for libssh) in
# libbsd, not in libroot
if(HAIKU)
target_link_libraries(dmodemssh PUBLIC network bsd)
endif()
endif()
if(MSVC)
target_compile_options(dmodemssh PRIVATE /W4 /wd4996)
else()
target_compile_options(dmodemssh PRIVATE -Wall -Wextra -Wshadow)
endif()
add_executable(dmodemssh_test test/dmodemssh_test.c)
target_link_libraries(dmodemssh_test PRIVATE dmodemssh)
# (Argon2 is tested too: ppk.h)
target_include_directories(dmodemssh_test PRIVATE src)
add_test(NAME dmodemssh COMMAND dmodemssh_test)