Skip to content

Commit

Permalink
Update CMakeLists file for Praat subdirs, following limited include d…
Browse files Browse the repository at this point in the history
…irectories to avoid confusion over the wrong machine.h include
  • Loading branch information
YannickJadoul committed Aug 11, 2024
1 parent 99ebc11 commit e779efd
Show file tree
Hide file tree
Showing 26 changed files with 88 additions and 40 deletions.
20 changes: 12 additions & 8 deletions praat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with Parselmouth. If not, see <http://www.gnu.org/licenses/>

function(add_praat_subdir)
cmake_parse_arguments(ARG "" "" "SOURCES;INCLUDE_DIRS" ${ARGN})

target_sources(praat PRIVATE ${ARG_SOURCES})
get_target_property(PRAAT_SOURCE_DIR praat SOURCE_DIR)
list(TRANSFORM ARG_INCLUDE_DIRS PREPEND "${PRAAT_SOURCE_DIR}/" OUTPUT_VARIABLE ABSOLUTE_INCLUDE_DIRS)
set_source_files_properties(${ARG_SOURCES} DIRECTORY "${PRAAT_SOURCE_DIR}" PROPERTIES INCLUDE_DIRECTORIES "${ABSOLUTE_INCLUDE_DIRS}")
endfunction()

set(PRAAT_SUBDIRECTORIES
external/clapack
external/gsl
Expand Down Expand Up @@ -42,13 +51,8 @@ set(PRAAT_SUBDIRECTORIES
artsynth
)

set(PRAAT_INCLUDE_DIRS
${PRAAT_SUBDIRECTORIES}
external/opusfile/opus
external/opusfile/opus/celt
external/opusfile/opus/silk
external/opusfile/opus/silk/float
)
set(PRAAT_INCLUDE_DIRS ${PRAAT_SUBDIRECTORIES})
list(FILTER PRAAT_INCLUDES EXCLUDE REGEX "^external/")

set(PRAAT_FLAGS)
set(PRAAT_FLAGS_PRIVATE)
Expand Down Expand Up @@ -86,7 +90,7 @@ foreach(SUBDIR ${PRAAT_SUBDIRECTORIES})
add_subdirectory(${SUBDIR})
endforeach()

target_include_directories(praat PUBLIC ${PRAAT_INCLUDE_DIRS})
target_include_directories(praat INTERFACE ${PRAAT_INCLUDE_DIRS})
target_compile_definitions(praat PUBLIC ${PRAAT_DEFINITIONS} PRIVATE ${PRAAT_DEFINITIONS_PRIVATE})
target_compile_options(praat PUBLIC ${PRAAT_FLAGS} PRIVATE ${PRAAT_FLAGS_PRIVATE})
target_link_libraries(praat PUBLIC fmt::fmt)
Expand Down
4 changes: 3 additions & 1 deletion praat/EEG/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
EEG.cpp EEGArea.cpp EEGAnalysisArea.cpp
EEGWindow.cpp ERPTier.cpp ERP.cpp ERPArea.cpp ERPWindow.cpp
praat_EEG.cpp manual_EEG.cpp
INCLUDE_DIRS
kar melder sys dwsys stat dwtools fon foned
)
4 changes: 3 additions & 1 deletion praat/FFNet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
FFNet.cpp
FFNet_Eigen.cpp FFNet_Matrix.cpp FFNet_PatternList.cpp
FFNet_ActivationList_Categories.cpp FFNet_PatternList_ActivationList.cpp
FFNet_PatternList_Categories.cpp
praat_FFNet_init.cpp manual_FFNet.cpp
INCLUDE_DIRS
kar melder sys dwtools fon dwsys stat gram
)
4 changes: 3 additions & 1 deletion praat/LPC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Cepstrum.cpp Cepstrumc.cpp Cepstrum_and_Spectrum.cpp
Cepstrogram.cpp
Formant_extensions.cpp
Expand All @@ -16,4 +16,6 @@ target_sources(praat PRIVATE
Sound_and_Cepstrum.cpp Tube.cpp
VocalTractTier.cpp
praat_LPC_init.cpp manual_LPC.cpp
INCLUDE_DIRS
LPC kar melder fon foned dwtools sys dwsys stat
)
4 changes: 3 additions & 1 deletion praat/artsynth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Speaker.cpp Articulation.cpp Artword.cpp
Art_Speaker.cpp Art_Speaker_to_VocalTract.cpp Artword_Speaker.cpp Artword_Speaker_Sound.cpp
Artword_Speaker_to_Sound.cpp Artword_to_Art.cpp
Delta.cpp Speaker_to_Delta.cpp Art_Speaker_Delta.cpp
ArtwordEditor.cpp praat_Artsynth.cpp manual_Artsynth.cpp
INCLUDE_DIRS
kar melder sys fon stat
)
5 changes: 3 additions & 2 deletions praat/dwsys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
ChebyshevSeries.cpp Collection_extensions.cpp Command.cpp
DoublyLinkedList.cpp Eigen.cpp
FileInMemory.cpp FileInMemorySet.cpp FileInMemoryManager.cpp
Expand All @@ -13,5 +13,6 @@ target_sources(praat PRIVATE
Polynomial.cpp
Roots.cpp
Spline.cpp SVD.cpp WorkvectorPool.cpp
NUMmachar.cpp
INCLUDE_DIRS
melder stat sys fon external/gsl external/clapack kar dwtools
)
4 changes: 3 additions & 1 deletion praat/dwtools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
ActivationList.cpp AffineTransform.cpp AnalyticSound.cpp
Categories.cpp CategoriesEditor.cpp
Categories_and_Strings.cpp CCA.cpp CCA_and_Correlation.cpp
Expand Down Expand Up @@ -53,4 +53,6 @@ target_sources(praat PRIVATE
TextGridTierNavigator.cpp TextGridNavigator.cpp Vector_extensions.cpp VowelEditor.cpp
praat_MDS_init.cpp praat_BSS_init.cpp praat_HMM_init.cpp
praat_KlattGrid_init.cpp praat_MultiSampledSpectrogram.cpp praat_DataModeler_init.cpp praat_David_init.cpp
INCLUDE_DIRS
dwtools kar melder LPC fon foned sys stat dwsys external/portaudio external/espeak external/clapack EEG external/vorbis external/opusfile
)
4 changes: 3 additions & 1 deletion praat/external/clapack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
blas.cpp
lapack.cpp lapack_dg.cpp lapack_dlaq.cpp
lapack_dlar.cpp lapack_ds.cpp lapack_dt.cpp
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/external/espeak/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
case.cpp categories.cpp common.cpp compiledata.cpp compiledict.cpp
dictionary.cpp
encoding.cpp error.cpp espeak_api.cpp
Expand All @@ -10,4 +10,6 @@ target_sources(praat PRIVATE
create_espeak_ng_FileInMemoryManager.cpp
create_espeak_ng_FileInMemorySet__ru.cpp create_espeak_ng_FileInMemorySet.cpp
espeak_io.cpp
INCLUDE_DIRS
kar melder dwtools sys dwsys stat
)
6 changes: 4 additions & 2 deletions praat/external/flac/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
flac_bitmath.c
flac_bitreader.c
flac_bitwriter.c
Expand All @@ -16,7 +16,9 @@ target_sources(praat PRIVATE
flac_stream_encoder.c
flac_stream_encoder_framing.c
flac_window.c
INCLUDE_DIRS
melder
)
if (WIN32)
target_sources(praat PRIVATE flac_windows_unicode_filenames.c)
add_praat_subdir(SOURCES flac_windows_unicode_filenames.c INCLUDE_DIRS melder)
endif ()
2 changes: 1 addition & 1 deletion praat/external/glpk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
amd_1.c amd_2.c amd_aat.c amd_control.c amd_defaults.c amd_info.c
amd_order.c amd_post_tree.c amd_postorder.c amd_preprocess.c amd_valid.c
colamd.c
Expand Down
2 changes: 1 addition & 1 deletion praat/external/gsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
gsl_blas__blas.c gsl_block__block.c gsl_block__file.c
gsl_block__init.c gsl_bspline__bspline.c gsl_cblas__caxpy.c
gsl_cblas__ccopy.c gsl_cblas__cdotc_sub.c gsl_cblas__cdotu_sub.c
Expand Down
4 changes: 3 additions & 1 deletion praat/external/lame/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
bitstream.c encoder.c fft.c gain_analysis.c mpglib_interface.c id3tag.c lame.c
newmdct.c psymodel.c quantize.c quantize_pvt.c set_get.c vbrquantize.c
reservoir.c tables.c takehiro.c util.c VbrTag.c
version.c presets.c vector_xmm_quantize_sub.c
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/external/mp3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
mp3.cpp
mad_bit.c
mad_decoder.c
Expand All @@ -11,4 +11,6 @@ target_sources(praat PRIVATE
mad_synth.c
mad_timer.c
mad_version.c
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/external/opusfile/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
opusfile.cpp opusfile_info.cpp opusfile_internal.cpp opusfile_stream.cpp
opus/analysis.c opus/mlp.c opus/opus.c opus/opus_decoder.c opus/opus_multistream.c
opus/mapping_matrix.c opus/mlp_data.c opus/opus_multistream_decoder.c
Expand Down Expand Up @@ -33,4 +33,6 @@ target_sources(praat PRIVATE
opus/silk/float/process_gains_FLP.c opus/silk/float/regularize_correlations_FLP.c opus/silk/float/residual_energy_FLP.c
opus/silk/float/scale_copy_vector_FLP.c opus/silk/float/scale_vector_FLP.c opus/silk/float/schur_FLP.c opus/silk/float/sort_FLP.c
opus/silk/float/warped_autocorrelation_FLP.c opus/silk/float/wrappers_FLP.c
INCLUDE_DIRS
melder external/vorbis external/opusfile/opus external/opusfile/opus/celt external/opusfile/opus/silk external/opusfile/opus/silk/float
)
13 changes: 7 additions & 6 deletions praat/external/portaudio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
target_sources(praat PRIVATE
add_praat_subdir(
SOURCES
pa_linux_alsa.c pa_jack.c pa_ringbuffer.c
pa_front.c pa_debugprint.c pa_cpuload.c
pa_allocation.c pa_process.c pa_converters.c pa_dither.c
pa_stream.c
)

if (UNIX)
target_sources(praat PRIVATE pa_unix_hostapis.c pa_unix_util.c)
add_praat_subdir(SOURCES pa_unix_hostapis.c pa_unix_util.c)

if (CMAKE_SYSTEM_NAME EQUAL "Linux")
target_sources(praat PRIVATE pa_linux_alsa.c)
add_praat_subdir(SOURCES pa_linux_alsa.c)
elseif(CMAKE_SYSTEM_NAME EQUAL "Darwin")
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
pa_mac_core_blocking.c pa_mac_core_utilities.c pa_mac_core.c pa_mac_hostapis.c pa_mac_util.c
pa_jack.c pa_ringbuffer.c pa_trace.c
)
endif()
elseif (WIN32)
target_sources(praat PRIVATE pa_win_hostapis.c pa_win_util.c pa_win_wmme.c pa_win_waveformat.c)
add_praat_subdir(SOURCES pa_win_hostapis.c pa_win_util.c pa_win_wmme.c pa_win_waveformat.c)
endif ()
4 changes: 3 additions & 1 deletion praat/external/vorbis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
ogg_bitwise.cpp ogg_framing.cpp
vorbis_block.cpp vorbis_bitrate.cpp vorbis_codebook.cpp vorbis_envelope.cpp vorbis_floor0.cpp
vorbis_info.cpp vorbis_mdct.cpp vorbisfile.cpp vorbis_floor0.cpp vorbis_floor1.cpp vorbis_lpc.cpp vorbis_lsp.cpp
vorbis_mapping0.cpp vorbis_psy.cpp vorbis_registry.cpp vorbis_res0.cpp vorbis_sharedbook.cpp vorbis_smallft.cpp
vorbis_synthesis.cpp vorbis_window.cpp
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/fon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Transition.cpp Distributions_and_Transition.cpp
Function.cpp Sampled.cpp SampledXY.cpp Matrix.cpp Vector.cpp Polygon.cpp PointProcess.cpp
Matrix_and_PointProcess.cpp Matrix_and_Polygon.cpp AnyTier.cpp RealTier.cpp
Expand Down Expand Up @@ -30,4 +30,6 @@ target_sources(praat PRIVATE
manual_pointProcess.cpp manual_annotation.cpp
praat_TimeFunction.cpp praat_TimeTier.cpp praat_TimeFrameSampled.cpp
praat_Sound.cpp praat_Matrix.cpp praat_Tiers.cpp praat_TextGrid_init.cpp praat_uvafon_init.cpp
INCLUDE_DIRS
kar melder sys dwsys stat dwtools LPC foned fon external/portaudio external/flac external/mp3 external/espeak
)
4 changes: 3 additions & 1 deletion praat/foned/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
SoundRecorder.cpp
FunctionArea.cpp SoundArea.cpp SoundAnalysisArea.cpp TextGridArea.cpp
SpectrumArea.cpp PointArea.cpp PitchArea.cpp SpectrogramArea.cpp
Expand All @@ -10,4 +10,6 @@ target_sources(praat PRIVATE
DurationTierEditor.cpp AmplitudeTierEditor.cpp
ManipulationEditor.cpp TextGridEditor.cpp FormantGridEditor.cpp
RunnerMFC.cpp MovieWindow.cpp
INCLUDE_DIRS
kar melder sys dwsys stat dwtools LPC fon external/portaudio external/flac external/mp3 external/espeak
)
4 changes: 3 additions & 1 deletion praat/gram/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Network.cpp
OTGrammar.cpp OTGrammarEditor.cpp manual_gram.cpp praat_gram.cpp OTMulti.cpp OTMultiEditor.cpp
OTGrammar_ex_metrics.cpp OTGrammar_ex_NoCoda.cpp OTGrammar_ex_NPA.cpp OTGrammar_ex_tongueRoot.cpp
OTMulti_ex_metrics.cpp Layer.cpp Net.cpp
NoulliGrid.cpp NoulliGridArea.cpp NoulliGridEditor.cpp CubeGrid.cpp CubeGridArea.cpp CubeGridEditor.cpp
INCLUDE_DIRS
kar melder sys dwsys stat dwtools fon foned
)
4 changes: 3 additions & 1 deletion praat/kar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
ipaSerifRegularPS.cpp longchar.cpp wctype_portable.cpp
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/melder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
melder.cpp complex.cpp melder_alloc.cpp melder_str32.cpp melder_colour.cpp
melder_ftoa.cpp melder_console.cpp melder_textencoding.cpp melder_atof.cpp melder_files.cpp
melder_sort.cpp melder_debug.cpp MelderFile.cpp melder_strings.cpp
Expand All @@ -10,4 +10,6 @@ target_sources(praat PRIVATE
NUMmath.cpp
NUMspecfunc.cpp NUMear.cpp NUMinterpol.cpp NUMmetrics.cpp NUMrandom.cpp NUMfilter.cpp NUMlinprog.cpp
NUM.cpp STR.cpp VEC.cpp MAT.cpp STRVEC.cpp
INCLUDE_DIRS
melder
)
4 changes: 3 additions & 1 deletion praat/sensors/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Electroglottogram.cpp EMA.cpp EMArawData.cpp praat_sensors_init.cpp
INCLUDE_DIRS
melder stat sys fon external/gsl external/clapack kar dwtools
)
4 changes: 3 additions & 1 deletion praat/stat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Table.cpp TableEditor.cpp Regression.cpp manual_statistics.cpp
praat_TableOfReal.cpp praat_Stat.cpp
TableOfReal.cpp Distributions.cpp Distributions_and_Strings.cpp PairDistribution.cpp
LogisticRegression.cpp
INCLUDE_DIRS
kar melder sys dwsys dwtools fon foned stat
)
4 changes: 3 additions & 1 deletion praat/sys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(praat PRIVATE
add_praat_subdir(SOURCES
Thing.cpp Data.cpp Simple.cpp Collection.cpp Strings.cpp
Graphics.cpp Graphics_linesAndAreas.cpp Graphics_text.cpp Graphics_colour.cpp
Graphics_image.cpp Graphics_record.cpp
Expand All @@ -17,4 +17,6 @@ target_sources(praat PRIVATE
GuiMenu.cpp GuiMenuItem.cpp GuiButton.cpp GuiLabel.cpp GuiCheckButton.cpp GuiRadioButton.cpp
GuiDialog.cpp GuiList.cpp GuiFileSelect.cpp GuiScale.cpp GuiScrollBar.cpp GuiScrolledWindow.cpp
GuiControl.cpp GuiForm.cpp GuiOptionMenu.cpp GuiProgressBar.cpp GuiShell.cpp GuiThing.cpp Gui_messages.cpp
INCLUDE_DIRS
kar melder sys dwsys
)
4 changes: 3 additions & 1 deletion res/etc/makefilelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with Parselmouth. If not, see <http://www.gnu.org/licenses/>

SCRIPT_PATH=$(realpath res/etc/praat_makefile_to_cmake.py)

for SUBDIR in $(find . -mindepth 3 -name 'Makefile' | xargs dirname)
do
if [ -f "$SUBDIR/CMakeLists.txt" ]
then
pushd "$SUBDIR" > /dev/null
CONTENTS=$(egrep -o '([[:graph:]]+\.o *)+' Makefile | sed 's|$(CELT)|opus/celt/|g' | sed 's|$(SILK)|opus/silk/|g' | sed 's|$(SILKFLOAT)|opus/silk/float/|g' | sed -E 's/([[:graph:]]+)\.o/ls \1.c* | tr "\n" " " ;/ge' | sed '1!s/^/\t/g' | sed 's/ $//' | sed '1s/^/target_sources(praat PRIVATE\n\t/' | sed '$s/$/\n)/') && cmp -s CMakeLists.txt <<< "$CONTENTS" || meld CMakeLists.txt <(echo "$CONTENTS")
CONTENTS=$(python $SCRIPT_PATH Makefile) && cmp -s CMakeLists.txt <<< "$CONTENTS" || meld CMakeLists.txt <(echo "$CONTENTS")
popd > /dev/null
fi
done

0 comments on commit e779efd

Please sign in to comment.