diff --git a/.cmake/AddLinuxSystemLibs.cmake b/.cmake/AddLinuxSystemLibs.cmake new file mode 100644 index 000000000..859f8cef4 --- /dev/null +++ b/.cmake/AddLinuxSystemLibs.cmake @@ -0,0 +1,9 @@ +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + find_library(LIBDL NAMES dl) + list(APPEND DEFAULT_OS_SYSTEM_LIBS ${LIBDL}) +endif() + +if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + find_library(LIBPTHREAD NAMES libpthread.a) + list(APPEND DEFAULT_OS_SYSTEM_LIBS ${LIBPTHREAD}) +endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8350c2a5b..026ae4715 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,15 @@ include(ConfigureRpath) include(ConfigureStandalone) include(ConfigureBsdPaths) include(AddDarwinSystemLibs) +include(AddLinuxSystemLibs) include(ConfigureCurses) include(ConfigureTaglib) include(ConfigureCompilerFlags) message(STATUS "[vendor-link-directories] ${VENDOR_LINK_DIRECTORIES}") message(STATUS "[vendor-include-directories] ${VENDOR_INCLUDE_DIRECTORIES}") +message(STATUS "[os-system-libs] ${DEFAULT_OS_SYSTEM_LIBS}") -# our include directories include_directories( "${musikcube_SOURCE_DIR}/src" "${musikcube_SOURCE_DIR}/src/musikcore" @@ -36,7 +37,6 @@ include_directories( "${musikcube_SOURCE_DIR}/src/musikcube/cursespp" "${musikcube_SOURCE_DIR}/src/3rdparty/include") -# our library directories link_directories("${musikcube_SOURCE_DIR}/bin/plugins") find_package(Boost 1.55.0 REQUIRED system filesystem thread) @@ -44,23 +44,19 @@ include_directories(${Boost_INCLUDE_DIRS}) message(STATUS "[boost] libs: " ${Boost_LIBRARIES}) message(STATUS "[boost] includes: " ${Boost_INCLUDE_DIRS}) -find_library(LIBCURL NAMES curl PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) +if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(musikcube BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) + find_library(LIBCURL NAMES curl PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) +else() + find_library(LIBCURL NAMES curl) +endif() + find_library(LIBSSL NAMES ssl) find_library(LIBCRYPTO NAMES crypto) find_library(LIBZ NAMES z) set(musikcube_LINK_LIBS ${DEFAULT_OS_SYSTEM_LIBS} ${Boost_LIBRARIES} ${LIBCURL} ${LIBSSL} ${LIBCRYPTO} ${LIBZ}) -if (CMAKE_SYSTEM_NAME MATCHES "Linux") - find_library(LIBDL NAMES dl) - 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() - if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) message(STATUS "[build] libatomic required, adding to library list") diff --git a/script/bootstrap-static-vendors.sh b/script/bootstrap-static-vendors.sh index 5518919a1..0c2b1df31 100755 --- a/script/bootstrap-static-vendors.sh +++ b/script/bootstrap-static-vendors.sh @@ -200,19 +200,6 @@ make -j8 || exit $? make install cd .. -# -# libmp3lame -# - -wget https://phoenixnap.dl.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz -tar xvfz lame-3.100.tar.gz -cd lame-3.100/ -./configure --enable-shared --enable-static --prefix=`pwd`/output -make -j8 || exit $? -make install -mv output ../lame-bin -cd .. - # # libmicrohttpd # @@ -226,19 +213,6 @@ make install mv output ../libmicrohttpd-bin cd .. -# -# libz -# - -wget https://zlib.net/zlib-1.2.11.tar.gz -tar xvfz zlib-1.2.11.tar.gz -cd zlib-1.2.11 -./configure --prefix=`pwd`/output -make -j8 || exit $? -make install -mv output ../zlib-bin -cd .. - # # curl # diff --git a/src/plugins/ffmpegdecoder/CMakeLists.txt b/src/plugins/ffmpegdecoder/CMakeLists.txt index 39f462d9a..e9c358fd7 100644 --- a/src/plugins/ffmpegdecoder/CMakeLists.txt +++ b/src/plugins/ffmpegdecoder/CMakeLists.txt @@ -3,9 +3,9 @@ set (ffmpegdecoder_SOURCES FfmpegDecoder.cpp) add_library(ffmpegdecoder SHARED ${ffmpegdecoder_SOURCES}) -target_include_directories(ffmpegdecoder PRIVATE BEFORE ${VENDOR_INCLUDE_DIRECTORIES}) if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(ffmpegdecoder PRIVATE BEFORE ${VENDOR_INCLUDE_DIRECTORIES}) find_library(AVCODEC NAMES avcodec-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) find_library(AVUTIL NAMES avutil-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) find_library(AVFORMAT NAMES avformat-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) diff --git a/src/plugins/server/CMakeLists.txt b/src/plugins/server/CMakeLists.txt index 4ce28d792..bef8937fa 100644 --- a/src/plugins/server/CMakeLists.txt +++ b/src/plugins/server/CMakeLists.txt @@ -10,13 +10,10 @@ set (server_SOURCES add_library(server SHARED ${server_SOURCES}) -target_include_directories( - server - BEFORE PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include" - ${VENDOR_INCLUDE_DIRECTORIES}) +target_include_directories(server BEFORE PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include") if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(server BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) find_library(LIBMICROHTTPD NAMES libmicrohttpd.a PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE) else() if (APPLE) diff --git a/src/plugins/stockencoders/CMakeLists.txt b/src/plugins/stockencoders/CMakeLists.txt index 581be90a9..175ea94ea 100644 --- a/src/plugins/stockencoders/CMakeLists.txt +++ b/src/plugins/stockencoders/CMakeLists.txt @@ -4,9 +4,9 @@ set (stockencoders_SOURCES FfmpegEncoder.cpp) add_library(stockencoders SHARED ${stockencoders_SOURCES}) -target_include_directories(stockencoders BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) if (${BUILD_STANDALONE} MATCHES "true") + target_include_directories(stockencoders BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES}) find_library(AVCODEC NAMES avcodec-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) find_library(AVUTIL NAMES avutil-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH) find_library(AVFORMAT NAMES avformat-musikcube PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH)