Skip to content

Commit

Permalink
Merge pull request desktop-app#8 from ilya-fedin/working-packaged-build
Browse files Browse the repository at this point in the history
Make packaged build working
  • Loading branch information
john-preston authored Jan 17, 2020
2 parents 7081bc2 + 1db22f3 commit 633422c
Show file tree
Hide file tree
Showing 15 changed files with 534 additions and 409 deletions.
26 changes: 14 additions & 12 deletions external/crash_reports/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
add_library(external_crash_reports INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_crash_reports ALIAS external_crash_reports)

if (WIN32 OR LINUX OR build_macstore)
add_subdirectory(breakpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_breakpad
)
else()
add_subdirectory(crashpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_crashpad
)
if (NOT DESKTOP_APP_DISABLE_CRASH_REPORTS)
if (WIN32 OR LINUX OR build_macstore)
add_subdirectory(breakpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_breakpad
)
else()
add_subdirectory(crashpad)
target_link_libraries(external_crash_reports
INTERFACE
desktop-app::external_crashpad
)
endif()
endif()
74 changes: 50 additions & 24 deletions external/ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,58 @@
add_library(external_ffmpeg INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg)

target_include_directories(external_ffmpeg SYSTEM
INTERFACE
${libs_loc}/ffmpeg
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)

set(ffmpeg_lib_loc ${libs_loc}/ffmpeg)
pkg_check_modules(AVCODEC REQUIRED libavcodec)
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVUTIL REQUIRED libavutil)
pkg_check_modules(SWSCALE REQUIRED libswscale)
pkg_check_modules(SWRESAMPLE REQUIRED libswresample)

target_link_libraries(external_ffmpeg
INTERFACE
${ffmpeg_lib_loc}/libavformat/libavformat.a
${ffmpeg_lib_loc}/libavcodec/libavcodec.a
${ffmpeg_lib_loc}/libswresample/libswresample.a
${ffmpeg_lib_loc}/libswscale/libswscale.a
${ffmpeg_lib_loc}/libavutil/libavutil.a
)
if (LINUX)
target_link_static_libraries(external_ffmpeg
target_include_directories(external_ffmpeg
INTERFACE
va-x11
va-drm
va
vdpau
drm
Xi
Xext
Xfixes
Xrender
${AVCODEC_INCLUDE_DIRS}
${AVFORMAT_INCLUDE_DIRS}
${AVUTIL_INCLUDE_DIRS}
${SWSCALE_INCLUDE_DIRS}
${SWRESAMPLE_INCLUDE_DIRS})

target_link_libraries(external_ffmpeg
INTERFACE
${AVCODEC_LIBRARIES}
${AVFORMAT_LIBRARIES}
${AVUTIL_LIBRARIES}
${SWSCALE_LIBRARIES}
${SWRESAMPLE_LIBRARIES})
else()
target_include_directories(external_ffmpeg SYSTEM
INTERFACE
${libs_loc}/ffmpeg
)

set(ffmpeg_lib_loc ${libs_loc}/ffmpeg)

target_link_libraries(external_ffmpeg
INTERFACE
${ffmpeg_lib_loc}/libavformat/libavformat.a
${ffmpeg_lib_loc}/libavcodec/libavcodec.a
${ffmpeg_lib_loc}/libswresample/libswresample.a
${ffmpeg_lib_loc}/libswscale/libswscale.a
${ffmpeg_lib_loc}/libavutil/libavutil.a
)
if (LINUX)
target_link_static_libraries(external_ffmpeg
INTERFACE
va-x11
va-drm
va
vdpau
drm
Xi
Xext
Xfixes
Xrender
)
endif()
endif()
51 changes: 31 additions & 20 deletions external/lz4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,37 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL

add_library(external_lz4 OBJECT)
add_library(desktop-app::external_lz4 ALIAS external_lz4)
init_target(external_lz4 "(external)")
if (DESKTOP_APP_USE_PACKAGED)
add_library(external_lz4 INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_lz4 ALIAS external_lz4)

set(lz4_loc ${third_party_loc}/lz4/lib)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LZ4 REQUIRED liblz4)

target_sources(external_lz4
PRIVATE
${lz4_loc}/lz4.c
${lz4_loc}/lz4.h
${lz4_loc}/lz4frame.c
${lz4_loc}/lz4frame.h
${lz4_loc}/lz4frame_static.h
${lz4_loc}/lz4hc.c
${lz4_loc}/lz4hc.h
${lz4_loc}/xxhash.c
${lz4_loc}/xxhash.h
)
target_include_directories(external_lz4 INTERFACE ${LZ4_INCLUDE_DIRS})
target_link_libraries(external_lz4 INTERFACE ${LZ4_LIBRARIES})
else()
add_library(external_lz4 OBJECT)
add_library(desktop-app::external_lz4 ALIAS external_lz4)
init_target(external_lz4 "(external)")

