Changeset View
Changeset View
Standalone View
Standalone View
cmake/build-tsfiles.cmake
Show All 31 Lines | 28 | foreach(ts_file ${ts_files}) | |||
---|---|---|---|---|---|
32 | 32 | | |||
33 | get_filename_component(subpath ${ts_file} DIRECTORY) | 33 | get_filename_component(subpath ${ts_file} DIRECTORY) | ||
34 | string(REPLACE "scripts" "LC_SCRIPTS" subpath ${subpath}) | 34 | string(REPLACE "scripts" "LC_SCRIPTS" subpath ${subpath}) | ||
35 | 35 | | |||
36 | message(STATUS "copying... ${PO_DIR}/${ts_file} DESTINATION ${COPY_TO}/${subpath}" ) | 36 | message(STATUS "copying... ${PO_DIR}/${ts_file} DESTINATION ${COPY_TO}/${subpath}" ) | ||
37 | file(COPY ${PO_DIR}/${ts_file} DESTINATION ${COPY_TO}/${subpath}) | 37 | file(COPY ${PO_DIR}/${ts_file} DESTINATION ${COPY_TO}/${subpath}) | ||
38 | endforeach() | 38 | endforeach() | ||
39 | 39 | | |||
40 | | ||||
41 | include(ProcessorCount) | ||||
42 | ProcessorCount(numberOfProcesses) | ||||
43 | | ||||
44 | set(i 0) | ||||
45 | set(commands) | ||||
46 | | ||||
47 | function(_processCommands) | ||||
48 | if(NOT commands) | ||||
49 | return() | ||||
50 | endif() | ||||
51 | | ||||
52 | execute_process( | ||||
53 | ${commands} | ||||
54 | RESULT_VARIABLE code | ||||
55 | ) | ||||
56 | if(code) | ||||
57 | message(FATAL_ERROR "failed generating: ${PO_DIR}") | ||||
58 | endif() | ||||
59 | endfunction() | ||||
60 | | ||||
40 | file(GLOB_RECURSE pmap_files RELATIVE ${PO_DIR} "${PO_DIR}/**.pmap") | 61 | file(GLOB_RECURSE pmap_files RELATIVE ${PO_DIR} "${PO_DIR}/**.pmap") | ||
41 | foreach(pmap_file ${pmap_files}) | 62 | foreach(pmap_file ${pmap_files}) | ||
42 | get_filename_component(pmap_basename ${pmap_file} NAME) | 63 | get_filename_component(pmap_basename ${pmap_file} NAME) | ||
43 | get_filename_component(subpath ${pmap_file} DIRECTORY) | 64 | get_filename_component(subpath ${pmap_file} DIRECTORY) | ||
44 | string(REPLACE "scripts" "LC_SCRIPTS" subpath ${subpath}) | 65 | string(REPLACE "scripts" "LC_SCRIPTS" subpath ${subpath}) | ||
45 | set(pmapc_file "${COPY_TO}/${subpath}/${pmap_basename}c") | 66 | set(pmapc_file "${COPY_TO}/${subpath}/${pmap_basename}c") | ||
46 | 67 | | |||
47 | message(STATUS "building... ${pmap_file} to ${pmapc_file}" ) | 68 | message(STATUS "building... ${pmap_file} to ${pmapc_file}" ) | ||
48 | execute_process( | 69 | list(APPEND commands | ||
49 | COMMAND ${PYTHON_EXECUTABLE} | 70 | COMMAND ${PYTHON_EXECUTABLE} | ||
50 | -B | 71 | -B | ||
51 | ${_ki18n_pmap_compile_script} | 72 | ${_ki18n_pmap_compile_script} | ||
52 | ${PO_DIR}/${pmap_file} | 73 | ${PO_DIR}/${pmap_file} | ||
53 | ${pmapc_file} | 74 | ${pmapc_file} | ||
54 | RESULT_VARIABLE code | 75 | RESULT_VARIABLE code | ||
sitter: This doesn't belong here, does it? It's also defined in execute_process() and from looking at… | |||||
55 | ) | 76 | ) | ||
56 | if(code) | 77 | math(EXPR i "${i}+1") | ||
57 | message(FATAL_ERROR "failed at creating ${pmap_file}...") | 78 | if (i GREATER ${numberOfProcesses}) | ||
79 | _processCommands() | ||||
80 | set(i 0) | ||||
58 | endif() | 81 | endif() | ||
59 | endforeach() | 82 | endforeach() | ||
83 | | ||||
84 | _processCommands() |
This doesn't belong here, does it? It's also defined in execute_process() and from looking at the docs it would only be set once.