Initial tests to statically link against most third party libraries to make

redistribution simpler.
This commit is contained in:
Casey Langen 2017-02-23 23:45:25 -08:00
parent d9be580620
commit bab43dd667
4 changed files with 35 additions and 4 deletions

View File

@ -1,6 +1,8 @@
#cmake -DCMAKE_BUILD_TYPE=Release .
#cmake -DCMAKE_BUILD_TYPE=Debug .
#cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=i386|amd64|armhf -DDEB_BOOST_VERSION=1.55.0 -DCMAKE_INSTALL_PREFIX=/usr .
#cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true .
cmake_minimum_required(VERSION 3.0)
@ -25,6 +27,10 @@ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11 -Wno-unused-result -Wno-depre
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
if (${LINK_STATICALLY} MATCHES "true")
set(Boost_USE_STATIC_LIBS ON)
endif()
set (BOOST_LIBS
system
filesystem
@ -71,7 +77,7 @@ include_directories (
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
link_directories ("/usr/local/lib")
include_directories("/usr/local/include")
endif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif ()
add_subdirectory(src/core)
add_subdirectory(src/glue)

View File

@ -6,4 +6,11 @@ set (flacdecoder_SOURCES
)
add_library(flacdecoder SHARED ${flacdecoder_SOURCES})
target_link_libraries(flacdecoder ${musikbox_LINK_LIBS} FLAC)
# prefer static libraries on mac to make redist easier
if (${LINK_STATICALLY} MATCHES "true")
find_library(FLACLIB NAMES libFLAC.a FLAC)
target_link_libraries(flacdecoder ${musikbox_LINK_LIBS} ${FLACLIB})
else()
target_link_libraries(flacdecoder ${musikbox_LINK_LIBS} FLAC)
endif()

View File

@ -17,4 +17,12 @@ include_directories(
)
add_library(m4adecoder SHARED ${m4adecoder_SOURCES})
target_link_libraries(m4adecoder ${musikbox_LINK_LIBS} faad)
# prefer static libraries on mac to make redist easier
if (${LINK_STATICALLY} MATCHES "true")
find_library(FAADLIB NAMES libfaad.a faad)
target_link_libraries(m4adecoder ${musikbox_LINK_LIBS} ${FAADLIB})
else()
target_link_libraries(m4adecoder ${musikbox_LINK_LIBS} faad)
endif()

View File

@ -6,4 +6,14 @@ set (oggdecoder_SOURCES
)
add_library(oggdecoder SHARED ${oggdecoder_SOURCES})
target_link_libraries(oggdecoder ${musikbox_LINK_LIBS} ogg vorbis vorbisfile)
# prefer static libraries on mac to make redist easier
if (${LINK_STATICALLY} MATCHES "true")
find_library(OGGLIB NAMES libogg.a ogg)
find_library(VORBISLIB NAMES libvorbis.a vorbis)
find_library(VORBISFILELIB NAMES libvorbisfile.a vorbisfile)
target_link_libraries(oggdecoder ${musikbox_LINK_LIBS} ${OGGLIB} ${VORBISLIB} ${VORBISFILELIB})
else()
target_link_libraries(oggdecoder ${musikbox_LINK_LIBS} ogg vorbis vorbisfile)
endif()