From 51b6604142accab4799661e505917b187811a172 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sun, 17 Oct 2021 09:21:54 +0100 Subject: [PATCH] Allow code to compile as static. To avoid the link-time interface, which does not work with Apple's linker. Signed-off-by: Andrea Odetti --- source/CMakeLists.txt | 15 ++++++++++++++- source/frontends/common2/CMakeLists.txt | 3 ++- source/frontends/qt/memorycontainer.cpp | 2 +- source/frontends/sdl/imgui/sdlsettings.cpp | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 54bc1a32..32d967e9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -2,6 +2,7 @@ include(FindPkgConfig) pkg_check_modules(YAML REQUIRED yaml-0.1) pkg_check_modules(MINIZIP REQUIRED minizip) +pkg_check_modules(ZLIB REQUIRED zlib) pkg_check_modules(SLIRP slirp) if ("${SLIRP_FOUND}" STREQUAL "") @@ -221,7 +222,16 @@ set(HEADER_FILES Z80VICE/daa.h ) -add_library(appleii SHARED +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +# Applle's linker does not like the link-time interface of libappleii +# we need link everything at once + message("Mac OS X detected, libappleii as static library") + set(LIBRARY_TYPE "STATIC") +else() + set(LIBRARY_TYPE "SHARED") +endif() + +add_library(appleii "${LIBRARY_TYPE}" ${SOURCE_FILES} ${HEADER_FILES} ) @@ -232,6 +242,7 @@ target_include_directories(appleii PRIVATE ${PCAP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${SLIRP_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} Debugger ) @@ -245,6 +256,7 @@ target_link_libraries(appleii PRIVATE ${MINIZIP_LIBRARIES} ${PCAP_LIBRARIES} ${SLIRP_LIBRARIES} + ${ZLIB_LIBRARIES} ) target_link_directories(appleii PRIVATE @@ -252,6 +264,7 @@ target_link_directories(appleii PRIVATE ${MINIZIP_LIBRARY_DIR} ${PCAP_LIBRARY_DIR} ${SLIRP_LIBRARY_DIR} + ${ZLIB_LIBRARY_DIR} ) target_compile_options(appleii PUBLIC diff --git a/source/frontends/common2/CMakeLists.txt b/source/frontends/common2/CMakeLists.txt index ac55599d..f55bd165 100644 --- a/source/frontends/common2/CMakeLists.txt +++ b/source/frontends/common2/CMakeLists.txt @@ -34,8 +34,9 @@ target_include_directories(common2 PRIVATE ${Boost_INCLUDE_DIRS} ) -target_link_libraries(common2 PUBLIC +target_link_libraries(common2 PRIVATE Boost::program_options + appleii ) file(RELATIVE_PATH ROOT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/source/frontends/qt/memorycontainer.cpp b/source/frontends/qt/memorycontainer.cpp index 4087ab4e..ac459ae4 100644 --- a/source/frontends/qt/memorycontainer.cpp +++ b/source/frontends/qt/memorycontainer.cpp @@ -3,7 +3,7 @@ #include "StdAfx.h" #include "Memory.h" -#include "Debugger/DebugDefs.h" +#include "Debugger/Debugger_Types.h" #include "viewbuffer.h" diff --git a/source/frontends/sdl/imgui/sdlsettings.cpp b/source/frontends/sdl/imgui/sdlsettings.cpp index 1d4397b8..edc50c0e 100644 --- a/source/frontends/sdl/imgui/sdlsettings.cpp +++ b/source/frontends/sdl/imgui/sdlsettings.cpp @@ -19,7 +19,7 @@ #include "Utilities.h" #include "Memory.h" -#include "Debugger/DebugDefs.h" +#include "Debugger/Debugger_Types.h" #include "Tfe/tfe.h" #include "Tfe/tfesupp.h"