aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Fetzer <fetzer.ch@gmail.com>2016-07-17 15:48:17 +0200
committerChristian Fetzer <fetzer.ch@gmail.com>2016-07-21 12:24:31 +0200
commit66f8216277841ca8db4b2092bcfee88d39bb1ecf (patch)
tree7384a06c8cc4af8faf32083f1814fcc57ffaea92 /lib
parentfcefeb5e6b838c49923eb85eccda80c626506aa3 (diff)
[cmake] Change the way shared libraries are built
Before this change shared libraries were built by creating a static library using core_add_library and then linking that into a shared/module one using core_link_libraries. This has a few drawbacks: - Meanwhile most libraries don't use wrapping (for VFS support) anymore, and we can use CMake mechanisms to create those libraries. - The approach doesn't work with MSVC as there is no "whole-archive" option. On windows these symbols would need different exporting. - The main usage of core_add_library is to generate small libraries for the Kodi main application. Let's use it only for that. This is in preparation to disable building of per folder static libraries because they don't work well with VS and Xcode. This commit introduces the following changes: - Shared/Module libraries are now created with core_add_shared_library, addon callback libraries are now created with core_add_addon_library. - Fix dependencies: make kodi now builds everything needed to run kodi including all dl-loaded libraries. - Only use wrapping for libraries where it's also done with Autotools - WRAP_FILES and wrap-libraries are renamed to LIBRARY_FILES and kodi-libraries. - Library wrapping and generation now works in all subdirectories. Previously core_link_libraries had to be called in the main CMakeLists.txt because file dependencies in add_custom_command only work in the same directory. This also made it necessary to create wrap_* targets. - Generator expressions in core_link_libraries make the function less error prone.
Diffstat (limited to 'lib')
-rw-r--r--lib/addons/library.kodi.adsp/CMakeLists.txt10
-rw-r--r--lib/addons/library.kodi.audioengine/CMakeLists.txt10
-rw-r--r--lib/addons/library.kodi.guilib/CMakeLists.txt10
-rw-r--r--lib/addons/library.kodi.inputstream/CMakeLists.txt10
-rw-r--r--lib/addons/library.kodi.peripheral/CMakeLists.txt10
-rw-r--r--lib/addons/library.xbmc.addon/CMakeLists.txt10
-rw-r--r--lib/addons/library.xbmc.codec/CMakeLists.txt10
-rw-r--r--lib/addons/library.xbmc.pvr/CMakeLists.txt13
-rw-r--r--lib/libexif/CMakeLists.txt8
9 files changed, 23 insertions, 68 deletions
diff --git a/lib/addons/library.kodi.adsp/CMakeLists.txt b/lib/addons/library.kodi.adsp/CMakeLists.txt
index 027c5caa78..b3fc142a73 100644
--- a/lib/addons/library.kodi.adsp/CMakeLists.txt
+++ b/lib/addons/library.kodi.adsp/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libKODI_adsp.cpp)
-
-core_add_library(KODI_adsp NO_MAIN_DEPENDS)
-set_target_properties(KODI_adsp PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(KODI_adsp PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(KODI_adsp)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.kodi.audioengine/CMakeLists.txt b/lib/addons/library.kodi.audioengine/CMakeLists.txt
index e919e296be..1a723a2423 100644
--- a/lib/addons/library.kodi.audioengine/CMakeLists.txt
+++ b/lib/addons/library.kodi.audioengine/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libKODI_audioengine.cpp)
-
-core_add_library(KODI_audioengine NO_MAIN_DEPENDS)
-set_target_properties(KODI_audioengine PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(KODI_audioengine PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(KODI_audioengine)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.kodi.guilib/CMakeLists.txt b/lib/addons/library.kodi.guilib/CMakeLists.txt
index 4b391ab36f..70e11fb3e6 100644
--- a/lib/addons/library.kodi.guilib/CMakeLists.txt
+++ b/lib/addons/library.kodi.guilib/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libKODI_guilib.cpp)
-
-core_add_library(KODI_guilib NO_MAIN_DEPENDS)
-set_target_properties(KODI_guilib PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(KODI_guilib PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(KODI_guilib)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.kodi.inputstream/CMakeLists.txt b/lib/addons/library.kodi.inputstream/CMakeLists.txt
index 167e9312dc..390bf62e67 100644
--- a/lib/addons/library.kodi.inputstream/CMakeLists.txt
+++ b/lib/addons/library.kodi.inputstream/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libKODI_inputstream.cpp)
-
-core_add_library(KODI_inputstream NO_MAIN_DEPENDS)
-set_target_properties(KODI_inputstream PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(KODI_inputstream PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(KODI_inputstream)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.kodi.peripheral/CMakeLists.txt b/lib/addons/library.kodi.peripheral/CMakeLists.txt
index dc8fe11dc4..dcaa5b4160 100644
--- a/lib/addons/library.kodi.peripheral/CMakeLists.txt
+++ b/lib/addons/library.kodi.peripheral/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libKODI_peripheral.cpp)
-
-core_add_library(KODI_peripheral NO_MAIN_DEPENDS)
-set_target_properties(KODI_peripheral PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(KODI_peripheral PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(KODI_peripheral)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.xbmc.addon/CMakeLists.txt b/lib/addons/library.xbmc.addon/CMakeLists.txt
index e27a361e0f..3f5aac7e47 100644
--- a/lib/addons/library.xbmc.addon/CMakeLists.txt
+++ b/lib/addons/library.xbmc.addon/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libXBMC_addon.cpp)
-
-core_add_library(XBMC_addon NO_MAIN_DEPENDS)
-set_target_properties(XBMC_addon PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(XBMC_addon PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(XBMC_addon)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.xbmc.codec/CMakeLists.txt b/lib/addons/library.xbmc.codec/CMakeLists.txt
index de81d016aa..0202216b60 100644
--- a/lib/addons/library.xbmc.codec/CMakeLists.txt
+++ b/lib/addons/library.xbmc.codec/CMakeLists.txt
@@ -1,8 +1,2 @@
-set(SOURCES libXBMC_codec.cpp)
-
-core_add_library(XBMC_codec NO_MAIN_DEPENDS)
-set_target_properties(XBMC_codec PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(XBMC_codec PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+project(XBMC_codec)
+core_add_addon_library(${PROJECT_NAME})
diff --git a/lib/addons/library.xbmc.pvr/CMakeLists.txt b/lib/addons/library.xbmc.pvr/CMakeLists.txt
index 98fce55f99..b431fb79fe 100644
--- a/lib/addons/library.xbmc.pvr/CMakeLists.txt
+++ b/lib/addons/library.xbmc.pvr/CMakeLists.txt
@@ -1,10 +1,3 @@
-set(SOURCES libXBMC_pvr.cpp)
-
-core_add_library(XBMC_pvr NO_MAIN_DEPENDS)
-set_target_properties(XBMC_pvr PROPERTIES POSITION_INDEPENDENT_CODE True)
-target_include_directories(XBMC_pvr PRIVATE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/addons/library.xbmc.addon
- ${CORE_SOURCE_DIR}/xbmc
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include
- ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers)
+project(XBMC_pvr)
+core_add_addon_library(${PROJECT_NAME})
+target_include_directories(${PROJECT_NAME} PRIVATE ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers)
diff --git a/lib/libexif/CMakeLists.txt b/lib/libexif/CMakeLists.txt
index d21d4fc1d8..6ecc48a54a 100644
--- a/lib/libexif/CMakeLists.txt
+++ b/lib/libexif/CMakeLists.txt
@@ -3,7 +3,11 @@ set(SOURCES ExifParse.cpp
JpegParse.cpp
libexif.cpp)
-set(CMAKE_POSITION_INDEPENDENT_CODE 1)
+set(HEADERS ExifParse.h
+ IptcParse.h
+ JpegParse.h
+ libexif.h)
-core_add_library(exif NO_MAIN_DEPENDS)
+core_add_shared_library(exif WRAPPED)
target_compile_definitions(exif PRIVATE _LINUX _DLL)
+set_target_properties(exif PROPERTIES FOLDER lib)