Skip to content

Commit

Permalink
cmake: use rc template
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Mar 15, 2017
1 parent aea2dbc commit f343ffc
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 8 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
set(PROJECT_VERSION 1.11.0)
set(SO_VERSION 1)
set(QTAV_MAJOR 1)
set(QTAV_MINOR 11)
set(QTAV_PATCH 0)
set(PROJECT_VERSION ${QTAV_MAJOR}.${QTAV_MINOR}.${QTAV_PATCH})
set(SO_VERSION ${QTAV_MAJOR})

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
35 changes: 35 additions & 0 deletions cmake/QtAV.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "winver.h"
#include "@CMAKE_SOURCE_DIR@/src/QtAV/version.h"
IDI_ICON1 ICON DISCARDABLE "@CMAKE_SOURCE_DIR@/src/QtAV.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION QTAV_MAJOR,QTAV_MINOR,QTAV_PATCH,0
PRODUCTVERSION QTAV_MAJOR,QTAV_MINOR,QTAV_PATCH,0
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEFLAGSMASK 0x3fL
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", "Shanghai University->S3 Graphics->Deepin->PPTV | [email protected]"
VALUE "FileDescription", "QtAV Multimedia framework. http://qtav.org"
VALUE "FileVersion", QTAV_VERSION_STR ".0"
VALUE "LegalCopyright", "Copyright (C) 2012-2017 WangBin, [email protected]"
VALUE "InternalName", "@MODULE@"
VALUE "ProductName", "@MODULE@"
VALUE "ProductVersion", QTAV_VERSION_STR ".0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
16 changes: 14 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,28 @@ if(Qt5Quick_FOUND)
set(QMLPLAYER_QRC QMLPlayer/qmlplayer.qrc)
qt5_add_resources(QMLPLAYER_RES ${QMLPLAYER_QRC})
set_source_files_properties(${QMLPLAYER_RES} PROPERTIES GENERATED ON)
set(MODULE QMLPlayer)
if(WIN32)
set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/QtAV.rc.in ${RC_FILE})
endif()
add_executable(QMLPlayer
QMLPlayer/main.cpp
QMLPlayer/qtquick2applicationviewer/qtquick2applicationviewer.cpp
QMLPlayer/qtquick2applicationviewer/qtquick2applicationviewer.h
${QMLPLAYER_RES})
${QMLPLAYER_RES}
${RC_FILE}
)
target_include_directories(QMLPlayer PRIVATE QMLPlayer/qtquick2applicationviewer)
target_link_libraries(QMLPlayer Qt5::Quick common)
endif()
if(Qt5Widgets_FOUND)
add_executable(Player ${PLAYER_SRC} ${PLAYER_HEADERS} ${PLAYER_RES})
set(MODULE Player)
if(WIN32)
set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/QtAV.rc.in ${RC_FILE})
endif()
add_executable(Player ${PLAYER_SRC} ${PLAYER_HEADERS} ${PLAYER_RES} ${RC_FILE})
target_link_libraries(Player QtAVWidgets common)

SET(FILTERS_QRC filters/res.qrc)
Expand Down
7 changes: 6 additions & 1 deletion qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ if(NOT Qt5Qml_VERSION VERSION_LESS 5.2.0)
list(APPEND SOURCES QuickFBORenderer.cpp)
endif()
# add HEADERS for moc
add_library(${MODULE} SHARED ${SOURCES} ${RESOURCES_SOURCES} ${HEADERS})
if(WIN32)
set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/QtAV.rc.in ${RC_FILE})
endif()
add_library(${MODULE} SHARED ${SOURCES} ${RESOURCES_SOURCES} ${HEADERS} ${RC_FILE})
target_link_libraries(${MODULE}
LINK_PRIVATE ${EXTRA_LIBS}
LINK_PUBLIC QtAV Qt5::Qml Qt5::Quick
Expand All @@ -42,6 +46,7 @@ set_target_properties(${MODULE} PROPERTIES
MACOSX_RPATH ON
FRAMEWORK OFF
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/QtAV
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/QtAV
)

#http://stackoverflow.com/questions/19866424/cmake-and-qt5-automoc-error
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(MODULE QtAV)
# TODO: translations, rpath, rc template, uchardet, x11extras, android
# TODO: translations, rpath, uchardet, x11extras, android

include(CheckCCompilerFlag)
include(CheckCXXSourceCompiles)
Expand All @@ -13,6 +13,7 @@ include_directories(${QTDIR}/include) #TODO: remove. use external/include
get_filename_component(QTDIR "${QTDIR}" ABSOLUTE)

list(APPEND EXTRA_INCLUDE ${CMAKE_SOURCE_DIR}/external/include)
list(APPEND EXTRA_LIBS ${CMAKE_LIBRARY_PATH_FLAG}${CMAKE_SOURCE_DIR}/external/lib)
if(APPLE)
if(IOS)
#set_xcode_property(myioslib IPHONEOS_DEPLOYMENT_TARGET "8.0")
Expand Down Expand Up @@ -471,7 +472,8 @@ SOURCE_GROUP("Resources" FILES ${RESOURCES})
QT5_ADD_RESOURCES(RESOURCES_SOURCES ${RESOURCES})
set_source_files_properties(${RESOURCES_SOURCES} PROPERTIES GENERATED ON)
if(WIN32)
set(RC_FILE QtAV.rc)
set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/QtAV.rc.in ${RC_FILE})
endif()
# add HEADERS for moc
add_library(${MODULE} SHARED ${SOURCES} ${RESOURCES_SOURCES} ${HEADERS} ${RC_FILE})
Expand Down
3 changes: 2 additions & 1 deletion widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ endif()

set(HEADERS ${SDK_HEADERS})
if(WIN32)
set(RC_FILE QtAVWidgets.rc)
set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.rc)
configure_file(${CMAKE_SOURCE_DIR}/cmake/QtAV.rc.in ${RC_FILE})
endif()
# add HEADERS for moc
add_library(${MODULE} SHARED ${SOURCES} ${RESOURCES_SOURCES} ${HEADERS} ${RC_FILE})
Expand Down

0 comments on commit f343ffc

Please sign in to comment.