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) set(Boost_USE_STATIC_LIBS ON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/ffmpeg-bin/include") 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") 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") 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") 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") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/include")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib")
list( list(
APPEND APPEND

View File

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

View File

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