Files
lmms/include/AutomationTrack.h
Dalton Messmer a2fc6c86df Add CMake options for targeting specific microarchitectures (#8464)
Bumps the minimum x86_64 microarchitecture level for nightly builds from x86_64-v1 (which includes up to SSE2) to x86_64-v2 (which includes up to SSE4.2) and similarly bumps the arm64 microarchitecture target for nightly builds depending on the OS. This is done using new CMake options that control the target microarchitecture level. Also fixes the symbol visibility when compiling with GCC or Clang.

Both of these changes have the potential for performance improvements, and will also let us write conditionally-enabled SIMD code targeting newer microarchitectures with better capabilities than the compiler baseline of SSE2/NEON.

Changes:
- Adds `TARGET_UARCH` and `TARGET_UARCH_FLAGS` CMake options for setting the target CPU microarchitecture
  - Allows LMMS builds to target newer CPUs, letting the compiler make use of instruction set extensions like SSE4.2 or POPCNT
  - The options for `TARGET_UARCH` are: "none", "official", "custom", and "native"
  - These options mean:
    - "none": No microarchitecture level is set. Uses the compiler default (i.e. x86_64-v1).
    - "official": Targets the baseline microarchitecture level of official LMMS releases (On x86_64, this is x86_64-v2, which was agreed upon as a new baseline on Discord. The arm64 baseline differs depending on the target OS).
    - "custom": Targets the microarchitecture specified by `TARGET_UARCH_FLAGS`.
    - "native": Targets the highest microarchitecture level supported by the build machine.
  - If no option is provided, it defaults to "native" so local builds are highly optimized by default
  - All automated builds explicitly use "official"
  - Choosing "none" has the same effect as prior to this PR
  - Added a CMake function called `determine_msvc_native_arch` which provides a workaround for the lack of a `/arch:native` flag in MSVC. This function has been tested on x86_64, but not on arm64 since we don't support MSVC on arm64 yet.
- Changes symbol visibility when using GCC/Clang from default (where all symbols are exported from shared library or executable) to hidden (where only symbols marked with LMMS_EXPORT are exported)
  - Matches the behavior on Windows
  - According to GCC's documentation, doing this "very substantially improves load times of your DSO (Dynamic Shared Object)", "lets the optimiser produce better code", and "reduces the size of your DSO by 5-20%". In actuality, our AppImage size shrunk from 155 MB to 154.3 MB, so the size improvements are not very significant, though there may still be performance benefits.
2026-07-15 17:44:56 -04:00

65 lines
1.9 KiB
C++

/*
* AutomationTrack.h - declaration of class AutomationTrack, which handles
* automation of objects without a track
*
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef LMMS_AUTOMATION_TRACK_H
#define LMMS_AUTOMATION_TRACK_H
#include "Track.h"
namespace lmms
{
class LMMS_EXPORT AutomationTrack : public Track
{
Q_OBJECT
public:
AutomationTrack( TrackContainer* tc, bool _hidden = false );
~AutomationTrack() override = default;
bool play( const TimePos & _start, const f_cnt_t _frames,
const f_cnt_t _frame_base, int _clip_num = -1 ) override;
QString nodeName() const override
{
return "automationtrack";
}
gui::TrackView * createView( gui::TrackContainerView* ) override;
Clip* createClip(const TimePos & pos) override;
void saveTrackSpecificSettings(QDomDocument& doc, QDomElement& parent, bool presetMode) override;
void loadTrackSpecificSettings( const QDomElement & _this ) override;
private:
friend class AutomationTrackView;
} ;
} // namespace lmms
#endif // LMMS_AUTOMATION_TRACK_H