Skip to content

Commit 746b18c

Browse files
committed
Cleanup cmakelists
1 parent 90e4088 commit 746b18c

File tree

34 files changed

+89
-91
lines changed

34 files changed

+89
-91
lines changed

examples/examples-desktop/generator/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_executable (generator generator.ino)
1818

1919
# set preprocessor defines
2020
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN)
21-
target_compile_definitions(generator PUBLIC -DARDUINO -DIS_DESKTOP -DEXIT_ON_STOP)
21+
target_compile_definitions(generator PUBLIC -DARDUINO -DIS_DESKTOP)
2222

2323
# specify libraries
2424
target_link_libraries(generator portaudio arduino_emulator arduino-audio-tools)

examples/examples-desktop/min-generator/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set_source_files_properties(min-generator.ino PROPERTIES LANGUAGE CXX)
2121
add_executable (min-generator min-generator.ino)
2222

2323
# set preprocessor defines
24-
target_compile_definitions(min-generator PUBLIC -DIS_MIN_DESKTOP -DEXIT_ON_STOP)
24+
target_compile_definitions(min-generator PUBLIC -DIS_MIN_DESKTOP)
2525

2626
# specify libraries
2727
target_link_libraries(min-generator arduino-audio-tools)

examples/examples-desktop/mp3/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ add_executable (mp3_dt mp3.ino)
2727
# set preprocessor defines
2828
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN)
2929
target_compile_definitions(arduino_helix PUBLIC -DARDUINO -DHELIX_LOGGING_ACTIVE=0)
30-
target_compile_definitions(mp3_dt PUBLIC -DIS_DESKTOP -DEXIT_ON_STOP)
30+
target_compile_definitions(mp3_dt PUBLIC -DIS_DESKTOP)
3131

3232
# OS/X might need this setting for core audio
3333
target_compile_options(portaudio PRIVATE -Wno-deprecated)

examples/examples-dsp/examples-stk/streams-stk-desktop/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ add_executable (stk_example streams-stk-desktop.ino)
2626

2727
# set preprocessor defines
2828
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN)
29-
target_compile_definitions(stk_example PUBLIC -DARDUINO -DIS_DESKTOP -DEXIT_ON_STOP)
29+
target_compile_definitions(stk_example PUBLIC -DARDUINO -DIS_DESKTOP)
3030
target_compile_definitions(arduino-stk PUBLIC -DIS_DESKTOP)
3131

3232
# OS/X might need this setting for core audio

examples/examples-dsp/examples-stk/streams-stk_allinstruments-audiokit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ add_executable (arduino_sketch ${SKETCH})
2727

2828
# set preprocessor defines
2929
target_compile_definitions(arduino_emulator PUBLIC -DDEFINE_MAIN)
30-
target_compile_definitions(arduino_sketch PUBLIC -DARDUINO -DIS_DESKTOP -DEXIT_ON_STOP)
30+
target_compile_definitions(arduino_sketch PUBLIC -DARDUINO -DIS_DESKTOP)
3131
target_compile_definitions(arduino-stk PUBLIC -DIS_DESKTOP)
3232

3333
# OS/X might need this setting for core audio

src/AudioConfig.h

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,41 @@
55
*
66
*/
77
#pragma once
8+
9+
#define AUDIOTOOLS_VERSION "1.0.0"
10+
#define AUDIOTOOLS_MAJOR_VERSION 1
11+
#define AUDIOTOOLS_MIOR_VERSION 0
12+
13+
814
#if defined(IS_MIN_DESKTOP)
15+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
16+
# include "AudioTools/AudioLibs/Desktop/Time.h"
17+
# include "AudioTools/AudioLibs/Desktop/Main.h"
18+
# include "AudioTools/AudioLibs/Desktop/File.h"
19+
# define USE_STREAM_READ_OVERRIDE
920
# ifndef EXIT_ON_STOP
1021
# define EXIT_ON_STOP
1122
# endif
12-
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
1323
#elif defined(IS_DESKTOP_WITH_TIME_ONLY)
24+
# include "AudioTools/AudioLibs/Desktop/Time.h"
25+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
1426
# ifndef EXIT_ON_STOP
1527
# define EXIT_ON_STOP
1628
# endif
17-
# include "AudioTools/AudioLibs/Desktop/Time.h"
18-
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
1929
#elif defined(IS_DESKTOP)
30+
# include "Arduino.h"
31+
# include <Client.h>
32+
# include <WiFi.h>
33+
# define USE_WIFI
34+
# define USE_URL_ARDUINO
35+
# define USE_STREAM_WRITE_OVERRIDE
36+
# define USE_STREAM_READ_OVERRIDE
37+
# define USE_STREAM_READCHAR_OVERRIDE
2038
# ifndef EXIT_ON_STOP
2139
# define EXIT_ON_STOP
2240
# endif
23-
# include "Arduino.h"
41+
//# define USE_3BYTE_INT24
42+
typedef WiFiClient WiFiClientSecure;
2443
#elif defined(ARDUINO)
2544
# include "Arduino.h"
2645
// --- ESP32 ------------
@@ -32,21 +51,21 @@
3251
#else
3352
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
3453
# define IS_JUPYTER
54+
# define USE_STREAM_READ_OVERRIDE
3555
#endif
56+
3657
#include <string.h>
3758
#include <stdint.h>
3859
#include <assert.h>
3960
#include "AudioTools/CoreAudio/AudioRuntime.h"
4061

