@@ -31,7 +31,7 @@ function(_juce_add_pips) | |||
CONFIGURE_DEPENDS LIST_DIRECTORIES false | |||
"${CMAKE_CURRENT_SOURCE_DIR}/*.h") | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
list(REMOVE_ITEM headers | |||
"${CMAKE_CURRENT_SOURCE_DIR}/CameraDemo.h" | |||
"${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h" | |||
@@ -55,7 +55,6 @@ target_compile_definitions(DemoRunner PRIVATE | |||
PIP_JUCE_EXAMPLES_DIRECTORY_STRING="${JUCE_SOURCE_DIR}/examples" | |||
JUCE_ALLOW_STATIC_NULL_VARIABLES=0 | |||
JUCE_DEMO_RUNNER=1 | |||
JUCE_JACK=1 | |||
JUCE_STRICT_REFCOUNTEDPOINTER=1 | |||
JUCE_UNIT_TESTS=1 | |||
JUCE_USE_CAMERA=1 | |||
@@ -59,7 +59,7 @@ | |||
#include "../../../DSP/WaveShaperTanhDemo.h" | |||
#include "../../../Utilities/Box2DDemo.h" | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
#include "../../../Utilities/ChildProcessDemo.h" | |||
#endif | |||
#include "../../../Utilities/CryptographyDemo.h" | |||
@@ -104,7 +104,7 @@ void registerDemos_One() noexcept | |||
REGISTER_DEMO (WaveShaperTanhDemo, DSP, false) | |||
REGISTER_DEMO (Box2DDemo, Utilities, false) | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
REGISTER_DEMO (ChildProcessDemo, Utilities, false) | |||
#endif | |||
REGISTER_DEMO (CryptographyDemo, Utilities, false) | |||
@@ -33,7 +33,7 @@ | |||
#include "../../../GUI/AnimationAppDemo.h" | |||
#include "../../../GUI/AnimationDemo.h" | |||
#include "../../../GUI/BouncingBallWavetableDemo.h" | |||
#if JUCE_USE_CAMERA && ! JUCE_LINUX | |||
#if JUCE_USE_CAMERA && ! (JUCE_LINUX || JUCE_BSD) | |||
#include "../../../GUI/CameraDemo.h" | |||
#endif | |||
#if ! JUCE_ANDROID | |||
@@ -58,7 +58,7 @@ | |||
#include "../../../GUI/OpenGLDemo2D.h" | |||
#endif | |||
#include "../../../GUI/PropertiesDemo.h" | |||
#if ! JUCE_LINUX | |||
#if ! (JUCE_LINUX || JUCE_BSD) | |||
#include "../../../GUI/VideoDemo.h" | |||
#endif | |||
#include "../../../GUI/WebBrowserDemo.h" | |||
@@ -70,7 +70,7 @@ void registerDemos_Two() noexcept | |||
REGISTER_DEMO (AnimationAppDemo, GUI, false) | |||
REGISTER_DEMO (AnimationDemo, GUI, false) | |||
REGISTER_DEMO (BouncingBallWavetableDemo, GUI, false) | |||
#if JUCE_USE_CAMERA && ! JUCE_LINUX | |||
#if JUCE_USE_CAMERA && ! (JUCE_LINUX || JUCE_BSD) | |||
REGISTER_DEMO (CameraDemo, GUI, true) | |||
#endif | |||
#if ! JUCE_ANDROID | |||
@@ -95,7 +95,7 @@ void registerDemos_Two() noexcept | |||
REGISTER_DEMO (OpenGLDemo, GUI, true) | |||
#endif | |||
REGISTER_DEMO (PropertiesDemo, GUI, false) | |||
#if ! JUCE_LINUX | |||
#if ! (JUCE_LINUX || JUCE_BSD) | |||
REGISTER_DEMO (VideoDemo, GUI, true) | |||
#endif | |||
REGISTER_DEMO (WebBrowserDemo, GUI, true) | |||
@@ -29,7 +29,7 @@ | |||
#include "UI/MainComponent.h" | |||
//============================================================================== | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
// Just add a simple icon to the Window system tray area or Mac menu bar.. | |||
struct DemoTaskbarComponent : public SystemTrayIconComponent, | |||
private Timer | |||
@@ -96,7 +96,7 @@ public: | |||
{ | |||
registerAllDemos(); | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
// (This function call is for one of the demos, which involves launching a child process) | |||
if (invokeChildProcessDemo (commandLine)) | |||
return; | |||
@@ -144,7 +144,7 @@ private: | |||
setContentOwned (new MainComponent(), false); | |||
setVisible (true); | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC | |||
#if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
taskbarIcon.reset (new DemoTaskbarComponent()); | |||
#endif | |||
} | |||
@@ -702,6 +702,6 @@ private: | |||
updatePositionSliderAndLabel(); | |||
} | |||
}; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#error "This demo is not supported on Linux!" | |||
#endif |
@@ -25,7 +25,7 @@ function(_juce_create_atomic_target target_name) | |||
add_library("${target_name}" INTERFACE) | |||
add_library("juce::${target_name}" ALIAS "${target_name}") | |||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Linux")) | |||
if(NOT ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD"))) | |||
return() | |||
endif() | |||
@@ -137,7 +137,7 @@ function(_juce_find_linux_target_architecture result) | |||
set("${result}" "${match_result}" PARENT_SCOPE) | |||
endfunction() | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
_juce_create_pkgconfig_target(JUCE_CURL_LINUX_DEPS libcurl) | |||
_juce_create_pkgconfig_target(JUCE_BROWSER_LINUX_DEPS webkit2gtk-4.0 gtk+-x11-3.0) | |||
@@ -177,7 +177,7 @@ function(_juce_set_default_properties) | |||
set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "${prefix}/VST3") | |||
set_property(GLOBAL PROPERTY JUCE_AAX_COPY_DIR "${prefix}/Avid/Audio/Plug-Ins") | |||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/.vst") | |||
set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/.vst3") | |||
endif() | |||
@@ -553,7 +553,9 @@ function(juce_add_module module_path) | |||
target_link_libraries(juce_core INTERFACE juce::juce_atomic_wrapper) | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Android") | |||
if(CMAKE_SYSTEM_NAME MATCHES ".*BSD") | |||
target_link_libraries(juce_core INTERFACE execinfo) | |||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") | |||
target_sources(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c") | |||
target_include_directories(juce_core INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") | |||
target_link_libraries(juce_core INTERFACE android log) | |||
@@ -575,7 +577,7 @@ function(juce_add_module module_path) | |||
target_compile_definitions(${module_name} INTERFACE JUCE_MODULE_AVAILABLE_${module_name}=1) | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
target_compile_definitions(${module_name} INTERFACE LINUX=1) | |||
endif() | |||
@@ -613,7 +615,7 @@ function(juce_add_module module_path) | |||
endforeach() | |||
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" iOSLibs) | |||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
_juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages) | |||
if(module_linuxpackages) | |||
@@ -681,7 +683,7 @@ endfunction() | |||
# know they need it. Otherwise, we won't link anything. | |||
# See the NEEDS_CURL, NEEDS_WEB_BROWSER, and NEEDS_STORE_KIT options in the CMake/readme.md. | |||
function(_juce_link_optional_libraries target) | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
get_target_property(needs_curl ${target} JUCE_NEEDS_CURL) | |||
if(needs_curl) | |||
@@ -1346,7 +1348,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind) | |||
set(output_path "${products_folder}/${product_name}.vst3") | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
set_target_properties(${target_name} PROPERTIES | |||
SUFFIX .so | |||
LIBRARY_OUTPUT_DIRECTORY "${output_path}/Contents/${JUCE_LINUX_TARGET_ARCHITECTURE}-linux") | |||
@@ -1479,7 +1481,7 @@ function(_juce_link_plugin_wrapper shared_code_target kind) | |||
add_library(${target_name} MODULE) | |||
endif() | |||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")) | |||
target_link_libraries(${target_name} PRIVATE "-Wl,--no-undefined") | |||
endif() | |||
@@ -141,6 +141,8 @@ private: | |||
return "Windows"; | |||
#elif JUCE_LINUX | |||
return "Linux"; | |||
#elif JUCE_BSD | |||
return "BSD"; | |||
#endif | |||
} | |||
@@ -111,7 +111,7 @@ bool ProjucerApplication::initialiseLogger (const char* filePrefix) | |||
{ | |||
if (logger == nullptr) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
String folder = "~/.config/Projucer/Logs"; | |||
#else | |||
String folder = "com.juce.projucer"; | |||
@@ -717,7 +717,7 @@ static String getPlatformSpecificFileExtension() | |||
return ".app"; | |||
#elif JUCE_WINDOWS | |||
return ".exe"; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return {}; | |||
#else | |||
jassertfalse; | |||
@@ -738,7 +738,7 @@ static File getPlatformSpecificProjectFolder() | |||
return buildsFolder.getChildFile ("MacOSX"); | |||
#elif JUCE_WINDOWS | |||
return buildsFolder.getChildFile ("VisualStudio2017"); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return buildsFolder.getChildFile ("LinuxMakefile"); | |||
#else | |||
jassertfalse; | |||
@@ -775,8 +775,8 @@ static File tryToFindDemoRunnerExecutableInBuilds() | |||
if (demoRunnerExecutable.existsAsFile()) | |||
return demoRunnerExecutable; | |||
#elif JUCE_LINUX | |||
projectFolder = projectFolder.getChildFile ("LinuxMakefile").getChildFile ("build"); | |||
#elif JUCE_LINUX || JUCE_BSD | |||
projectFolder = projectFolder.getChildFile ("build"); | |||
auto demoRunnerExecutable = projectFolder.getChildFile ("DemoRunner"); | |||
if (demoRunnerExecutable.existsAsFile()) | |||
@@ -854,7 +854,7 @@ File ProjucerApplication::tryToFindDemoRunnerProject() | |||
auto demoRunnerProjectFile = projectFolder.getChildFile ("DemoRunner.xcodeproj"); | |||
#elif JUCE_WINDOWS | |||
auto demoRunnerProjectFile = projectFolder.getChildFile ("DemoRunner.sln"); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
auto demoRunnerProjectFile = projectFolder.getChildFile ("Makefile"); | |||
#endif | |||
@@ -883,33 +883,33 @@ void ProjucerApplication::launchDemoRunner() | |||
{ | |||
auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | |||
#if JUCE_LINUX || JUCE_BSD | |||
demoRunnerAlert.reset (lf.createAlertWindow ("Open Project", | |||
"Couldn't find a compiled version of the Demo Runner." | |||
#if JUCE_LINUX | |||
" Do you want to build it now?", "Build project", "Cancel", | |||
#else | |||
" Do you want to open the project?", "Open project", "Cancel", | |||
#endif | |||
{}, | |||
AlertWindow::QuestionIcon, 2, | |||
" Please compile the Demo Runner project in the JUCE examples directory.", | |||
"OK", {}, {}, | |||
AlertWindow::WarningIcon, 1, | |||
mainWindowList.getFrontmostWindow (false))); | |||
demoRunnerAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int) | |||
{ | |||
demoRunnerAlert.reset (nullptr); | |||
}), false); | |||
#else | |||
demoRunnerAlert.reset (lf.createAlertWindow ("Open Project", | |||
"Couldn't find a compiled version of the Demo Runner." | |||
" Do you want to open the project?", | |||
"Open project", "Cancel", {}, | |||
AlertWindow::QuestionIcon, 2, | |||
mainWindowList.getFrontmostWindow (false))); | |||
demoRunnerAlert->enterModalState (true, ModalCallbackFunction::create ([this, demoRunnerFile] (int retVal) | |||
{ | |||
demoRunnerAlert.reset (nullptr); | |||
if (retVal == 1) | |||
{ | |||
#if JUCE_LINUX | |||
String command ("make -C " + demoRunnerFile.getParentDirectory().getFullPathName() + " CONFIG=Release -j3"); | |||
if (! makeProcess.start (command)) | |||
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Error building Demo Runner."); | |||
#else | |||
demoRunnerFile.startAsProcess(); | |||
#endif | |||
} | |||
}), false); | |||
#endif | |||
} | |||
} | |||
@@ -998,18 +998,8 @@ void ProjucerApplication::getCommandInfo (CommandID commandID, ApplicationComman | |||
break; | |||
case CommandIDs::launchDemoRunner: | |||
#if JUCE_LINUX | |||
if (makeProcess.isRunning()) | |||
{ | |||
result.setInfo ("Building Demo Runner...", "The Demo Runner project is currently building", CommandCategories::general, 0); | |||
result.setActive (false); | |||
} | |||
else | |||
#endif | |||
{ | |||
result.setInfo ("Launch Demo Runner", "Launches the JUCE demo runner application, or the project if it can't be found", CommandCategories::general, 0); | |||
result.setActive (tryToFindDemoRunnerExecutable() != File() || tryToFindDemoRunnerProject() != File()); | |||
} | |||
result.setInfo ("Launch Demo Runner", "Launches the JUCE demo runner application, or the project if it can't be found", CommandCategories::general, 0); | |||
result.setActive (tryToFindDemoRunnerExecutable() != File() || tryToFindDemoRunnerProject() != File()); | |||
break; | |||
case CommandIDs::open: | |||
@@ -1426,7 +1416,7 @@ PropertiesFile::Options ProjucerApplication::getPropertyFileOptionsFor (const St | |||
options.applicationName = filename; | |||
options.filenameSuffix = "settings"; | |||
options.osxLibrarySubFolder = "Application Support"; | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
options.folderName = "~/.config/Projucer"; | |||
#else | |||
options.folderName = "Projucer"; | |||
@@ -220,9 +220,6 @@ private: | |||
std::unique_ptr<AlertWindow> demoRunnerAlert; | |||
bool hasScannedForDemoRunnerExecutable = false, hasScannedForDemoRunnerProject = false; | |||
File lastJUCEPath, lastDemoRunnerExectuableFile, lastDemoRunnerProjectFile; | |||
#if JUCE_LINUX | |||
ChildProcess makeProcess; | |||
#endif | |||
int selectedColourSchemeIndex = 0, selectedEditorColourSchemeIndex = 0; | |||
@@ -82,6 +82,8 @@ void LatestVersionCheckerAndUpdater::run() | |||
return "windows"; | |||
#elif JUCE_LINUX | |||
return "linux"; | |||
#elif JUCE_BSD | |||
return "bsd"; | |||
#else | |||
jassertfalse; | |||
return "Unknown"; | |||
@@ -444,7 +446,7 @@ private: | |||
if (threadShouldExit()) | |||
return Result::fail ("Cancelled"); | |||
#if JUCE_LINUX || JUCE_MAC | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_MAC | |||
r = setFilePermissions (unzipTarget.folder, zip); | |||
if (r.failed()) | |||
@@ -502,10 +504,10 @@ private: | |||
static void restartProcess (const File& targetFolder) | |||
{ | |||
#if JUCE_MAC || JUCE_LINUX | |||
#if JUCE_MAC || JUCE_LINUX || JUCE_BSD | |||
#if JUCE_MAC | |||
auto newProcess = targetFolder.getChildFile ("Projucer.app").getChildFile ("Contents").getChildFile ("MacOS").getChildFile ("Projucer"); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
auto newProcess = targetFolder.getChildFile ("Projucer"); | |||
#endif | |||
@@ -48,7 +48,7 @@ struct TargetOS | |||
return windows; | |||
#elif JUCE_MAC | |||
return osx; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return linux; | |||
#else | |||
return unknown; | |||
@@ -143,7 +143,7 @@ void LicenseController::logout() | |||
thread.reset(); | |||
updateState ({}); | |||
#if ! JUCE_LINUX | |||
#if ! (JUCE_LINUX || JUCE_BSD) | |||
WebBrowserComponent::clearCookies(); | |||
#endif | |||
@@ -187,7 +187,7 @@ void LicenseController::ensureLicenseWebviewIsOpenWithPage (const String& param) | |||
} | |||
else | |||
{ | |||
#if ! JUCE_LINUX | |||
#if ! (JUCE_LINUX || JUCE_BSD) | |||
WebBrowserComponent::clearCookies(); | |||
#endif | |||
@@ -96,7 +96,7 @@ struct CompileEngineDLL : private DeletedAtShutdown | |||
{ | |||
#if JUCE_MAC | |||
return "JUCECompileEngine.dylib"; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return "JUCECompileEngine.so"; | |||
#elif JUCE_WINDOWS | |||
return "JUCECompileEngine.dll"; | |||
@@ -35,7 +35,7 @@ | |||
#include "jucer_ProjectBuildInfo.h" | |||
#include "jucer_ClientServerMessages.h" | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#include <sys/types.h> | |||
#include <unistd.h> | |||
#endif | |||
@@ -95,7 +95,7 @@ private: | |||
return "OSX"; | |||
#elif JUCE_WINDOWS | |||
return "WINDOWS"; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return "LINUX"; | |||
#else | |||
// unknown platform?! | |||
@@ -1369,9 +1369,9 @@ void ProjectContentComponent::handleMissingSystemHeaders() | |||
#elif JUCE_WINDOWS | |||
String tabMessage ("Compiler not available due to missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK"); | |||
String alertWindowMessage ("Missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK"); | |||
#elif JUCE_LINUX | |||
String tabMessage ("Compiler not available due to missing system headers\nPlease do a sudo apt-get install ..."); | |||
String alertWindowMessage ("Missing system headers\nPlease do sudo apt-get install ..."); | |||
#elif JUCE_LINUX || JUCE_BSD | |||
String tabMessage ("Compiler not available due to missing system headers\nPlease insall using your package manager"); | |||
String alertWindowMessage ("Missing system headers\nPlease insall using your package manager"); | |||
#endif | |||
setBuildEnabled (false, true); | |||
@@ -112,7 +112,7 @@ public: | |||
static Identifier exporterName (XcodeProjectExporter::getValueTreeTypeNameMac()); | |||
#elif JUCE_WINDOWS | |||
static Identifier exporterName (CodeBlocksProjectExporter::getValueTreeTypeNameWindows()); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
static Identifier exporterName (MakefileProjectExporter::getValueTreeTypeName()); | |||
#else | |||
static Identifier exporterName; | |||
@@ -131,7 +131,7 @@ ProjectExporter::ExporterTypeInfo ProjectExporter::getCurrentPlatformExporterTyp | |||
return ProjectExporter::getTypeInfoForExporter (XcodeProjectExporter::getValueTreeTypeNameMac()); | |||
#elif JUCE_WINDOWS | |||
return ProjectExporter::getTypeInfoForExporter (MSVCProjectExporterVC2019::getValueTreeTypeName()); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return ProjectExporter::getTypeInfoForExporter (MakefileProjectExporter::getValueTreeTypeName()); | |||
#else | |||
#error "unknown platform!" | |||
@@ -119,6 +119,8 @@ public: | |||
return isWindows() || isAndroid(); | |||
#elif JUCE_LINUX | |||
return isLinux() || isAndroid(); | |||
#elif JUCE_BSD | |||
return isLinux(); | |||
#else | |||
#error | |||
#endif | |||
@@ -510,7 +510,7 @@ public: | |||
expect (referenceData.getSample (0, 10) < sv.getTargetValue()); | |||
expectWithinAbsoluteError (referenceData.getSample (0, 11), | |||
sv.getTargetValue(), | |||
1.0e-7f); | |||
2.0e-7f); | |||
auto getUnitData = [] (int numSamplesToGenerate) | |||
{ | |||
@@ -528,7 +528,7 @@ public: | |||
for (int i = 0; i < test.getNumSamples(); ++i) | |||
expectWithinAbsoluteError (test.getSample (0, i), | |||
reference.getSample (0, i), | |||
1.0e-7f); | |||
2.0e-7f); | |||
}; | |||
auto testData = getUnitData (numSamples); | |||
@@ -88,13 +88,13 @@ void AudioIODeviceType::callDeviceChangeListeners() | |||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ASIO() { return nullptr; } | |||
#endif | |||
#if JUCE_LINUX && JUCE_ALSA | |||
#if (JUCE_LINUX || JUCE_BSD) && JUCE_ALSA | |||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ALSA() { return createAudioIODeviceType_ALSA_PCMDevices(); } | |||
#else | |||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ALSA() { return nullptr; } | |||
#endif | |||
#if JUCE_LINUX && JUCE_JACK | |||
#if (JUCE_LINUX || JUCE_BSD) && JUCE_JACK | |||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return new JackAudioIODeviceType(); } | |||
#else | |||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return nullptr; } | |||
@@ -162,7 +162,7 @@ namespace ump = universal_midi_packets; | |||
#endif | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#if JUCE_ALSA | |||
/* Got an include error here? If so, you've either not got ALSA installed, or you've | |||
not got your paths set up correctly to find its header files. | |||
@@ -189,7 +189,7 @@ namespace ump = universal_midi_packets; | |||
#include "native/juce_linux_JackAudio.cpp" | |||
#endif | |||
#if JUCE_BELA | |||
#if (JUCE_LINUX && JUCE_BELA) | |||
/* Got an include error here? If so, you've either not got the bela headers | |||
installed, or you've not got your paths set up correctly to find its header | |||
files. | |||
@@ -108,7 +108,7 @@ public: | |||
*/ | |||
static std::unique_ptr<MidiInput> openDevice (const String& deviceIdentifier, MidiInputCallback* callback); | |||
#if JUCE_LINUX || JUCE_MAC || JUCE_IOS || DOXYGEN | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_IOS || DOXYGEN | |||
/** This will try to create a new midi input device (only available on Linux, macOS and iOS). | |||
This will attempt to create a new midi input device with the specified name for other | |||
@@ -268,7 +268,7 @@ public: | |||
*/ | |||
static std::unique_ptr<MidiOutput> openDevice (const String& deviceIdentifier); | |||
#if JUCE_LINUX || JUCE_MAC || JUCE_IOS || DOXYGEN | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_IOS || DOXYGEN | |||
/** This will try to create a new midi output device (only available on Linux, macOS and iOS). | |||
This will attempt to create a new midi output device with the specified name that other | |||
@@ -58,7 +58,7 @@ public: | |||
options.applicationName = getApplicationName(); | |||
options.filenameSuffix = ".settings"; | |||
options.osxLibrarySubFolder = "Application Support"; | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
options.folderName = "~/.config"; | |||
#else | |||
options.folderName = ""; | |||
@@ -188,7 +188,7 @@ namespace | |||
} | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
struct SharedMessageThread : public Thread | |||
{ | |||
@@ -364,7 +364,7 @@ public: | |||
JUCE_AUTORELEASEPOOL | |||
{ | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
MessageManagerLock mmLock; | |||
#endif | |||
stopTimer(); | |||
@@ -385,7 +385,7 @@ public: | |||
if (activePlugins.size() == 0) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
SharedMessageThread::deleteInstance(); | |||
#endif | |||
shutdownJuce_GUI(); | |||
@@ -1066,11 +1066,11 @@ public: | |||
{ | |||
setVisible (false); | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
addToDesktop (0, args.ptr); | |||
hostWindow = (HostWindowType) args.ptr; | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
X11Symbols::getInstance()->xReparentWindow (display, | |||
(Window) getWindowHandle(), | |||
(HostWindowType) hostWindow, | |||
@@ -1174,7 +1174,7 @@ public: | |||
{ | |||
const ScopedValueSetter<bool> resizingParentSetter (resizingParent, true); | |||
#if JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail. | |||
#if JUCE_LINUX || JUCE_BSD // setSize() on linux causes renoise and energyxt to fail. | |||
auto rect = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() }); | |||
X11Symbols::getInstance()->xResizeWindow (display, (Window) getWindowHandle(), | |||
@@ -1219,7 +1219,7 @@ public: | |||
#if JUCE_MAC | |||
setNativeHostWindowSizeVST (hostWindow, this, newWidth, newHeight, wrapper.useNSView); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
// (Currently, all linux hosts support sizeWindow, so this should never need to happen) | |||
setSize (newWidth, newHeight); | |||
#else | |||
@@ -1355,7 +1355,7 @@ public: | |||
float editorScaleFactor = 1.0f; | |||
juce::Rectangle<int> lastBounds; | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
using HostWindowType = ::Window; | |||
::Display* display = XWindowSystem::getInstance()->getDisplay(); | |||
#elif JUCE_WINDOWS | |||
@@ -2142,7 +2142,7 @@ namespace | |||
{ | |||
if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
MessageManagerLock mmLock; | |||
#endif | |||
@@ -2197,7 +2197,7 @@ namespace | |||
//============================================================================== | |||
// Linux startup code.. | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); | |||
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) | |||
@@ -36,7 +36,7 @@ | |||
#ifdef __INTEL_COMPILER | |||
#pragma warning (disable : 1899) | |||
#endif | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include <float.h> | |||
#include <sys/time.h> | |||
#include <arpa/inet.h> | |||
@@ -42,7 +42,7 @@ namespace juce | |||
#define JUCE_VST3_CAN_REPLACE_VST2 1 | |||
#endif | |||
#if JucePlugin_Build_VST3 && JUCE_VST3_CAN_REPLACE_VST2 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) | |||
#if JucePlugin_Build_VST3 && JUCE_VST3_CAN_REPLACE_VST2 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD) | |||
#define VST3_REPLACEMENT_AVAILABLE 1 | |||
// NB: Nasty old-fashioned code in here because it's copied from the Steinberg example code. | |||
@@ -38,7 +38,7 @@ void AudioPluginFormatManager::addDefaultFormats() | |||
{ | |||
ignoreUnused (format); | |||
#if JUCE_PLUGINHOST_VST && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_IOS) | |||
#if JUCE_PLUGINHOST_VST && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_IOS) | |||
jassert (dynamic_cast<VSTPluginFormat*> (format) == nullptr); | |||
#endif | |||
@@ -50,7 +50,7 @@ void AudioPluginFormatManager::addDefaultFormats() | |||
jassert (dynamic_cast<AudioUnitPluginFormat*> (format) == nullptr); | |||
#endif | |||
#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX | |||
#if JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD) | |||
jassert (dynamic_cast<LADSPAPluginFormat*> (format) == nullptr); | |||
#endif | |||
} | |||
@@ -60,7 +60,7 @@ void AudioPluginFormatManager::addDefaultFormats() | |||
formats.add (new AudioUnitPluginFormat()); | |||
#endif | |||
#if JUCE_PLUGINHOST_VST && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_IOS) | |||
#if JUCE_PLUGINHOST_VST && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_IOS) | |||
formats.add (new VSTPluginFormat()); | |||
#endif | |||
@@ -68,7 +68,7 @@ void AudioPluginFormatManager::addDefaultFormats() | |||
formats.add (new VST3PluginFormat()); | |||
#endif | |||
#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX | |||
#if JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD) | |||
formats.add (new LADSPAPluginFormat()); | |||
#endif | |||
} | |||
@@ -23,7 +23,7 @@ | |||
============================================================================== | |||
*/ | |||
#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX | |||
#if JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD) | |||
#include <ladspa.h> | |||
@@ -26,7 +26,7 @@ | |||
namespace juce | |||
{ | |||
#if (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX) || DOXYGEN | |||
#if (JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD)) || DOXYGEN | |||
//============================================================================== | |||
/** | |||
@@ -173,7 +173,7 @@ namespace | |||
{ | |||
#if JUCE_WINDOWS | |||
return timeGetTime() * 1000000.0; | |||
#elif JUCE_LINUX || JUCE_IOS || JUCE_ANDROID | |||
#elif JUCE_LINUX || JUCE_BSD || JUCE_IOS || JUCE_ANDROID | |||
timeval micro; | |||
gettimeofday (µ, nullptr); | |||
return (double) micro.tv_usec * 1000.0; | |||
@@ -230,7 +230,7 @@ static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect*, int32, int32, | |||
#endif | |||
//============================================================================== | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
namespace | |||
{ | |||
@@ -624,7 +624,7 @@ struct ModuleHandle : public ReferenceCountedObject | |||
{ | |||
getActiveModules().add (this); | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_IOS || JUCE_ANDROID | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_IOS || JUCE_ANDROID | |||
fullParentDirectoryPathName = f.getParentDirectory().getFullPathName(); | |||
#elif JUCE_MAC | |||
FSRef ref; | |||
@@ -644,7 +644,7 @@ struct ModuleHandle : public ReferenceCountedObject | |||
String fullParentDirectoryPathName; | |||
#endif | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_ANDROID | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
DynamicLibrary module; | |||
bool open() | |||
@@ -2108,7 +2108,7 @@ private: | |||
{ | |||
if (auto* ed = getActiveEditor()) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
const MessageManagerLock mmLock; | |||
#endif | |||
@@ -2742,7 +2742,7 @@ public: | |||
#endif | |||
plugin (plug) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
pluginWindow = None; | |||
ignoreUnused (pluginRefusesToResize, alreadyInside); | |||
#elif JUCE_MAC | |||
@@ -2827,7 +2827,7 @@ public: | |||
{ | |||
if (isOpen) | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
if (pluginWindow != 0) | |||
{ | |||
auto clip = g.getClipBounds(); | |||
@@ -2861,7 +2861,7 @@ public: | |||
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND }; | |||
MoveWindow (pluginHWND, pos.getX(), pos.getY(), pos.getWidth(), pos.getHeight(), TRUE); | |||
} | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
if (pluginWindow != 0) | |||
{ | |||
X11Symbols::getInstance()->xMoveResizeWindow (display, pluginWindow, | |||
@@ -2888,7 +2888,7 @@ public: | |||
if (auto* peer = getTopLevelComponent()->getPeer()) | |||
setScaleFactorAndDispatchMessage (peer->getPlatformScaleFactor()); | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
SafePointer<VSTPluginWindow> safeThis (this); | |||
MessageManager::callAsync ([this, safeThis] | |||
@@ -2963,7 +2963,7 @@ public: | |||
reentrantGuard = false; | |||
} | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
if (pluginWindow == 0) | |||
{ | |||
updatePluginWindowHandle(); | |||
@@ -2980,7 +2980,7 @@ public: | |||
{ | |||
ignoreUnused (e); | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
toFront (true); | |||
#endif | |||
} | |||
@@ -3138,7 +3138,7 @@ private: | |||
} | |||
} | |||
} | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
updatePluginWindowHandle(); | |||
int w = 250, h = 150; | |||
@@ -3206,7 +3206,7 @@ private: | |||
originalWndProc = 0; | |||
pluginHWND = 0; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
pluginWindow = 0; | |||
#endif | |||
} | |||
@@ -3287,7 +3287,7 @@ private: | |||
} | |||
#endif | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
void updatePluginWindowHandle() | |||
{ | |||
pluginWindow = getChildWindow ((Window) getWindowHandle()); | |||
@@ -3402,7 +3402,7 @@ private: | |||
HWND pluginHWND = {}; | |||
void* originalWndProc = {}; | |||
int sizeCheckCount = 0; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
::Display* display = XWindowSystem::getInstance()->getDisplay(); | |||
Window pluginWindow = 0; | |||
#endif | |||
@@ -3562,7 +3562,7 @@ bool VSTPluginFormat::fileMightContainThisPluginType (const String& fileOrIdenti | |||
return f.isDirectory() && f.hasFileExtension (".vst"); | |||
#elif JUCE_WINDOWS | |||
return f.existsAsFile() && f.hasFileExtension (".dll"); | |||
#elif JUCE_LINUX || JUCE_ANDROID | |||
#elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
return f.existsAsFile() && f.hasFileExtension (".so"); | |||
#endif | |||
} | |||
@@ -3616,7 +3616,7 @@ FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch() | |||
{ | |||
#if JUCE_MAC | |||
return FileSearchPath ("~/Library/Audio/Plug-Ins/VST;/Library/Audio/Plug-Ins/VST"); | |||
#elif JUCE_LINUX || JUCE_ANDROID | |||
#elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
return FileSearchPath (SystemStats::getEnvironmentVariable ("VST_PATH", | |||
"/usr/lib/vst;/usr/local/lib/vst;~/.vst") | |||
.replace (":", ";")); | |||
@@ -48,7 +48,7 @@ | |||
#endif | |||
#endif | |||
#if (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3) && JUCE_LINUX | |||
#if (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3) && (JUCE_LINUX || JUCE_BSD) | |||
#include <X11/Xlib.h> | |||
#include <X11/Xutil.h> | |||
#include <sys/utsname.h> | |||
@@ -68,7 +68,7 @@ | |||
namespace juce | |||
{ | |||
#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX) | |||
#if JUCE_PLUGINHOST_VST || (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX || JUCE_BSD) | |||
static bool arrayContainsPlugin (const OwnedArray<PluginDescription>& list, | |||
const PluginDescription& desc) | |||
@@ -290,7 +290,7 @@ PluginHostType::HostType PluginHostType::getHostType() | |||
if (hostFilename.containsIgnoreCase ("AudioPluginHost")) return JUCEPluginHost; | |||
if (hostFilename.containsIgnoreCase ("Vienna Ensemble Pro")) return ViennaEnsemblePro; | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
if (hostFilename.containsIgnoreCase ("Ardour")) return Ardour; | |||
if (hostFilename.startsWithIgnoreCase ("Waveform")) return TracktionWaveform; | |||
if (hostFilename.containsIgnoreCase ("Tracktion")) return TracktionGeneric; | |||
@@ -166,7 +166,7 @@ private: | |||
AudioCDReader (void* handle); | |||
int getIndexAt (int samplePos); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
AudioCDReader(); | |||
#endif | |||
@@ -81,7 +81,7 @@ | |||
#elif JUCE_ANDROID | |||
#include "native/juce_android_BluetoothMidiDevicePairingDialogue.cpp" | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#if JUCE_USE_CDREADER | |||
#include "native/juce_linux_AudioCDReader.cpp" | |||
#endif | |||
@@ -231,7 +231,7 @@ String File::addTrailingSeparator (const String& path) | |||
} | |||
//============================================================================== | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#define NAMES_ARE_CASE_SENSITIVE 1 | |||
#endif | |||
@@ -1061,7 +1061,25 @@ public: | |||
expect (! home.isOnCDRomDrive()); | |||
expect (File::getCurrentWorkingDirectory().exists()); | |||
expect (home.setAsCurrentWorkingDirectory()); | |||
expect (File::getCurrentWorkingDirectory() == home); | |||
{ | |||
auto homeParent = home; | |||
bool noSymlinks = true; | |||
while (! homeParent.isRoot()) | |||
{ | |||
if (homeParent.isSymbolicLink()) | |||
{ | |||
noSymlinks = false; | |||
break; | |||
} | |||
homeParent = homeParent.getParentDirectory(); | |||
} | |||
if (noSymlinks) | |||
expect (File::getCurrentWorkingDirectory() == home); | |||
} | |||
{ | |||
Array<File> roots; | |||
@@ -64,7 +64,7 @@ | |||
#endif | |||
#else | |||
#if JUCE_LINUX || JUCE_ANDROID | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
#include <sys/types.h> | |||
#include <sys/socket.h> | |||
#include <sys/errno.h> | |||
@@ -82,7 +82,7 @@ | |||
#include <sys/stat.h> | |||
#endif | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#include <stdio.h> | |||
#include <langinfo.h> | |||
#include <ifaddrs.h> | |||
@@ -206,6 +206,7 @@ | |||
#include "native/juce_mac_Files.mm" | |||
#include "native/juce_mac_Network.mm" | |||
#include "native/juce_mac_Strings.mm" | |||
#include "native/juce_intel_SharedCode.h" | |||
#include "native/juce_mac_SystemStats.mm" | |||
#include "native/juce_mac_Threads.mm" | |||
@@ -218,13 +219,16 @@ | |||
#include "native/juce_win32_Threads.cpp" | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include "native/juce_linux_CommonFile.cpp" | |||
#include "native/juce_linux_Files.cpp" | |||
#include "native/juce_linux_Network.cpp" | |||
#if JUCE_USE_CURL | |||
#include "native/juce_curl_Network.cpp" | |||
#endif | |||
#if JUCE_BSD | |||
#include "native/juce_intel_SharedCode.h" | |||
#endif | |||
#include "native/juce_linux_SystemStats.cpp" | |||
#include "native/juce_linux_Threads.cpp" | |||
@@ -258,7 +258,10 @@ | |||
#include <errno.h> | |||
#include <fcntl.h> | |||
#include <fnmatch.h> | |||
#include <ifaddrs.h> | |||
#include <langinfo.h> | |||
#include <net/if.h> | |||
#include <net/if_dl.h> | |||
#include <netdb.h> | |||
#include <netinet/in.h> | |||
#include <pthread.h> | |||
@@ -273,8 +276,10 @@ | |||
#include <sys/ptrace.h> | |||
#include <sys/socket.h> | |||
#include <sys/stat.h> | |||
#include <sys/sysctl.h> | |||
#include <sys/time.h> | |||
#include <sys/types.h> | |||
#include <sys/user.h> | |||
#include <sys/wait.h> | |||
#include <utime.h> | |||
#include <poll.h> | |||
@@ -0,0 +1,108 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2020 - Raw Material Software Limited | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
namespace juce | |||
{ | |||
#if JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
namespace SystemStatsHelpers | |||
{ | |||
static void doCPUID (uint32& a, uint32& b, uint32& c, uint32& d, uint32 type) | |||
{ | |||
uint32 la = a, lb = b, lc = c, ld = d; | |||
#if JUCE_32BIT && defined (__pic__) | |||
asm ("mov %%ebx, %%edi\n" | |||
"cpuid\n" | |||
"xchg %%edi, %%ebx\n" | |||
: "=a" (la), "=D" (lb), "=c" (lc), "=d" (ld) | |||
: "a" (type), "c" (0)); | |||
#else | |||
asm ("cpuid\n" | |||
: "=a" (la), "=b" (lb), "=c" (lc), "=d" (ld) | |||
: "a" (type), "c" (0)); | |||
#endif | |||
a = la; b = lb; c = lc; d = ld; | |||
} | |||
static void getCPUInfo (bool& hasMMX, | |||
bool& hasSSE, | |||
bool& hasSSE2, | |||
bool& has3DNow, | |||
bool& hasSSE3, | |||
bool& hasSSSE3, | |||
bool& hasFMA3, | |||
bool& hasSSE41, | |||
bool& hasSSE42, | |||
bool& hasAVX, | |||
bool& hasFMA4, | |||
bool& hasAVX2, | |||
bool& hasAVX512F, | |||
bool& hasAVX512DQ, | |||
bool& hasAVX512IFMA, | |||
bool& hasAVX512PF, | |||
bool& hasAVX512ER, | |||
bool& hasAVX512CD, | |||
bool& hasAVX512BW, | |||
bool& hasAVX512VL, | |||
bool& hasAVX512VBMI, | |||
bool& hasAVX512VPOPCNTDQ) | |||
{ | |||
uint32 a = 0, b = 0, d = 0, c = 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 1); | |||
hasMMX = (d & (1u << 23)) != 0; | |||
hasSSE = (d & (1u << 25)) != 0; | |||
hasSSE2 = (d & (1u << 26)) != 0; | |||
has3DNow = (b & (1u << 31)) != 0; | |||
hasSSE3 = (c & (1u << 0)) != 0; | |||
hasSSSE3 = (c & (1u << 9)) != 0; | |||
hasFMA3 = (c & (1u << 12)) != 0; | |||
hasSSE41 = (c & (1u << 19)) != 0; | |||
hasSSE42 = (c & (1u << 20)) != 0; | |||
hasAVX = (c & (1u << 28)) != 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 0x80000001); | |||
hasFMA4 = (c & (1u << 16)) != 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 7); | |||
hasAVX2 = (b & (1u << 5)) != 0; | |||
hasAVX512F = (b & (1u << 16)) != 0; | |||
hasAVX512DQ = (b & (1u << 17)) != 0; | |||
hasAVX512IFMA = (b & (1u << 21)) != 0; | |||
hasAVX512PF = (b & (1u << 26)) != 0; | |||
hasAVX512ER = (b & (1u << 27)) != 0; | |||
hasAVX512CD = (b & (1u << 28)) != 0; | |||
hasAVX512BW = (b & (1u << 30)) != 0; | |||
hasAVX512VL = (b & (1u << 31)) != 0; | |||
hasAVX512VBMI = (c & (1u << 1)) != 0; | |||
hasAVX512VPOPCNTDQ = (c & (1u << 14)) != 0; | |||
} | |||
} // namespace SystemStatsHelpers | |||
#endif | |||
} // namespace juce |
@@ -62,8 +62,9 @@ bool File::isSymbolicLink() const | |||
String File::getNativeLinkedTarget() const | |||
{ | |||
HeapBlock<char> buffer (8194); | |||
const int numBytes = (int) readlink (getFullPathName().toRawUTF8(), buffer, 8192); | |||
constexpr int bufferSize = 8194; | |||
HeapBlock<char> buffer (bufferSize); | |||
auto numBytes = (int) readlink (getFullPathName().toRawUTF8(), buffer, bufferSize - 2); | |||
return String::fromUTF8 (buffer, jmax (0, numBytes)); | |||
} | |||
@@ -20,6 +20,10 @@ | |||
============================================================================== | |||
*/ | |||
#if JUCE_BSD | |||
extern char** environ; | |||
#endif | |||
namespace juce | |||
{ | |||
@@ -149,8 +153,12 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||
case hostApplicationPath: | |||
{ | |||
#if JUCE_BSD | |||
return juce_getExecutableFile(); | |||
#else | |||
const File f ("/proc/self/exe"); | |||
return f.isSymbolicLink() ? f.getLinkedTarget() : juce_getExecutableFile(); | |||
#endif | |||
} | |||
default: | |||
@@ -25,6 +25,26 @@ namespace juce | |||
void MACAddress::findAllAddresses (Array<MACAddress>& result) | |||
{ | |||
#if JUCE_BSD | |||
struct ifaddrs* addrs = nullptr; | |||
if (getifaddrs (&addrs) != -1) | |||
{ | |||
for (auto* i = addrs; i != nullptr; i = i->ifa_next) | |||
{ | |||
if (i->ifa_addr->sa_family == AF_LINK) | |||
{ | |||
struct sockaddr_dl* sdl = (struct sockaddr_dl*) i->ifa_addr; | |||
MACAddress ma ((const uint8*) (sdl->sdl_data + sdl->sdl_nlen)); | |||
if (! ma.isNull()) | |||
result.addIfNotAlreadyThere (ma); | |||
} | |||
} | |||
freeifaddrs (addrs); | |||
} | |||
#else | |||
auto s = socket (AF_INET, SOCK_DGRAM, 0); | |||
if (s != -1) | |||
@@ -53,6 +73,7 @@ void MACAddress::findAllAddresses (Array<MACAddress>& result) | |||
::close (s); | |||
} | |||
#endif | |||
} | |||
@@ -27,6 +27,22 @@ extern "C" int cobalt_thread_mode(); | |||
namespace juce | |||
{ | |||
#if ! JUCE_BSD | |||
static String getCpuInfo (const char* key) | |||
{ | |||
return readPosixConfigFileValue ("/proc/cpuinfo", key); | |||
} | |||
static String getLocaleValue (nl_item key) | |||
{ | |||
auto oldLocale = ::setlocale (LC_ALL, ""); | |||
auto result = String::fromUTF8 (nl_langinfo (key)); | |||
::setlocale (LC_ALL, oldLocale); | |||
return result; | |||
} | |||
#endif | |||
//============================================================================== | |||
void Logger::outputDebugString (const String& text) | |||
{ | |||
std::cerr << text << std::endl; | |||
@@ -54,14 +70,25 @@ bool SystemStats::isOperatingSystem64Bit() | |||
} | |||
//============================================================================== | |||
static String getCpuInfo (const char* key) | |||
{ | |||
return readPosixConfigFileValue ("/proc/cpuinfo", key); | |||
} | |||
String SystemStats::getDeviceDescription() | |||
{ | |||
#if JUCE_BSD | |||
int mib[] = { | |||
CTL_HW, | |||
HW_MACHINE | |||
}; | |||
size_t machineDescriptionLength = 0; | |||
auto result = sysctl (mib, numElementsInArray (mib), nullptr, &machineDescriptionLength, nullptr, 0); | |||
if (result != 0 || machineDescriptionLength == 0) | |||
return {}; | |||
MemoryBlock machineDescription { machineDescriptionLength }; | |||
result = sysctl (mib, numElementsInArray (mib), machineDescription.getData(), &machineDescriptionLength, nullptr, 0); | |||
return String::fromUTF8 (result == 0 ? (char*) machineDescription.getData() : ""); | |||
#else | |||
return getCpuInfo ("Hardware"); | |||
#endif | |||
} | |||
String SystemStats::getDeviceManufacturer() | |||
@@ -71,32 +98,70 @@ String SystemStats::getDeviceManufacturer() | |||
String SystemStats::getCpuVendor() | |||
{ | |||
#if JUCE_BSD | |||
return {}; | |||
#else | |||
auto v = getCpuInfo ("vendor_id"); | |||
if (v.isEmpty()) | |||
v = getCpuInfo ("model name"); | |||
return v; | |||
#endif | |||
} | |||
String SystemStats::getCpuModel() | |||
{ | |||
#if JUCE_BSD | |||
int mib[] = { | |||
CTL_HW, | |||
HW_MODEL | |||
}; | |||
size_t modelLength = 0; | |||
auto result = sysctl (mib, numElementsInArray (mib), nullptr, &modelLength, nullptr, 0); | |||
if (result != 0 || modelLength == 0) | |||
return {}; | |||
MemoryBlock model { modelLength }; | |||
result = sysctl (mib, numElementsInArray (mib), model.getData(), &modelLength, nullptr, 0); | |||
return String::fromUTF8 (result == 0 ? (char*) model.getData() : ""); | |||
#else | |||
return getCpuInfo ("model name"); | |||
#endif | |||
} | |||
int SystemStats::getCpuSpeedInMegahertz() | |||
{ | |||
#if JUCE_BSD | |||
int32 clockRate = 0; | |||
auto clockRateSize = sizeof (clockRate); | |||
auto result = sysctlbyname ("hw.clockrate", &clockRate, &clockRateSize, nullptr, 0); | |||
return result == 0 ? clockRate : 0; | |||
#else | |||
return roundToInt (getCpuInfo ("cpu MHz").getFloatValue()); | |||
#endif | |||
} | |||
int SystemStats::getMemorySizeInMegabytes() | |||
{ | |||
#if JUCE_BSD | |||
int mib[] = { | |||
CTL_HW, | |||
HW_PHYSMEM | |||
}; | |||
int64 memory = 0; | |||
auto memorySize = sizeof (memory); | |||
auto result = sysctl (mib, numElementsInArray (mib), &memory, &memorySize, nullptr, 0); | |||
return result == 0 ? (int) (memory / 1e6) : 0; | |||
#else | |||
struct sysinfo sysi; | |||
if (sysinfo (&sysi) == 0) | |||
return (int) (sysi.totalram * sysi.mem_unit / (1024 * 1024)); | |||
return 0; | |||
#endif | |||
} | |||
int SystemStats::getPageSize() | |||
@@ -131,21 +196,79 @@ String SystemStats::getComputerName() | |||
return {}; | |||
} | |||
static String getLocaleValue (nl_item key) | |||
String SystemStats::getUserLanguage() | |||
{ | |||
auto oldLocale = ::setlocale (LC_ALL, ""); | |||
auto result = String::fromUTF8 (nl_langinfo (key)); | |||
::setlocale (LC_ALL, oldLocale); | |||
return result; | |||
#if JUCE_BSD | |||
if (auto langEnv = getenv ("LANG")) | |||
return String::fromUTF8 (langEnv).upToLastOccurrenceOf (".UTF-8", false, true); | |||
return {}; | |||
#else | |||
return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); | |||
#endif | |||
} | |||
String SystemStats::getUserLanguage() { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); } | |||
String SystemStats::getUserRegion() { return getLocaleValue (_NL_IDENTIFICATION_TERRITORY); } | |||
String SystemStats::getDisplayLanguage() { return getUserLanguage() + "-" + getUserRegion(); } | |||
String SystemStats::getUserRegion() | |||
{ | |||
#if JUCE_BSD | |||
return {}; | |||
#else | |||
return getLocaleValue (_NL_IDENTIFICATION_TERRITORY); | |||
#endif | |||
} | |||
String SystemStats::getDisplayLanguage() | |||
{ | |||
auto result = getUserLanguage(); | |||
auto region = getUserRegion(); | |||
if (region.isNotEmpty()) | |||
result << "-" << region; | |||
return result; | |||
} | |||
//============================================================================== | |||
void CPUInformation::initialise() noexcept | |||
{ | |||
#if JUCE_BSD | |||
#if JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
SystemStatsHelpers::getCPUInfo (hasMMX, | |||
hasSSE, | |||
hasSSE2, | |||
has3DNow, | |||
hasSSE3, | |||
hasSSSE3, | |||
hasFMA3, | |||
hasSSE41, | |||
hasSSE42, | |||
hasAVX, | |||
hasFMA4, | |||
hasAVX2, | |||
hasAVX512F, | |||
hasAVX512DQ, | |||
hasAVX512IFMA, | |||
hasAVX512PF, | |||
hasAVX512ER, | |||
hasAVX512CD, | |||
hasAVX512BW, | |||
hasAVX512VL, | |||
hasAVX512VBMI, | |||
hasAVX512VPOPCNTDQ); | |||
#endif | |||
numLogicalCPUs = numPhysicalCPUs = [] | |||
{ | |||
int mib[] = { | |||
CTL_HW, | |||
HW_NCPU | |||
}; | |||
int32 numCPUs = 1; | |||
auto numCPUsSize = sizeof (numCPUs); | |||
auto result = sysctl (mib, numElementsInArray (mib), &numCPUs, &numCPUsSize, nullptr, 0); | |||
return result == 0 ? numCPUs : 1; | |||
}(); | |||
#else | |||
auto flags = getCpuInfo ("flags"); | |||
hasMMX = flags.contains ("mmx"); | |||
@@ -178,6 +301,7 @@ void CPUInformation::initialise() noexcept | |||
if (numPhysicalCPUs <= 0) | |||
numPhysicalCPUs = numLogicalCPUs; | |||
#endif | |||
} | |||
//============================================================================== | |||
@@ -224,7 +348,17 @@ bool Time::setSystemTimeToThisTime() const | |||
JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept | |||
{ | |||
#if JUCE_BSD | |||
return false; | |||
int mib[] = | |||
{ | |||
CTL_KERN, | |||
KERN_PROC, | |||
KERN_PROC_PID, | |||
::getpid() | |||
}; | |||
struct kinfo_proc info; | |||
auto infoSize = sizeof (info); | |||
auto result = sysctl (mib, numElementsInArray (mib), &info, &infoSize, nullptr, 0); | |||
return result == 0 ? ((info.ki_flag & P_TRACED) != 0) : false; | |||
#else | |||
return readPosixConfigFileValue ("/proc/self/status", "TracerPid").getIntValue() > 0; | |||
#endif | |||
@@ -43,64 +43,32 @@ void Logger::outputDebugString (const String& text) | |||
fflush (stderr); | |||
} | |||
//============================================================================== | |||
namespace SystemStatsHelpers | |||
{ | |||
#if JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
static void doCPUID (uint32& a, uint32& b, uint32& c, uint32& d, uint32 type) | |||
{ | |||
uint32 la = a, lb = b, lc = c, ld = d; | |||
#if JUCE_32BIT && defined (__pic__) | |||
asm ("mov %%ebx, %%edi\n" | |||
"cpuid\n" | |||
"xchg %%edi, %%ebx\n" | |||
: "=a" (la), "=D" (lb), "=c" (lc), "=d" (ld) | |||
: "a" (type), "c" (0)); | |||
#else | |||
asm ("cpuid\n" | |||
: "=a" (la), "=b" (lb), "=c" (lc), "=d" (ld) | |||
: "a" (type), "c" (0)); | |||
#endif | |||
a = la; b = lb; c = lc; d = ld; | |||
} | |||
#endif | |||
} | |||
//============================================================================== | |||
void CPUInformation::initialise() noexcept | |||
{ | |||
#if JUCE_INTEL && ! JUCE_NO_INLINE_ASM | |||
uint32 a = 0, b = 0, d = 0, c = 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 1); | |||
hasMMX = (d & (1u << 23)) != 0; | |||
hasSSE = (d & (1u << 25)) != 0; | |||
hasSSE2 = (d & (1u << 26)) != 0; | |||
has3DNow = (b & (1u << 31)) != 0; | |||
hasSSE3 = (c & (1u << 0)) != 0; | |||
hasSSSE3 = (c & (1u << 9)) != 0; | |||
hasFMA3 = (c & (1u << 12)) != 0; | |||
hasSSE41 = (c & (1u << 19)) != 0; | |||
hasSSE42 = (c & (1u << 20)) != 0; | |||
hasAVX = (c & (1u << 28)) != 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 0x80000001); | |||
hasFMA4 = (c & (1u << 16)) != 0; | |||
SystemStatsHelpers::doCPUID (a, b, c, d, 7); | |||
hasAVX2 = (b & (1u << 5)) != 0; | |||
hasAVX512F = (b & (1u << 16)) != 0; | |||
hasAVX512DQ = (b & (1u << 17)) != 0; | |||
hasAVX512IFMA = (b & (1u << 21)) != 0; | |||
hasAVX512PF = (b & (1u << 26)) != 0; | |||
hasAVX512ER = (b & (1u << 27)) != 0; | |||
hasAVX512CD = (b & (1u << 28)) != 0; | |||
hasAVX512BW = (b & (1u << 30)) != 0; | |||
hasAVX512VL = (b & (1u << 31)) != 0; | |||
hasAVX512VBMI = (c & (1u << 1)) != 0; | |||
hasAVX512VPOPCNTDQ = (c & (1u << 14)) != 0; | |||
SystemStatsHelpers::getCPUInfo (hasMMX, | |||
hasSSE, | |||
hasSSE2, | |||
has3DNow, | |||
hasSSE3, | |||
hasSSSE3, | |||
hasFMA3, | |||
hasSSE41, | |||
hasSSE42, | |||
hasAVX, | |||
hasFMA4, | |||
hasAVX2, | |||
hasAVX512F, | |||
hasAVX512DQ, | |||
hasAVX512IFMA, | |||
hasAVX512PF, | |||
hasAVX512ER, | |||
hasAVX512CD, | |||
hasAVX512BW, | |||
hasAVX512VL, | |||
hasAVX512VBMI, | |||
hasAVX512VPOPCNTDQ); | |||
#endif | |||
numLogicalCPUs = (int) [[NSProcessInfo processInfo] activeProcessorCount]; | |||
@@ -59,7 +59,7 @@ void JUCE_CALLTYPE Process::terminate() | |||
} | |||
#if JUCE_MAC || JUCE_LINUX | |||
#if JUCE_MAC || JUCE_LINUX || JUCE_BSD | |||
bool Process::setMaxNumberOfFileHandles (int newMaxNumber) noexcept | |||
{ | |||
rlimit lim; | |||
@@ -260,7 +260,7 @@ uint64 File::getFileIdentifier() const | |||
static bool hasEffectiveRootFilePermissions() | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
return geteuid() == 0; | |||
#else | |||
return false; | |||
@@ -940,9 +940,10 @@ void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) | |||
{ | |||
[[NSThread currentThread] setName: juceStringToNS (name)]; | |||
} | |||
#elif JUCE_LINUX || JUCE_ANDROID | |||
#if ((JUCE_LINUX && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012) \ | |||
|| JUCE_ANDROID && __ANDROID_API__ >= 9) | |||
#elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
#if (JUCE_BSD \ | |||
|| (JUCE_LINUX && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012) \ | |||
|| (JUCE_ANDROID && __ANDROID_API__ >= 9)) | |||
pthread_setname_np (pthread_self(), name.toRawUTF8()); | |||
#else | |||
prctl (PR_SET_NAME, name.toRawUTF8(), 0, 0, 0); | |||
@@ -1000,7 +1001,7 @@ void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask) | |||
if ((affinityMask & (uint32) (1 << i)) != 0) | |||
CPU_SET ((size_t) i, &affinity); | |||
#if (! JUCE_ANDROID) && ((! JUCE_LINUX) || ((__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2004)) | |||
#if (! JUCE_ANDROID) && ((! (JUCE_LINUX || JUCE_BSD)) || ((__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2004)) | |||
pthread_setaffinity_np (pthread_self(), sizeof (cpu_set_t), &affinity); | |||
#elif JUCE_ANDROID | |||
sched_setaffinity (gettid(), sizeof (cpu_set_t), &affinity); | |||
@@ -132,7 +132,7 @@ namespace SocketHelpers | |||
// a chance to process before close is called. On Mac OS X shutdown | |||
// does not unblock a select call, so using a lock here will dead-lock | |||
// both threads. | |||
#if JUCE_LINUX || JUCE_ANDROID | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
CriticalSection::ScopedLockType lock (readLock); | |||
::close (h); | |||
#else | |||
@@ -780,7 +780,7 @@ bool DatagramSocket::setEnablePortReuse (bool enabled) | |||
#else | |||
if (handle >= 0) | |||
return SocketHelpers::setOption ((SocketHandle) handle.load(), | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
SO_REUSEADDR, // port re-use is implied by addr re-use on these platforms | |||
#else | |||
SO_REUSEPORT, | |||
@@ -59,7 +59,7 @@ namespace juce | |||
#endif | |||
//============================================================================== | |||
#if JUCE_IOS || (JUCE_MAC && JUCE_ARM) || JUCE_LINUX | |||
#if JUCE_IOS || (JUCE_MAC && JUCE_ARM) || JUCE_LINUX || JUCE_BSD | |||
/** This will try to break into the debugger if the app is currently being debugged. | |||
If called by an app that's not being debugged, the behaviour isn't defined - it may | |||
crash or not, depending on the platform. | |||
@@ -83,7 +83,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4245 4100) | |||
#include <signal.h> | |||
#endif | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#include <cstring> | |||
#include <signal.h> | |||
@@ -154,7 +154,7 @@ | |||
#endif | |||
//============================================================================== | |||
#if JUCE_LINUX || JUCE_ANDROID | |||
#if JUCE_LINUX || JUCE_ANDROID || JUCE_BSD | |||
#ifdef _DEBUG | |||
#define JUCE_DEBUG 1 | |||
@@ -335,7 +335,7 @@ public: | |||
/** Parses this string as a 64-bit integer. */ | |||
int64 getIntValue64() const noexcept | |||
{ | |||
#if JUCE_LINUX || JUCE_ANDROID || JUCE_MINGW | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_ANDROID || JUCE_MINGW | |||
return atoll (data); | |||
#elif JUCE_WINDOWS | |||
return _atoi64 (data); | |||
@@ -96,7 +96,7 @@ public: | |||
{ | |||
beginTest ("Child Processes"); | |||
#if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX || JUCE_BSD | |||
ChildProcess p; | |||
#if JUCE_WINDOWS | |||
@@ -139,7 +139,7 @@ public: | |||
static void setDockIconVisible (bool isVisible); | |||
#endif | |||
#if JUCE_MAC || JUCE_LINUX || DOXYGEN | |||
#if JUCE_MAC || JUCE_LINUX || JUCE_BSD || DOXYGEN | |||
//============================================================================== | |||
/** UNIX ONLY - Attempts to use setrlimit to change the maximum number of file | |||
handles that the app can open. Pass 0 or less as the parameter to mean | |||
@@ -89,7 +89,7 @@ File PropertiesFile::Options::getDefaultFile() const | |||
if (folderName.isNotEmpty()) | |||
dir = dir.getChildFile (folderName); | |||
#elif JUCE_LINUX || JUCE_ANDROID | |||
#elif JUCE_LINUX || JUCE_BSD || JUCE_ANDROID | |||
auto dir = File (commonToAllUsers ? "/var" : "~") | |||
.getChildFile (folderName.isNotEmpty() ? folderName | |||
: ("." + applicationName)); | |||
@@ -49,7 +49,7 @@ | |||
#import <IOKit/hid/IOHIDKeys.h> | |||
#import <IOKit/pwr_mgt/IOPMLib.h> | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include <unistd.h> | |||
#endif | |||
@@ -85,7 +85,7 @@ | |||
#include "native/juce_win32_WinRTWrapper.cpp" | |||
#endif | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include "native/juce_linux_Messaging.cpp" | |||
#elif JUCE_ANDROID | |||
@@ -90,7 +90,7 @@ | |||
#include "interprocess/juce_ConnectedChildProcess.h" | |||
#include "interprocess/juce_NetworkServiceDiscovery.h" | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#include "native/juce_linux_EventLoop.h" | |||
#endif | |||
@@ -183,7 +183,7 @@ StringArray JUCE_CALLTYPE JUCEApplicationBase::getCommandLineParameterArray() | |||
extern void initialiseNSApplication(); | |||
#endif | |||
#if JUCE_LINUX && JUCE_MODULE_AVAILABLE_juce_gui_extra && (! defined(JUCE_WEB_BROWSER) || JUCE_WEB_BROWSER) | |||
#if (JUCE_LINUX || JUCE_BSD) && JUCE_MODULE_AVAILABLE_juce_gui_extra && (! defined(JUCE_WEB_BROWSER) || JUCE_WEB_BROWSER) | |||
extern int juce_gtkWebkitMain (int argc, const char* argv[]); | |||
#endif | |||
@@ -228,7 +228,7 @@ int JUCEApplicationBase::main (int argc, const char* argv[]) | |||
initialiseNSApplication(); | |||
#endif | |||
#if JUCE_LINUX && JUCE_MODULE_AVAILABLE_juce_gui_extra && (! defined(JUCE_WEB_BROWSER) || JUCE_WEB_BROWSER) | |||
#if (JUCE_LINUX || JUCE_BSD) && JUCE_MODULE_AVAILABLE_juce_gui_extra && (! defined(JUCE_WEB_BROWSER) || JUCE_WEB_BROWSER) | |||
if (argc >= 2 && String (argv[1]) == "--juce-gtkwebkitfork-child") | |||
return juce_gtkWebkitMain (argc, argv); | |||
#endif | |||
@@ -144,7 +144,7 @@ int NativeImageType::getTypeID() const | |||
return 1; | |||
} | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
ImagePixelData::Ptr NativeImageType::create (Image::PixelFormat format, int width, int height, bool clearImage) const | |||
{ | |||
return new SoftwarePixelData (format, width, height, clearImage); | |||
@@ -75,7 +75,7 @@ | |||
#import <QuartzCore/QuartzCore.h> | |||
#import <CoreText/CoreText.h> | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#ifndef JUCE_USE_FREETYPE | |||
#define JUCE_USE_FREETYPE 1 | |||
#endif | |||
@@ -147,7 +147,7 @@ | |||
#include "native/juce_win32_Direct2DGraphicsContext.cpp" | |||
#endif | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include "native/juce_linux_Fonts.cpp" | |||
#include "native/juce_linux_IconHelpers.cpp" | |||
@@ -29,7 +29,8 @@ namespace juce | |||
static std::unique_ptr<XmlElement> findFontsConfFile() | |||
{ | |||
static const char* pathsToSearch[] = { "/etc/fonts/fonts.conf", | |||
"/usr/share/fonts/fonts.conf" }; | |||
"/usr/share/fonts/fonts.conf", | |||
"/usr/local/etc/fonts/fonts.conf" }; | |||
for (auto* path : pathsToSearch) | |||
if (auto xml = parseXML (File (path))) | |||
@@ -626,7 +626,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) | |||
{ | |||
const WeakReference<Component> safePointer (this); | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
// it's wise to give the component a non-zero size before | |||
// putting it on the desktop, as X windows get confused by this, and | |||
// a (1, 1) minimum size is enforced here. | |||
@@ -441,7 +441,7 @@ void FileBrowserComponent::browserRootChanged (const File&) {} | |||
bool FileBrowserComponent::keyPressed (const KeyPress& key) | |||
{ | |||
#if JUCE_LINUX || JUCE_WINDOWS | |||
#if JUCE_LINUX || JUCE_BSD || JUCE_WINDOWS | |||
if (key.getModifiers().isCommandDown() | |||
&& (key.getKeyCode() == 'H' || key.getKeyCode() == 'h')) | |||
{ | |||
@@ -253,7 +253,7 @@ namespace juce | |||
#include "native/juce_win32_DragAndDrop.cpp" | |||
#include "native/juce_win32_FileChooser.cpp" | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include "native/x11/juce_linux_X11_Symbols.cpp" | |||
#include "native/x11/juce_linux_X11_DragAndDrop.cpp" | |||
@@ -294,7 +294,7 @@ namespace juce | |||
#include "lookandfeel/juce_LookAndFeel_V4.h" | |||
#include "mouse/juce_LassoComponent.h" | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
#if JUCE_GUI_BASICS_INCLUDE_XHEADERS | |||
// If you're missing these headers, you need to install the libx11-dev package | |||
#include <X11/Xlib.h> | |||
@@ -182,7 +182,7 @@ void LookAndFeel::setUsingNativeAlertWindows (bool shouldUseNativeAlerts) | |||
bool LookAndFeel::isUsingNativeAlertWindows() | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
return false; // not available currently.. | |||
#else | |||
return useNativeAlertWindows; | |||
@@ -28,7 +28,7 @@ namespace juce | |||
static juce_wchar getDefaultPasswordChar() noexcept | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
return 0x2022; | |||
#else | |||
return 0x25cf; | |||
@@ -31,7 +31,7 @@ bool juce_handleXEmbedEvent (ComponentPeer*, void*); | |||
/** @internal */ | |||
unsigned long juce_getCurrentFocusWindow (ComponentPeer*); | |||
#if JUCE_LINUX || DOXYGEN | |||
#if JUCE_LINUX || JUCE_BSD || DOXYGEN | |||
//============================================================================== | |||
/** | |||
@@ -109,7 +109,7 @@ | |||
#endif | |||
//============================================================================== | |||
#elif JUCE_LINUX && JUCE_WEB_BROWSER | |||
#elif (JUCE_LINUX || JUCE_BSD) && JUCE_WEB_BROWSER | |||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant", "-Wparentheses") | |||
// If you're missing this header, you need to install the webkit2gtk-4.0 package | |||
@@ -168,7 +168,7 @@ | |||
#include "native/juce_win32_SystemTrayIcon.cpp" | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant") | |||
#include "native/juce_linux_XEmbedComponent.cpp" | |||
@@ -26,7 +26,7 @@ | |||
namespace juce | |||
{ | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_MAC | |||
SystemTrayIconComponent::SystemTrayIconComponent() | |||
{ | |||
@@ -26,7 +26,7 @@ | |||
namespace juce | |||
{ | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC || DOXYGEN | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD || JUCE_MAC || DOXYGEN | |||
//============================================================================== | |||
@@ -91,7 +91,7 @@ public: | |||
*/ | |||
void* getNativeHandle() const; | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
/** @internal */ | |||
void paint (Graphics&) override; | |||
#endif | |||
@@ -54,7 +54,7 @@ | |||
#endif | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
/* Got an include error here? | |||
If you want to install OpenGL support, the packages to get are "mesa-common-dev" | |||
@@ -91,7 +91,7 @@ namespace juce | |||
void OpenGLExtensionFunctions::initialise() | |||
{ | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
#define JUCE_INIT_GL_FUNCTION(name, returnType, params, callparams) \ | |||
name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); | |||
@@ -273,7 +273,7 @@ private: | |||
#elif JUCE_WINDOWS | |||
#include "native/juce_OpenGL_win32.h" | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include "native/juce_OpenGL_linux_X11.h" | |||
#elif JUCE_ANDROID | |||
@@ -88,7 +88,7 @@ | |||
#undef APIENTRY | |||
#undef CLEAR_TEMP_APIENTRY | |||
#endif | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#include <GL/gl.h> | |||
#undef KeyPress | |||
#elif JUCE_IOS | |||
@@ -119,7 +119,7 @@ struct OpenGLExtensionFunctions | |||
#endif | |||
//============================================================================== | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
#define JUCE_DECLARE_GL_FUNCTION(name, returnType, params, callparams) typedef returnType (*type_ ## name) params; type_ ## name name; | |||
JUCE_GL_BASE_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION) | |||
JUCE_GL_EXTENSION_FUNCTIONS (JUCE_DECLARE_GL_FUNCTION) | |||
@@ -39,7 +39,7 @@ public: | |||
// context. You'll need to create this object in one of the OpenGLContext's callbacks. | |||
jassert (OpenGLHelpers::isContextActive()); | |||
#if JUCE_WINDOWS || JUCE_LINUX | |||
#if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD | |||
if (context.extensions.glGenFramebuffers == nullptr) | |||
return; | |||
#endif | |||
@@ -35,7 +35,7 @@ void* OpenGLHelpers::getExtensionFunction (const char* functionName) | |||
{ | |||
#if JUCE_WINDOWS | |||
return (void*) wglGetProcAddress (functionName); | |||
#elif JUCE_LINUX | |||
#elif JUCE_LINUX || JUCE_BSD | |||
return (void*) glXGetProcAddress ((const GLubyte*) functionName); | |||
#else | |||
static void* handle = dlopen (nullptr, RTLD_LAZY); | |||
@@ -151,7 +151,7 @@ struct OnlineUnlockForm::OverlayComp : public Component, | |||
static juce_wchar getDefaultPasswordChar() noexcept | |||
{ | |||
#if JUCE_LINUX | |||
#if JUCE_LINUX || JUCE_BSD | |||
return 0x2022; | |||
#else | |||
return 0x25cf; | |||
@@ -280,6 +280,8 @@ char OnlineUnlockStatus::MachineIDUtilities::getPlatformPrefix() | |||
return 'W'; | |||
#elif JUCE_LINUX | |||
return 'L'; | |||
#elif JUCE_BSD | |||
return 'B'; | |||
#elif JUCE_IOS | |||
return 'I'; | |||
#elif JUCE_ANDROID | |||
@@ -26,7 +26,7 @@ | |||
namespace juce | |||
{ | |||
#if ! (JUCE_LINUX || JUCE_PROJUCER_LIVE_BUILD) | |||
#if ! (JUCE_LINUX || JUCE_BSD || JUCE_PROJUCER_LIVE_BUILD) | |||
#if JUCE_MAC || JUCE_IOS | |||
#include "../native/juce_mac_Video.h" | |||