Commit af3864bc authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Clean cmake files & add example project

parent 7497299f
project(vlcpptest)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(LIBVLCPP_MAJOR_VERSION 2) set(LIBVLCPP_MAJOR_VERSION 2)
set(LIBVLCPP_MINOR_VERSION 2) set(LIBVLCPP_MINOR_VERSION 2)
set(LIBVLCPP_PATCH_VERSION 0) set(LIBVLCPP_PATCH_VERSION 0)
set(LIBVLCPP_VERSION ${LIBVLCPP_MAJOR_VERSION}.${LIBVLCPP_MINOR_VERSION}.${LIBVLCPP_PATCH_VERSION}) set(LIBVLCPP_VERSION ${LIBVLCPP_MAJOR_VERSION}.${LIBVLCPP_MINOR_VERSION}.${LIBVLCPP_PATCH_VERSION})
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
include_directories("${CMAKE_SOURCE_DIR}")
find_package(LIBVLC REQUIRED)
subdirs(examples)
subdirs(test)
include(cpp11) include(cpp11)
add_definitions("-Wall -Wextra -pedantic") add_definitions("-Wall -Wextra -pedantic")
EnableCpp11() EnableCpp11()
file(GLOB LIBVLCPP_HEADERS "${CMAKE_SOURCE_DIR}/src/*.hpp") file(GLOB LIBVLCPP_HEADERS "${CMAKE_SOURCE_DIR}/vlcpp/*.hpp")
add_executable(${PROJECT_NAME}
test/main.cpp
${LIBVLCPP_HEADERS}
)
include_directories("${CMAKE_SOURCE_DIR}/src/")
find_package(LIBVLC REQUIRED)
target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY} )
include_directories(${LIBVLC_INCLUDE_DIR})
subdirs(helloworld)
project(helloworld)
add_executable(${PROJECT_NAME}
main.cpp
)
target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY} )
#include "vlcpp/vlc.hpp"
#include <thread>
#include <iostream>
int main(int ac, char** av)
{
if (ac < 2)
{
std::cerr << "usage: " << av[0] << " <file to play>" << std::endl;
return 1;
}
auto instance = VLC::Instance(0, nullptr);
auto media = VLC::Media(instance, av[1], VLC::Media::FromPath);
auto mp = VLC::MediaPlayer(media);
mp.play();
std::this_thread::sleep_for( std::chrono::seconds( 10 ) );
mp.stop();
}
project(vlcpptest)
file(GLOB LIBVLCPP_HEADERS "${CMAKE_SOURCE_DIR}/vlcpp/*.hpp")
add_executable(${PROJECT_NAME}
main.cpp
# Forcing cmake to load & display libvlcpp files
${LIBVLCPP_HEADERS}
)
target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} ${LIBVLCCORE_LIBRARY} )
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include "vlc.hpp" #include "vlcpp/vlc.hpp"
#include <iostream> #include <iostream>
#include <thread> #include <thread>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define LIBVLC_EVENTMANAGER_HPP #define LIBVLC_EVENTMANAGER_HPP
#include <string> #include <string>
#include <iostream>
#include "common.hpp" #include "common.hpp"
#include "Internal.hpp" #include "Internal.hpp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment