mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-18 06:31:20 +01:00
Visual Studio NuGet package handling was redone to correct a chicken and egg situation. (See the nuget_package() function in audacity/CMakeLists.txt. Due to the change in NuGet handling, was finally able to make the Audacity target dependent on several other targets. This ensures the destination directory is populated correctly. Library handling for system packages reworked to ensure the correct libraries are used and to "workaround" an issue where the libraries weren't being included in the link command...no idea why. New way is better anyway. Don't allow a system library for SBSMS since it seems we have a unique (Audacity-only???) version. Don't define wxDEBUG_LEVEL. It's not needed and causes duplicate symbol warnings. A couple of small changes to config files to remove libmad and libsndfile warnings. Do not include serdi.c and sordi.c in the LV2 build. Fix handling of static Lame and linked FFmpeg libs. Use cmake file() instead of gcc/awk to extract version information from Audacity.h for the Mac Info.plist. Use "cmake -E tar" to zip artifacts in github action.
190 lines
4.1 KiB
CMake
Executable File
190 lines
4.1 KiB
CMake
Executable File
|
|
set( TARGET locale )
|
|
set( TARGET_ROOT ${topdir}/locale )
|
|
|
|
message( STATUS "========== Configuring ${TARGET} ==========" )
|
|
|
|
def_vars()
|
|
|
|
list( APPEND SOURCES
|
|
af.po
|
|
ar.po
|
|
be.po
|
|
bg.po
|
|
bn.po
|
|
bs.po
|
|
ca.po
|
|
ca_ES@valencia.po
|
|
cs.po
|
|
cy.po
|
|
da.po
|
|
de.po
|
|
el.po
|
|
es.po
|
|
eu.po
|
|
eu_ES.po
|
|
fa.po
|
|
fi.po
|
|
fr.po
|
|
ga.po
|
|
gl.po
|
|
he.po
|
|
hi.po
|
|
hr.po
|
|
hu.po
|
|
hy.po
|
|
id.po
|
|
it.po
|
|
ja.po
|
|
ka.po
|
|
km.po
|
|
ko.po
|
|
lt.po
|
|
mk.po
|
|
my.po
|
|
nb.po
|
|
nl.po
|
|
oc.po
|
|
pl.po
|
|
pt_BR.po
|
|
pt_PT.po
|
|
ro.po
|
|
ru.po
|
|
sk.po
|
|
sl.po
|
|
sr_RS.po
|
|
sr_RS@latin.po
|
|
sv.po
|
|
ta.po
|
|
tg.po
|
|
tr.po
|
|
uk.po
|
|
vi.po
|
|
zh_CN.po
|
|
zh_TW.po
|
|
)
|
|
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
nuget_package( pkgdir "Gettext.Tools" "0.20.1.1" )
|
|
file( TO_NATIVE_PATH "${pkgdir}/tools/bin/msgfmt.exe" msgfmt )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
find_package( Gettext )
|
|
mark_as_advanced( FORCE GETTEXT_MSGFMT_EXECUTABLE )
|
|
mark_as_advanced( FORCE GETTEXT_MSGMERGE_EXECUTABLE )
|
|
|
|
if( GETTEXT_FOUND )
|
|
set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" )
|
|
else()
|
|
set( root "${CMAKE_CURRENT_BINARY_DIR}/usr/local" )
|
|
set( msgfmt "${CMAKE_CURRENT_BINARY_DIR}/msgfmt" )
|
|
|
|
if( NOT EXISTS "${root}" )
|
|
execute_process(
|
|
COMMAND
|
|
curl -L -o /tmp/gettext.pkg https://raw.githubusercontent.com/rudix-mac/packages/master/gettext-0.20.1-macos10.14.pkg
|
|
)
|
|
execute_process(
|
|
COMMAND
|
|
pkgutil --force --expand /tmp/gettext.pkg /tmp/gettext
|
|
)
|
|
execute_process(
|
|
COMMAND
|
|
tar -C "${CMAKE_CURRENT_BINARY_DIR}" -x -f /tmp/gettext/gettextinstall.pkg/Payload
|
|
)
|
|
execute_process(
|
|
COMMAND
|
|
rm -rf /tmp/gettext.pkg /tmp/gettext
|
|
)
|
|
endif()
|
|
|
|
file( WRITE ${CMAKE_BINARY_DIR}/msgfmt
|
|
"#!/bin/sh\n"
|
|
"export DYLD_LIBRARY_PATH=${root}/lib\n"
|
|
"${root}/bin/msgfmt \$@ \n"
|
|
)
|
|
|
|
file( COPY ${CMAKE_BINARY_DIR}/msgfmt
|
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
|
|
FILE_PERMISSIONS
|
|
OWNER_READ OWNER_EXECUTE
|
|
GROUP_READ GROUP_EXECUTE
|
|
WORLD_READ WORLD_EXECUTE
|
|
)
|
|
|
|
file( REMOVE ${CMAKE_BINARY_DIR}/msgfmt )
|
|
|
|
endif()
|
|
|
|
|
|
else()
|
|
|
|
find_package( Gettext )
|
|
if( GETTEXT_FOUND )
|
|
set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" )
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if( NOT DEFINED msgfmt )
|
|
message( WARNING "Gettext not found...translations will not be provided." )
|
|
return()
|
|
endif()
|
|
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
set( locale "${_DEST}/Resources" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" )
|
|
set( locale "${_DEST}/locale" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
set( locale "${_DEST}/Languanges" )
|
|
endif()
|
|
|
|
set( OUTPUTS )
|
|
foreach( source ${SOURCES} )
|
|
get_filename_component( lang "${source}" NAME_WE )
|
|
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
set( dst "${locale}/${lang}.lproj" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" )
|
|
set( dst "${locale}/${lang}/LC_MESSAGES" )
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
set( dst "${locale}/${lang}" )
|
|
endif()
|
|
|
|
set( po "${_SRCDIR}/${source}" )
|
|
set( mo "${dst}/audacity.mo" )
|
|
|
|
add_custom_command(
|
|
DEPENDS
|
|
"${po}"
|
|
COMMAND
|
|
"${CMAKE_COMMAND}" -E make_directory "${dst}"
|
|
COMMAND
|
|
"${msgfmt}" -o "${mo}" "${po}"
|
|
OUTPUT
|
|
"${mo}"
|
|
)
|
|
|
|
# Always make sure there's an empty English folder. Otherwise, some menu
|
|
# items will be translated to the next language listed in System
|
|
# Preferences/Language & Text
|
|
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|
add_custom_command(
|
|
COMMAND
|
|
${CMAKE_COMMAND} -E make_directory "${_DEST}/Resources/en.lproj"
|
|
OUTPUT
|
|
"${mo}"
|
|
APPEND
|
|
)
|
|
endif()
|
|
|
|
list( APPEND OUTPUTS ${mo} )
|
|
endforeach()
|
|
|
|
add_custom_target( "${TARGET}" ALL DEPENDS ${OUTPUTS} SOURCES "${SOURCES}" )
|
|
|
|
if( NOT "${CMAKE_GENERATOR}" MATCHES "Xcode|Visual Studio*" )
|
|
install( DIRECTORY ${locale}/
|
|
TYPE LOCALE )
|
|
endif()
|
|
|