diff --git a/CMakeLists.txt b/CMakeLists.txt index bb342a4..919b3ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,17 +6,8 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") aux_source_directory(./src SRC_LIST) list(APPEND SRC_LIST ./src/video/fake.c) -aux_source_directory(./third_party/moonlight-common-c/limelight-common SRC_LIST) -aux_source_directory(./third_party/moonlight-common-c/limelight-common/OpenAES SRC_LIST) - -include_directories(./third_party/moonlight-common-c) - set(MOONLIGHT_DEFINITIONS) -find_package(Threads REQUIRED) -find_package(CURL REQUIRED) -find_package(OpenSSL REQUIRED) -find_package(EXPAT REQUIRED) find_package(ALSA REQUIRED) find_package(Opus REQUIRED) find_package(Broadcom) @@ -25,14 +16,8 @@ find_package(CEC) find_package(PkgConfig REQUIRED) pkg_check_modules(EVDEV REQUIRED libevdev) -pkg_check_modules(AVAHI REQUIRED avahi-client) pkg_check_modules(UDEV REQUIRED libudev) -if(CEC_FOUND) - include_directories(./third_party/libcec) - list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC) -endif() - if(BROADCOM_FOUND) aux_source_directory(./third_party/ilclient SRC_LIST) aux_source_directory(./third_party/h264bitstream SRC_LIST) @@ -45,23 +30,32 @@ if(FREESCALE_FOUND) list(APPEND MOONLIGHT_DEFINITIONS HAVE_IMX) endif() +add_subdirectory(libgamestream) + add_executable(moonlight ${SRC_LIST}) +target_link_libraries(moonlight PUBLIC gamestream) set_property(TARGET moonlight PROPERTY C_STANDARD 11) +if (CEC_FOUND) + list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC) + target_include_directories(moonlight PRIVATE ./third_party/libcec ${CEC_INCLUDE_DIRS}) + target_link_libraries (moonlight PUBLIC ${CEC_LIBRARIES}) +endif() + if(BROADCOM_FOUND) - include_directories(./third_party/ilclient ./third_party/h264bitstream ${BROADCOM_INCLUDE_DIRS}) + target_include_directories(moonlight PRIVATE ./third_party/ilclient ./third_party/h264bitstream ${BROADCOM_INCLUDE_DIRS}) target_link_libraries (moonlight PUBLIC ${BROADCOM_LIBRARIES}) list(APPEND MOONLIGHT_DEFINITIONS ${BROADCOM_DEFINITIONS}) endif() if(FREESCALE_FOUND) - include_directories(${FREESCALE_INCLUDE_DIRS}) + target_include_directories(moonlight PRIVATE ${FREESCALE_INCLUDE_DIRS}) target_link_libraries (moonlight PUBLIC ${FREESCALE_LIBRARIES}) endif() set_property(TARGET moonlight PROPERTY COMPILE_DEFINITIONS ${MOONLIGHT_DEFINITIONS}) -include_directories(./third_party/moonlight-common-c ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${AVAHI_INCLUDE_DIRS} ${UDEV_INCLUDE_DIRS} ${CEC_INCLUDE_DIRS}) -target_link_libraries (moonlight PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${AVAHI_LIBRARIES} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS} ${CEC_LIBRARIES}) +target_include_directories(moonlight PRIVATE ./libgamestream ./third_party/moonlight-common-c ${OPUS_INCLUDE_DIRS} ${EVDEV_INCLUDE_DIRS} ${UDEV_INCLUDE_DIRS}) +target_link_libraries (moonlight PUBLIC ${EVDEV_LIBRARIES} ${ALSA_LIBRARY} ${OPUS_LIBRARY} ${UDEV_LIBRARIES} ${CMAKE_DL_LIBS}) include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake) install(TARGETS moonlight DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/libgamestream/CMakeLists.txt b/libgamestream/CMakeLists.txt new file mode 100644 index 0000000..46682ad --- /dev/null +++ b/libgamestream/CMakeLists.txt @@ -0,0 +1,20 @@ +find_package(Threads REQUIRED) +find_package(CURL REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(EXPAT REQUIRED) + +pkg_check_modules(AVAHI REQUIRED avahi-client) + +aux_source_directory(./ GAMESTREAM_SRC_LIST) + +aux_source_directory(../third_party/moonlight-common-c/limelight-common GAMESTREAM_SRC_LIST) +aux_source_directory(../third_party/moonlight-common-c/limelight-common/OpenAES GAMESTREAM_SRC_LIST) + +add_library(gamestream SHARED ${GAMESTREAM_SRC_LIST}) +set_property(TARGET gamestream PROPERTY C_STANDARD 11) +set_target_properties(gamestream PROPERTIES SOVERSION 0 VERSION 2.1.0) + +target_include_directories(gamestream PRIVATE ../third_party/moonlight-common-c ${AVAHI_INCLUDE_DIRS}) +target_link_libraries (gamestream PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${EXPAT_LIBRARIES} ${AVAHI_LIBRARIES} ${CMAKE_DL_LIBS}) + +#install(TARGETS gamestream DESTINATION ${CMAKE_INSTALL_LIBDIR}) \ No newline at end of file diff --git a/src/client.c b/libgamestream/client.c similarity index 100% rename from src/client.c rename to libgamestream/client.c diff --git a/src/client.h b/libgamestream/client.h similarity index 100% rename from src/client.h rename to libgamestream/client.h diff --git a/src/discover.c b/libgamestream/discover.c similarity index 100% rename from src/discover.c rename to libgamestream/discover.c diff --git a/src/discover.h b/libgamestream/discover.h similarity index 100% rename from src/discover.h rename to libgamestream/discover.h diff --git a/src/global.c b/libgamestream/global.c similarity index 100% rename from src/global.c rename to libgamestream/global.c diff --git a/src/global.h b/libgamestream/global.h similarity index 100% rename from src/global.h rename to libgamestream/global.h diff --git a/src/http.c b/libgamestream/http.c similarity index 100% rename from src/http.c rename to libgamestream/http.c diff --git a/src/http.h b/libgamestream/http.h similarity index 100% rename from src/http.h rename to libgamestream/http.h diff --git a/src/mkcert.c b/libgamestream/mkcert.c similarity index 100% rename from src/mkcert.c rename to libgamestream/mkcert.c diff --git a/src/mkcert.h b/libgamestream/mkcert.h similarity index 100% rename from src/mkcert.h rename to libgamestream/mkcert.h diff --git a/src/xml.c b/libgamestream/xml.c similarity index 100% rename from src/xml.c rename to libgamestream/xml.c diff --git a/src/xml.h b/libgamestream/xml.h similarity index 100% rename from src/xml.h rename to libgamestream/xml.h