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 <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-10-17 09:21:54 +01:00
parent fff8fe91a9
commit 51b6604142
4 changed files with 18 additions and 4 deletions

View file

@ -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

View file

@ -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})

View file

@ -3,7 +3,7 @@
#include "StdAfx.h"
#include "Memory.h"
#include "Debugger/DebugDefs.h"
#include "Debugger/Debugger_Types.h"
#include "viewbuffer.h"

View file

@ -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"