Skip to content

Commit

Permalink
build system tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
microcai committed Dec 18, 2012
1 parent 089b789 commit fa57c62
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 51 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
find_package( Boost 1.51 REQUIRED COMPONENTS thread filesystem)

#dont't define this, libbt need depreated api
#add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)

find_package( Boost 1.51 COMPONENTS date_time filesystem regex system thread)

include_directories(${PROJECT_SOURCE_DIR})
include_directories(libav/)
include_directories(source/)
Expand Down
5 changes: 4 additions & 1 deletion audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
add_library(libavaudio OBJECT sdl_render.cpp)
find_package( Boost 1.51 COMPONENTS thread)

add_library(avaudio STATIC sdl_render.cpp)
target_link_libraries(avaudio ${Boost_LIBRARIES})
2 changes: 1 addition & 1 deletion audio/sdl_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define UINT64_C(c) c ## ULL
#define __STDC_CONSTANT_MACROS
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
4 changes: 3 additions & 1 deletion libav/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

add_library(libav OBJECT avplay.c)
add_library(av STATIC avplay.c)


target_link_libraries(av -lavcodec -lavformat -lswscale -lswresample)
24 changes: 10 additions & 14 deletions linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
find_package(SDL)
find_package(SDL REQUIRED)
find_package(X11)
find_package( Boost 1.51 COMPONENTS filesystem)

include_directories(${Boost_INCLUDE_DIRS})
include_directories(${SDL_INCLUDE_DIR})

if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})
link_libraries(${SDL_LIBRARY})
else()
message(FATAL_ERROR "need sdl" )
endif()
add_executable(avplayer player.cpp main.cpp)

add_executable(avplayer player.cpp main.cpp
$<TARGET_OBJECTS:libav> $<TARGET_OBJECTS:libavsource>
$<TARGET_OBJECTS:libavvideo> $<TARGET_OBJECTS:libavaudio>)
target_link_libraries(avplayer av avsource avaudio avaudio avvideo)

if(bt)
target_link_libraries(avplayer ${PROJECT_BINARY_DIR}/libtorrent/libtorrent-rasterbar.a )
target_link_libraries(avplayer torrent-rasterbar)
endif()

target_link_libraries(avplayer -lavcodec -lavformat -lswscale -lswresample)

target_link_libraries(avplayer ${Boost_LIBRARIES} ${X11_LIBRARIES})
target_link_libraries(avplayer ${X11_LIBRARIES})
target_link_libraries(avplayer ${SDL_LIBRARY})
target_link_libraries(avplayer ${Boost_LIBRARIES})
31 changes: 3 additions & 28 deletions linux/main.cpp
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
#define __STDC_CONSTANT_MACROS
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <boost/filesystem.hpp>
#include <boost/concept_check.hpp>
namespace fs=boost::filesystem;

#include <SDL/SDL.h>
#include <X11/Xlib.h>
#include <boost/filesystem.hpp>
namespace fs=boost::filesystem;

#include <avplay.h>
#include "player.h"

static void play_thread(void *param)
{
// avplayer *play = (avplayer*)param;
// play->play();
// play->wait_for_completion();
// play->load_subtitle("d:\\media\\dfsschs2.srt");
// 一直等待直到播放完成.
// Sleep(5000);
// play->stop();
// play->close();

// // 播放完成后, 处理各种事件.
//
// printf("+++++++++++++++ play completed! ++++++++++++++\n");
// return ;
//
// for (;;)
// {
// double d = play->duration();
// double cur_time = play->curr_play_time();
// printf("-----------time: %0.2f, duration: %0.2f---------\n", cur_time, d - cur_time);
// Sleep(200);
// }
}

int main(int argc, char* argv[])
{
// 判断播放参数是否足够.
Expand Down
3 changes: 1 addition & 2 deletions linux/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define UINT64_C(c) c ## ULL

#define __STDC_CONSTANT_MACROS
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
Expand Down
2 changes: 1 addition & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(libavsource OBJECT file_source.cpp source.cpp torrent_source.cpp)
add_library(avsource STATIC file_source.cpp source.cpp torrent_source.cpp)

if(bt)
add_definitions(-DUSE_TORRENT -DANSI_TERMINAL_COLORS -DBOOST_ASIO_DYN_LINK)
Expand Down
2 changes: 1 addition & 1 deletion video/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_library(libavvideo OBJECT sdl_render.cpp)
add_library(avvideo STATIC sdl_render.cpp)

0 comments on commit fa57c62

Please sign in to comment.