static linking working on darwin?

This commit is contained in:
casey langen 2022-02-08 01:22:00 -08:00
parent 44b4eabe78
commit deed24b1c2
3 changed files with 17 additions and 21 deletions

View File

@ -9,19 +9,10 @@ if (${LINK_STATICALLY} MATCHES "true")
set(Boost_USE_STATIC_LIBS ON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/ffmpeg-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/ffmpeg-bin/lib")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/lame-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/lame-bin/lib")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/libmicrohttpd-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/libmicrohttpd-bin/lib")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib-bin/lib")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib")
list(
APPEND

View File

@ -18,12 +18,12 @@ include(CMakeToolsHelpers OPTIONAL)
include(CheckDependencies)
include(CheckAtomic)
include(ConfigureRpath)
include(AddDarwinSystemLibs)
include(ConfigureStaticPaths) # highest priority lib paths
include(ConfigureBsdPaths)
include(AddDarwinSystemLibs)
include(ConfigureCurses)
include(ConfigureTaglib)
include(ConfigureCompilerFlags)
include(ConfigureStaticLinking)
message(STATUS "[vendor-link-directories] ${VENDOR_LINK_DIRECTORIES}")
@ -70,12 +70,12 @@ endif()
message(STATUS "[build] musikcube_LINK_LIBS: " ${musikcube_LINK_LIBS})
add_subdirectory(src/musikcore)
#add_subdirectory(src/core_c_demo)
add_subdirectory(src/core_c_demo)
add_subdirectory(src/musikcube)
add_subdirectory(src/musikcubed)
add_subdirectory(src/plugins/taglib_plugin)
add_subdirectory(src/plugins/nullout)
#add_subdirectory(src/plugins/server)
add_subdirectory(src/plugins/server)
add_subdirectory(src/plugins/httpdatastream)
add_subdirectory(src/plugins/stockencoders)
add_subdirectory(src/plugins/supereqdsp)

View File

@ -16,14 +16,19 @@ include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include")
include_directories(${Boost_INCLUDE_DIRS})
if (${LINK_STATICALLY} MATCHES "true")
find_library(LIBMICROHTTPD NAMES libmicrohttpd.a)
find_library(LIBZ NAMES libz.a)
target_link_libraries(server ${server_LINK_LIBS} ${LIBZ} ${LIBMICROHTTPD})
# unclear why NO_DEFAULT_PATH NO_CACHE is required; we want to use our vendor'd version,
# but without NO_CACHE we always get the brew one. other deps are fine.
find_library(LIBMICROHTTPD NAMES libmicrohttpd.a PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE)
find_library(LIBZ NAMES libz.a PATHS ${VENDOR_LINK_DIRECTORIES})
else()
ensure_library_exists(microhttpd)
set(EXTRA_LIBS "")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(EXTRA_LIBS "gnutls")
if (APPLE)
find_library(LIBGNUTLS NAMES gnuatls)
set(EXTRA_LIBS "${LIBGNUTLS}")
endif()
target_link_libraries(server ${server_LINK_LIBS} microhttpd z ${EXTRA_LIBS})
find_library(LIBMICROHTTPD NAMES microhttpd)
find_library(LIBZ NAMES z)
endif()
message(STATUS "[server] using " ${LIBMICROHTTPD} ", " ${LIBZ})
target_link_libraries(server ${server_LINK_LIBS} ${LIBZ} ${LIBMICROHTTPD} ${EXTRA_LIBS})