Flapping back in the macOS direction

This commit is contained in:
casey langen 2022-02-08 00:20:55 -08:00
parent c643b2e108
commit 44b4eabe78
13 changed files with 94 additions and 63 deletions

View File

@ -0,0 +1,9 @@
if (APPLE)
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
find_library(SYSTEM_CONFIGURATION_LIBRARY SystemConfiguration)
list(
APPEND
DEFAULT_OS_SYSTEM_LIBS
${CORE_FOUNDATION_LIBRARY}
${SYSTEM_CONFIGURATION_LIBRARY})
endif()

View File

@ -5,7 +5,7 @@ function(ensure_library_exists libname)
find_library( find_library(
__TEMP_ENSURE_LIBRARY __TEMP_ENSURE_LIBRARY
NAMES ${libname} NAMES ${libname}
PATHS ${CURRENT_LINK_DIR}) PATHS ${CURRENT_LINK_DIR} ${VENDOR_LINK_DIRECTORIES})
if(NOT __TEMP_ENSURE_LIBRARY) if(NOT __TEMP_ENSURE_LIBRARY)
#message(STATUS "[check-dependencies] ${libname} not found") #message(STATUS "[check-dependencies] ${libname} not found")
else() else()

View File

@ -8,10 +8,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE BSD_PATH_PREFIX) OUTPUT_VARIABLE BSD_PATH_PREFIX)
endif() endif()
message(STATUS "resolved BSD_PATH_PREFIX to: '${BSD_PATH_PREFIX}'") message(STATUS "[configure-bsd-paths] resolved BSD_PATH_PREFIX to: '${BSD_PATH_PREFIX}'")
link_directories ("${BSD_PATH_PREFIX}/lib") list(
link_directories ("${BSD_PATH_PREFIX}/opt/openssl/lib") APPEND
link_directories ("${BSD_PATH_PREFIX}/opt/ncurses/lib") VENDOR_LINK_DIRECTORIES
"${BSD_PATH_PREFIX}/lib"
"${BSD_PATH_PREFIX}/opt/openssl/lib"
"${BSD_PATH_PREFIX}/opt/ncurses/lib")
include_directories("${BSD_PATH_PREFIX}/include") include_directories("${BSD_PATH_PREFIX}/include")
include_directories("${BSD_PATH_PREFIX}/opt/openssl/include") include_directories("${BSD_PATH_PREFIX}/opt/openssl/include")
include_directories("${BSD_PATH_PREFIX}/opt/ncurses/include") include_directories("${BSD_PATH_PREFIX}/opt/ncurses/include")

View File