62+
63+
4164
// If you don't want to use all the settings from here you can define your own local config settings in AudioConfigLocal.h
4265
#if __has_include("AudioConfigLocal.h")
4366
#include "AudioConfigLocal.h"
4467
#endif
4568

46-
#define AUDIOTOOLS_VERSION "1.0.0"
47-
#define AUDIOTOOLS_MAJOR_VERSION 1
48-
#define AUDIOTOOLS_MIOR_VERSION 0
49-
5069
// Automatically include all core audio functionality
5170
#ifndef AUDIO_INCLUDE_CORE
5271
# define AUDIO_INCLUDE_CORE true
@@ -82,18 +101,20 @@
82101
# define LOG_STREAM Serial
83102
#endif
84103

85-
#define LOG_PRINTF_BUFFER_SIZE 303
86-
#define LOG_METHOD __PRETTY_FUNCTION__
104+
#ifndef LOG_PRINTF_BUFFER_SIZE
105+
# define LOG_PRINTF_BUFFER_SIZE 303
106+
#endif
87107

88-
// cheange USE_CHECK_MEMORY to true to activate memory checks
89-
#define USE_CHECK_MEMORY false
108+
#ifndef LOG_METHOD
109+
# define LOG_METHOD __PRETTY_FUNCTION__
110+
#endif
90111

91-
#if USE_CHECK_MEMORY
92-
# define CHECK_MEMORY() checkMemory(true)
93-
#else
94-
# define CHECK_MEMORY()
112+
// cheange USE_CHECK_MEMORY to true to activate memory checks
113+
#ifndef USE_CHECK_MEMORY
114+
# define USE_CHECK_MEMORY false
95115
#endif
96116

117+
97118
// Activate/deactivate obsolete functionality
98119
#ifndef USE_OBSOLETE
99120
# define USE_OBSOLETE false
@@ -732,44 +753,13 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure;
732753
#define VS1053_DEFAULT_VOLUME 0.7
733754

734755

735-
736756
//----------------
737-
738-
// Full Arduino functionality using emulator
739-
#ifdef IS_DESKTOP
740-
# include <Client.h>
741-
# include <WiFi.h>
742-
# define USE_WIFI
743-
# define USE_URL_ARDUINO
744-
# define USE_STREAM_WRITE_OVERRIDE
745-
# define USE_STREAM_READ_OVERRIDE
746-
# define USE_STREAM_READCHAR_OVERRIDE
747-
//# define USE_3BYTE_INT24
748-
typedef WiFiClient WiFiClientSecure;
749-
#endif
750-
751-
// Minimum desktop functionality w/o Arduino emulator
752-
#ifdef IS_MIN_DESKTOP
753-
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
754-
# include "AudioTools/AudioLibs/Desktop/Time.h"
755-
# include "AudioTools/AudioLibs/Desktop/Main.h"
756-
# include "AudioTools/AudioLibs/Desktop/File.h"
757-
# define USE_STREAM_READ_OVERRIDE
758-
#endif
757+
// Fallback defined if nothing was defined in the platform
759758

760759
#ifndef ARDUINO
761760
# define USE_STREAM_WRITE_OVERRIDE
762761
#endif
763762

764-
#ifdef IS_JUPYTER
765-
# define USE_STREAM_READ_OVERRIDE
766-
#endif
767-
768-
#ifdef AUDIOKIT_USE_IDF
769-
# define USE_INT24_FROM_INT
770-
#endif
771-
772-
773763
#ifndef ANALOG_MAX_SAMPLE_RATE
774764
# define ANALOG_MAX_SAMPLE_RATE 44100
775765
#endif
@@ -791,16 +781,6 @@ typedef WiFiClient WiFiClientSecure;
791781
# define USE_ALLOCATOR false
792782
#endif
793783