target_include_directories(external_lz4
PUBLIC
${lz4_loc}
)
set(lz4_loc ${third_party_loc}/lz4/lib)

target_sources(external_lz4
PRIVATE
${lz4_loc}/lz4.c
${lz4_loc}/lz4.h
${lz4_loc}/lz4frame.c
${lz4_loc}/lz4frame.h
${lz4_loc}/lz4frame_static.h
${lz4_loc}/lz4hc.c
${lz4_loc}/lz4hc.h
${lz4_loc}/xxhash.c
${lz4_loc}/xxhash.h
)

target_include_directories(external_lz4
PUBLIC
${lz4_loc}
)
endif()
14 changes: 12 additions & 2 deletions external/openal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
add_library(external_openal INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_openal ALIAS external_openal)

if (WIN32)
if (DESKTOP_APP_USE_PACKAGED)
find_package(OpenAL REQUIRED)
target_include_directories(external_openal INTERFACE ${OPENAL_INCLUDE_DIR})
target_link_libraries(external_openal INTERFACE ${OPENAL_LIBRARY})
elseif (WIN32)
target_include_directories(external_openal SYSTEM
INTERFACE
${libs_loc}/openal-soft/include
Expand Down Expand Up @@ -36,8 +40,14 @@ else()
)
endif()

if (NOT DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(external_openal
INTERFACE
AL_LIBTYPE_STATIC
)
endif()

target_compile_definitions(external_openal
INTERFACE
AL_LIBTYPE_STATIC
AL_ALEXT_PROTOTYPES
)
85 changes: 45 additions & 40 deletions external/openssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,57 @@
add_library(external_openssl INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_openssl ALIAS external_openssl)

if (LINUX)
target_include_directories(external_openssl SYSTEM
INTERFACE
/usr/local/desktop-app/openssl-1.1.1/include
)
elseif (NOT APPLE OR NOT build_osx)
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl_1_1_1/include
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(OpenSSL REQUIRED)
target_link_libraries(external_openssl INTERFACE OpenSSL::SSL)
else()
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl/include
)
endif()
if (LINUX)
target_include_directories(external_openssl SYSTEM
INTERFACE
/usr/local/desktop-app/openssl-1.1.1/include
)
elseif (NOT APPLE OR NOT build_osx)
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl_1_1_1/include
)
else()
target_include_directories(external_openssl SYSTEM
INTERFACE
${libs_loc}/openssl/include
)
endif()

if (WIN32)
set(openssl_lib_ext lib)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32$<$<CONFIG:Debug>:.dbg>)
else()
set(openssl_lib_ext a)
if (APPLE)
if (NOT build_osx)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1)
if (WIN32)
set(openssl_lib_ext lib)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1/out32$<$<CONFIG:Debug>:.dbg>)
else()
set(openssl_lib_ext a)
if (APPLE)
if (NOT build_osx)
set(openssl_lib_loc ${libs_loc}/openssl_1_1_1)
else()
set(openssl_lib_loc ${libs_loc}/openssl)
endif()
else()
set(openssl_lib_loc ${libs_loc}/openssl)
set(openssl_lib_loc /usr/local/desktop-app/openssl-1.1.1/lib)
endif()
else()
set(openssl_lib_loc /usr/local/desktop-app/openssl-1.1.1/lib)
endif()
endif()

target_link_libraries(external_openssl
INTERFACE
${openssl_lib_loc}/libssl.${openssl_lib_ext}
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
)
target_link_libraries(external_openssl
INTERFACE
${openssl_lib_loc}/libssl.${openssl_lib_ext}
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
)

if (LINUX)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl
INTERFACE
desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
)
if (LINUX)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl
INTERFACE
desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
)
endif()
target_link_libraries(external_openssl INTERFACE pthread)
endif()
target_link_libraries(external_openssl INTERFACE pthread)
endif()
19 changes: 14 additions & 5 deletions external/opus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@
add_library(external_opus INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_opus ALIAS external_opus)

target_include_directories(external_opus SYSTEM
INTERFACE
${libs_loc}/opus/include
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS opus)

if (WIN32)
target_include_directories(external_opus INTERFACE ${OPUS_INCLUDE_DIRS})
else()
target_include_directories(external_opus SYSTEM
INTERFACE
${libs_loc}/opus/include
)
endif()

if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_opus INTERFACE ${OPUS_LIBRARIES})
elseif (WIN32)
set(opus_lib_loc ${libs_loc}/opus/win32/VS2015/Win32/$<IF:$<CONFIG:Debug>,Debug,Release>)

target_link_libraries(external_opus
Expand Down
Loading

0 comments on commit 633422c

Please sign in to comment.