@ -5,8 +5,8 @@ if (${LINK_STATICALLY} MATCHES "true")
set(BOOST_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost-bin/include") set(BOOST_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost-bin/include")
set(BOOST_LIBRARYDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost-bin/lib") set(BOOST_LIBRARYDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost-bin/lib")
set(Boost_NO_SYSTEM_PATHS ON) set(Boost_NO_SYSTEM_PATHS ON)
#set(Boost_USE_STATIC_LIBS ON)
set(Boost_NO_BOOST_CMAKE ON) set(Boost_NO_BOOST_CMAKE 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") link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/ffmpeg-bin/lib")
@ -22,6 +22,16 @@ if (${LINK_STATICALLY} MATCHES "true")
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") link_directories("${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib")
list(
APPEND
VENDOR_LINK_DIRECTORIES
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/ffmpeg-bin/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/lame-bin/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/libmicrohttpd-bin/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/zlib-bin/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/curl-bin/lib")
else() else()
message(STATUS "[static linking] static linking NOT enabled!") message(STATUS "[static linking] static linking NOT enabled!")
endif() endif()

View File

@ -17,13 +17,16 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
include(CMakeToolsHelpers OPTIONAL) include(CMakeToolsHelpers OPTIONAL)
include(CheckDependencies) include(CheckDependencies)
include(CheckAtomic) include(CheckAtomic)
include(ConfigureCurses)
include(ConfigureRpath) include(ConfigureRpath)
include(ConfigureTaglib) include(AddDarwinSystemLibs)
include(ConfigureBsdPaths) include(ConfigureBsdPaths)
include(ConfigureCurses)
include(ConfigureTaglib)
include(ConfigureCompilerFlags) include(ConfigureCompilerFlags)
include(ConfigureStaticLinking) include(ConfigureStaticLinking)
message(STATUS "[vendor-link-directories] ${VENDOR_LINK_DIRECTORIES}")
# our include directories # our include directories
include_directories( include_directories(
"${musikcube_SOURCE_DIR}/src" "${musikcube_SOURCE_DIR}/src"
@ -35,27 +38,26 @@ include_directories(
# our library directories # our library directories
link_directories("${musikcube_SOURCE_DIR}/bin/plugins") link_directories("${musikcube_SOURCE_DIR}/bin/plugins")
find_package(Boost 1.55.0 REQUIRED filesystem thread) find_package(Boost 1.55.0 REQUIRED system filesystem thread)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
message(STATUS "[boost] libs: " ${Boost_LIBRARIES}) message(STATUS "[boost] libs: " ${Boost_LIBRARIES})
message(STATUS "[boost] includes: " ${Boost_INCLUDE_DIRS}) message(STATUS "[boost] includes: " ${Boost_INCLUDE_DIRS})
ensure_library_exists(curl) find_library(LIBCURL NAMES libcurl.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(pthread) find_library(LIBSSL NAMES libssl.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(ssl) find_library(LIBCRYPTO NAMES libcrypto.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(crypto) find_library(LIBZ NAMES libz.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(z)
find_library(LIBCURL NAMES libcurl.a)
find_library(LIBPTHREAD NAMES libpthread.a)
find_library(LIBSSL NAMES libssl.a)
find_library(LIBCRYPTO NAMES libcrypto.a)
find_library(LIBZ NAMES libz.a)
set(COMMON_LINK_LIBS ${Boost_LIBRARIES} ${LIBCURL} ${LIBPTHREAD} ${LIBSSL} ${LIBCRYPTO} ${LIBZ}) set(musikcube_LINK_LIBS ${DEFAULT_OS_SYSTEM_LIBS} ${Boost_LIBRARIES} ${LIBCURL} ${LIBSSL} ${LIBCRYPTO} ${LIBZ})
if (CMAKE_SYSTEM_NAME MATCHES "Linux") if (CMAKE_SYSTEM_NAME MATCHES "Linux")
find_library(LIBDL NAMES dl) find_library(LIBDL NAMES dl)
set (musikcube_LINK_LIBS ${COMMON_LINK_LIBS} ${LIBDL}) set (musikcube_LINK_LIBS ${musikcube_LINK_LIBS} ${LIBDL})
endif()
if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library(LIBPTHREAD NAMES libpthread.a)
set (musikcube_LINK_LIBS ${musikcube_LINK_LIBS} ${LIBPTHREAD})
endif() endif()
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
@ -65,7 +67,7 @@ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
endif() endif()
endif() 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)
@ -73,7 +75,7 @@ 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

@ -4,6 +4,11 @@ rm -rf vendor
mkdir vendor mkdir vendor
cd vendor cd vendor
PLATFORM=$(uname)
if [[ "$PLATFORM" == 'Darwin' ]]; then
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/opt/homebrew/opt/openssl/lib/pkgconfig/"
fi
export CFLAGS="-fPIC" export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC" export CXXFLAGS="-fPIC"
@ -11,11 +16,12 @@ export CXXFLAGS="-fPIC"
# boost # boost
# #
wget https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2 wget https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_76_0.tar.bz2
tar xvfj boost_1_78_0.tar.bz2 tar xvfj boost_1_76_0.tar.bz2
cd boost_1_78_0/ cd boost_1_76_0/
./bootstrap.sh ./bootstrap.sh
./b2 -d+2 cxxflags="-fPIC" --prefix=../boost-bin/ install ./b2 headers
./b2 -d -j8 -sNO_LZMA=1 -sNO_ZSTD=1 threading=multi link=shared,static cxxflags="-fPIC -std=c++14 -stdlib=libc++" --prefix=../boost-bin/ install || exit $?
cd .. cd ..
# #
@ -190,7 +196,7 @@ cd ffmpeg-5.0
--enable-encoder=wmav2 \ --enable-encoder=wmav2 \
--disable-pthreads \ --disable-pthreads \
--build-suffix=-musikcube || exit $? --build-suffix=-musikcube || exit $?
make || exit $? make -j8 || exit $?
make install make install
cd .. cd ..
@ -202,7 +208,7 @@ wget https://phoenixnap.dl.sourceforge.net/project/lame/lame/3.100/lame-3.100.ta
tar xvfz lame-3.100.tar.gz tar xvfz lame-3.100.tar.gz
cd lame-3.100/ cd lame-3.100/
./configure --enable-shared --enable-static --prefix=`pwd`/output ./configure --enable-shared --enable-static --prefix=`pwd`/output
make make -j8 || exit $?
make install make install
mv output ../lame-bin mv output ../lame-bin
cd .. cd ..
@ -215,7 +221,7 @@ wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.75.tar.gz
tar xvfz libmicrohttpd-0.9.75.tar.gz tar xvfz libmicrohttpd-0.9.75.tar.gz
cd libmicrohttpd-0.9.75 cd libmicrohttpd-0.9.75
./configure --enable-shared --enable-static --with-pic --enable-https=no --disable-curl --prefix=`pwd`/output ./configure --enable-shared --enable-static --with-pic --enable-https=no --disable-curl --prefix=`pwd`/output
make make -j8 || exit $?
make install make install
mv output ../libmicrohttpd-bin mv output ../libmicrohttpd-bin
cd .. cd ..
@ -228,7 +234,7 @@ wget https://zlib.net/zlib-1.2.11.tar.gz
tar xvfz zlib-1.2.11.tar.gz tar xvfz zlib-1.2.11.tar.gz
cd zlib-1.2.11 cd zlib-1.2.11
./configure --prefix=`pwd`/output ./configure --prefix=`pwd`/output
make make -j8 || exit $?
make install make install
mv output ../zlib-bin mv output ../zlib-bin
cd .. cd ..
@ -265,10 +271,12 @@ cd curl-7.81.0
--disable-imap \ --disable-imap \
--disable-mqtt \ --disable-mqtt \
--disable-dict \ --disable-dict \
--disable-ldap \
--without-brotli \ --without-brotli \
--without-libidn2 \ --without-libidn2 \
--without-nghttp2 \
--prefix=`pwd`/output --prefix=`pwd`/output
make make -j8 || exit $?
make install make install
mv output ../curl-bin mv output ../curl-bin
cd .. cd ..

View File

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
PLATFORM=$(uname)
if [[ "$PLATFORM" == 'Darwin' ]]; then
echo "[stage-static-vendor-libraries] no-op on darwin. not required."
exit 0
fi
mkdir -p bin/plugins/ mkdir -p bin/plugins/
cp vendor/boost-bin/lib/libboost_filesystem.so.1.78.0 ./bin/ cp vendor/boost-bin/lib/libboost_filesystem.so.1.78.0 ./bin/
cp vendor/boost-bin/lib/libboost_thread.so.1.78.0 ./bin/ cp vendor/boost-bin/lib/libboost_thread.so.1.78.0 ./bin/

View File

@ -80,14 +80,9 @@ include_directories(
) )
add_definitions(-DMCSDK_DEFINE_EXPORTS) add_definitions(-DMCSDK_DEFINE_EXPORTS)
add_library(musikcore SHARED ${CORE_SOURCES}) add_library(musikcore SHARED ${CORE_SOURCES})
set_target_properties(musikcore PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${musikcube_SOURCE_DIR}/bin)
set_target_properties(musikcore PROPERTIES target_link_libraries(musikcore ${musikcube_LINK_LIBS})
LIBRARY_OUTPUT_DIRECTORY ${musikcube_SOURCE_DIR}/bin)
target_link_libraries(musikcore)
target_link_libraries(musikcore ${Boost_LIBRARIES} ${musikcube_LINK_LIBS})
if (ENABLE_PCH MATCHES "true") if (ENABLE_PCH MATCHES "true")
message(STATUS "[musikcore] enabling precompiled headers") message(STATUS "[musikcore] enabling precompiled headers")

View File

@ -84,12 +84,12 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_library( find_library(
NCURSESWLIB NCURSESWLIB
NAMES libncursesw.a ncursesw NAMES libncursesw.a ncursesw
PATHS "/usr/local/opt/ncurses/lib/") PATHS ${VENDOR_LINK_DIRECTORIES})
find_library( find_library(
PANELWLIB PANELWLIB
NAMES libpanelw.a panelw NAMES libpanelw.a panelw
PATHS "/usr/local/opt/ncurses/lib/") PATHS ${VENDOR_LINK_DIRECTORIES})
message(STATUS "[musikcube] using libncursesw at " ${NCURSESWLIB}) message(STATUS "[musikcube] using libncursesw at " ${NCURSESWLIB})
message(STATUS "[musikcube] using libpanelw at " ${PANELWLIB}) message(STATUS "[musikcube] using libpanelw at " ${PANELWLIB})

View File

@ -3,15 +3,15 @@ set (coreaudioout_SOURCES
CoreAudioOut.cpp CoreAudioOut.cpp
) )
IF(APPLE) if (APPLE)
FIND_LIBRARY(CORE_FOUNDATION_LIBRARY CoreFoundation) find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
FIND_LIBRARY(CORE_AUDIO_LIBRARY CoreAudio) find_library(CORE_AUDIO_LIBRARY CoreAudio)
FIND_LIBRARY(AUDIO_TOOLBOX_LIBRARY AudioToolbox) find_library(AUDIO_TOOLBOX_LIBRARY AudioToolbox)
MARK_AS_ADVANCED (CORE_FOUNDATION_LIBRARY mark_as_advanced(CORE_FOUNDATION_LIBRARY
CORE_AUDIO_LIBRARY CORE_AUDIO_LIBRARY
AUDIO_TOOLBOX_LIBRARY) AUDIO_TOOLBOX_LIBRARY)
SET(FRAMEWORK_LIBS ${CORE_FOUNDATION_LIBRARY} ${CORE_AUDIO_LIBRARY} ${AUDIO_TOOLBOX_LIBRARY}) set(FRAMEWORK_LIBS ${CORE_FOUNDATION_LIBRARY} ${CORE_AUDIO_LIBRARY} ${AUDIO_TOOLBOX_LIBRARY})
ENDIF (APPLE)
add_library(coreaudioout SHARED ${coreaudioout_SOURCES}) add_library(coreaudioout SHARED ${coreaudioout_SOURCES})
target_link_libraries(coreaudioout ${FRAMEWORK_LIBS}) target_link_libraries(coreaudioout ${FRAMEWORK_LIBS})
endif (APPLE)

View File

@ -6,11 +6,11 @@ set (ffmpegdecoder_SOURCES
add_library(ffmpegdecoder SHARED ${ffmpegdecoder_SOURCES}) add_library(ffmpegdecoder SHARED ${ffmpegdecoder_SOURCES})
if (${LINK_STATICALLY} MATCHES "true") if (${LINK_STATICALLY} MATCHES "true")
ensure_library_exists(avcodec-musikcube) find_library(AVCODEC NAMES libavcodec-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(avutil-musikcube) find_library(AVUTIL NAMES libavutil-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(avformat-musikcube) find_library(AVFORMAT NAMES libavformat-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(swresample-musikcube) find_library(SWRESAMPLE NAMES libswresample-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
target_link_libraries(ffmpegdecoder avcodec-musikcube avutil-musikcube avformat-musikcube swresample-musikcube) target_link_libraries(ffmpegdecoder ${AVCODEC} ${AVUTIL} ${AVFORMAT} ${SWRESAMPLE})
else() else()
# fedora (and probably other RPM-based distros) put ffmpeg includes here... # fedora (and probably other RPM-based distros) put ffmpeg includes here...
include_directories("/usr/include/ffmpeg") include_directories("/usr/include/ffmpeg")
@ -21,5 +21,3 @@ else()
ensure_library_exists(swresample) ensure_library_exists(swresample)
target_link_libraries(ffmpegdecoder avcodec avutil avformat swresample) target_link_libraries(ffmpegdecoder avcodec avutil avformat swresample)
endif() endif()
#target_link_libraries(ffmpegdecoder ${musikcube_LINK_LIBS})

View File

@ -6,4 +6,4 @@ set (httpdatastream_SOURCES
) )
add_library(httpdatastream SHARED ${httpdatastream_SOURCES}) add_library(httpdatastream SHARED ${httpdatastream_SOURCES})
target_link_libraries(httpdatastream) target_link_libraries(httpdatastream ${musikcube_LINK_LIBS})

View File

@ -9,11 +9,11 @@ add_library(stockencoders SHARED ${stockencoders_SOURCES})
ensure_library_exists(mp3lame) ensure_library_exists(mp3lame)
if (${LINK_STATICALLY} MATCHES "true") if (${LINK_STATICALLY} MATCHES "true")
ensure_library_exists(avcodec-musikcube) find_library(AVCODEC NAMES libavcodec-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(avutil-musikcube) find_library(AVUTIL NAMES libavutil-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(avformat-musikcube) find_library(AVFORMAT NAMES libavformat-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
ensure_library_exists(swresample-musikcube) find_library(SWRESAMPLE NAMES libswresample-musikcube.a PATHS ${VENDOR_LINK_DIRECTORIES})
target_link_libraries(stockencoders avcodec-musikcube avutil-musikcube avformat-musikcube swresample-musikcube) target_link_libraries(stockencoders ${AVCODEC} ${AVUTIL} ${AVFORMAT} ${SWRESAMPLE})
else() else()
# fedora (and probably other RPM-based distros) put ffmpeg includes here... # fedora (and probably other RPM-based distros) put ffmpeg includes here...
include_directories("/usr/include/ffmpeg") include_directories("/usr/include/ffmpeg")