forked from mean00/avidemux2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTs.cmake
82 lines (76 loc) · 3.25 KB
/
Ts.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# a small macro to create qm files out of ts's
MACRO(FIND_LRELEASE)
IF(NOT LRELEASE_EXECUTABLE AND NOT LRELEASE_NOT_FOUND)
FIND_PROGRAM(LRELEASE_EXECUTABLE lrelease PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
$ENV{QTDIR}/bin)
IF (NOT LRELEASE_EXECUTABLE) # search again under the name lrelease-qt4
FIND_PROGRAM(LRELEASE_EXECUTABLE lrelease-${QT_EXTENSION} PATHS
$ENV{QTDIR}/bin)
IF (NOT LRELEASE_EXECUTABLE) # search again under the name lrelease-qt4
MESSAGE(FATAL_ERROR "${LRELEASE_EXECUTABLE} not found - ts files can't be processed")
SET(LRELEASE_NOT_FOUND "1") # to avoid double checking in one cmake run
ENDIF (NOT LRELEASE_EXECUTABLE) # search again under the name lrelease-qt4
ENDIF (NOT LRELEASE_EXECUTABLE)
IF (LRELEASE_EXECUTABLE)
MESSAGE(STATUS "lrelease found as ${LRELEASE_EXECUTABLE}")
ENDIF (LRELEASE_EXECUTABLE)
ENDIF(NOT LRELEASE_EXECUTABLE AND NOT LRELEASE_NOT_FOUND)
ENDMACRO(FIND_LRELEASE)
#
#
#
MACRO(INSTALL_I18N )
IF(WIN32)
SET(i18dir "${CMAKE_INSTALL_PREFIX}/${BIN_DIR}/${QT_EXTENSION}/i18n")
ELSE(WIN32)
SET(i18dir "${CMAKE_INSTALL_PREFIX}/share/avidemux6/${QT_EXTENSION}/i18n")
ENDIF(WIN32)
INSTALL(FILES ${ARGN} DESTINATION "${i18dir}" COMPONENT runtime)
ENDMACRO(INSTALL_I18N _files)
#
#
FUNCTION(COMPILE_MASK_TS_FILES ts_subdir prefix mask_sources)
IF(LRELEASE_EXECUTABLE)
FILE(GLOB ts_files ${ts_subdir}/${prefix}_*.ts)
#MESSAGE(STATUS "While searching ${prefix} found ${ts_files}")
FOREACH(ts_input ${ts_files})
GET_FILENAME_COMPONENT(_in ${ts_input} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${ts_input} NAME_WE)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
GET_FILENAME_COMPONENT(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.qm ABSOLUTE)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${CMAKE_COMMAND}
-E echo
"Generating" ${_out} "from" ${_in}
COMMAND ${LRELEASE_EXECUTABLE}
${_in}
-qm ${_out}
DEPENDS ${_in}
)
SET(qm_files ${qm_files} ${_out})
ENDFOREACH(ts_input ${ts_files})
INSTALL_I18N( ${qm_files})
SET(${mask_sources} ${qm_files} PARENT_SCOPE)
ENDIF(LRELEASE_EXECUTABLE)
ENDFUNCTION(COMPILE_MASK_TS_FILES)
#
#
#
FUNCTION(COMPILE_TS_FILES ts_subdir sources)
FIND_LRELEASE()
IF(QT5_FOUND)
SET(pfix "qtbase")
ELSE(QT5_FOUND)
SET(pfix "qt")
ENDIF(QT5_FOUND)
SET(adm_sources "")
COMPILE_MASK_TS_FILES( ${ts_subdir} "avidemux" adm_sources)
#MESSAGE(STATUS "Result 1= ${adm_sources}")
SET(qt_sources "")
COMPILE_MASK_TS_FILES( ${ts_subdir} "${pfix}" qt_sources)
#MESSAGE(STATUS "Result 2= ${qt_sources}")
SET( ${sources} ${adm_sources} ${qt_sources} PARENT_SCOPE)
ENDFUNCTION(COMPILE_TS_FILES)