794-
// select int24 implementation
795-
#include "AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h"
796-
#include "AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h"
797-
namespace audio_tools {
798-
#ifdef USE_3BYTE_INT24
799-
using int24_t = audio_tools::int24_3bytes_t;
800-
#else
801-
using int24_t = audio_tools::int24_4bytes_t;
802-
#endif
803-
}
804784

805785
// Standard Arduino Print provides flush function
806786
#ifndef USE_PRINT_FLUSH
@@ -811,6 +791,12 @@ using int24_t = audio_tools::int24_4bytes_t;
811791
# define ESP_IDF_VERSION_VAL(a, b , c) 0
812792
#endif
813793

794+
#if USE_CHECK_MEMORY
795+
# define CHECK_MEMORY() checkMemory(true)
796+
#else
797+
# define CHECK_MEMORY()
798+
#endif
799+
814800
#pragma GCC diagnostic ignored "-Wunused-variable"
815801
#pragma GCC diagnostic ignored "-Wunused-function"
816802
#pragma GCC diagnostic ignored "-Wvla"
@@ -820,8 +806,20 @@ using int24_t = audio_tools::int24_4bytes_t;
820806
#ifdef USE_NO_MEMACCESS
821807
#pragma GCC diagnostic ignored "-Wclass-memaccess"
822808
#endif
809+
823810
#ifdef USE_INITIALIZER_LIST
824811
#pragma GCC diagnostic ignored "-Wnarrowing"
825812
#endif
826813

827814
#undef rewind
815+
816+
// select int24 implementation
817+
#include "AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h"
818+
#include "AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h"
819+
namespace audio_tools {
820+
#ifdef USE_3BYTE_INT24
821+
using int24_t = audio_tools::int24_3bytes_t;
822+
#else
823+
using int24_t = audio_tools::int24_4bytes_t;
824+
#endif
825+
}

tests-cmake/codec/aac-faad/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
add_executable (aac-faad aac-faad.cpp)
2828

2929
# set preprocessor defines
30-
target_compile_definitions(aac-faad PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_PORTAUDIO -DIS_DESKTOP -DANALYSIS)
30+
target_compile_definitions(aac-faad PUBLIC -DARDUINO -DUSE_PORTAUDIO -DIS_DESKTOP -DANALYSIS)
3131

3232
# OS/X might need this setting for core audio
3333
#target_compile_definitions(portaudio PUBLIC -DPA_USE_COREAUDIO=1)

tests-cmake/codec/aac-fdk-encode/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
# build sketch as executable
2828
add_executable (aac-fdk-encode aac-fdk-encode.cpp )
2929
# set preprocessor defines
30-
target_compile_definitions(aac-fdk-encode PUBLIC -DARDUINO -DEXIT_ON_STOP -DIS_DESKTOP)
30+
target_compile_definitions(aac-fdk-encode PUBLIC -DARDUINO -DIS_DESKTOP)
3131

3232
# specify libraries
3333
target_link_libraries(aac-fdk-encode arduino_emulator fdk_aac arduino-audio-tools)

tests-cmake/codec/aac-fdk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
add_executable (aac-fdk aac-fdk.cpp )
2828

2929
# set preprocessor defines
30-
target_compile_definitions(aac-fdk PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_PORTAUDIO -DIS_DESKTOP)
30+
target_compile_definitions(aac-fdk PUBLIC -DARDUINO -DUSE_PORTAUDIO -DIS_DESKTOP)
3131

3232
# OS/X might need this setting for core audio
3333
#target_compile_definitions(portaudio PUBLIC -DPA_USE_COREAUDIO=1)

tests-cmake/codec/aac-helix/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
add_executable (aac-helix aac-helix.cpp)
2828

2929
# set preprocessor defines
30-
target_compile_definitions(aac-helix PUBLIC -DARDUINO -DEXIT_ON_STOP -DUSE_PORTAUDIO -DIS_DESKTOP)
30+
target_compile_definitions(aac-helix PUBLIC -DARDUINO -DUSE_PORTAUDIO -DIS_DESKTOP)
3131

3232
# OS/X might need this setting for core audio
3333
#target_compile_definitions(portaudio PUBLIC -DPA_USE_COREAUDIO=1)

0 commit comments

Comments
 (0)