Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ elseif (UNIX)
set(MIXXX_INSTALL_LICENSEDIR "${CMAKE_INSTALL_DOCDIR}")
endif()


if(WIN32)
target_compile_definitions(mixxx-lib PRIVATE __WINDOWS__)

Expand Down Expand Up @@ -1343,7 +1344,7 @@ install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/README"
"${CMAKE_CURRENT_SOURCE_DIR}/Mixxx-Manual.pdf"
"${CMAKE_CURRENT_SOURCE_DIR}/Mixxx-Keyboard-Shortcuts.pdf"
"${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Keyboard-Shortcuts.pdf"
DESTINATION
"${MIXXX_INSTALL_DOCDIR}"
)
Expand Down Expand Up @@ -2639,6 +2640,10 @@ if(WAVPACK)
target_link_libraries(mixxx-lib PUBLIC WavPack::wavpack)
endif()

# Configure file with build options
file(RELATIVE_PATH MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}" "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DOCDIR}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/config.h" @ONLY)

# Packaging
set(CPACK_PACKAGE_VENDOR "Mixxx Project")
set(CPACK_PACKAGE_CONTACT "RJ Skerry-Ryan <rryan@mixxx.org>")
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#cmakedefine MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR "@MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR@"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, I wasn't aware that we can use cmake vars in the actual project code.
somehow I considered those two entirely separate 'things'

@Holzhaus Holzhaus Mar 30, 2021

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use them via configure_file or target_compile_definitions. The #cmakedefine is like a regular #define except that it maps to undef if the variable is not set.

25 changes: 13 additions & 12 deletions src/widget/wmainmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QDesktopServices>
#include <QUrl>

#include "config.h"
#include "control/controlproxy.h"
#include "defs_urls.h"
#include "mixer/playermanager.h"
Expand Down Expand Up @@ -584,18 +585,18 @@ void WMainMenuBar::initialize() {
#if defined(__APPLE__)
// FIXME: We don't include the PDF manual in the bundle on OSX.
// Default to the web-hosted version.
#elif defined(__WINDOWS__)
// On Windows, the shortcut PDF sits in the same folder as the 'skins' folder.
if (kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME)) {
qKeyboardShortcutsUrl = QUrl::fromLocalFile(
kbdShortcutsDir.absoluteFilePath(MIXXX_KBD_SHORTCUTS_FILENAME));
} else {
kbdShortcutsSuffix = externalLinkSuffix;
}
#elif defined(__LINUX__)
// On GNU/Linux, the shortcut is installed to e.g. /usr/share/doc/mixxx/
if (kbdShortcutsDir.cd("../doc/mixxx") &&
kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME)) {
kbdShortcutsSuffix = externalLinkSuffix;
#elif defined(__WINDOWS__) or defined(__LINUX__)
// First check if the shortcut PDF exists in the resource directory (this
// is the case if the executable was started from the build directory and
// on Windows.
// If it's not found, check if it's in the MIXXX_INSTALL_DOCDIR (e.g.
// /usr/share/doc/ on GNU/Linux). We're using a path relative to
// MIXXX_INSTALL_DATADIR to allow custom install DESTDIR values.

if (kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME) ||
(kbdShortcutsDir.cd(MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR) &&
kbdShortcutsDir.exists(MIXXX_KBD_SHORTCUTS_FILENAME))) {
qKeyboardShortcutsUrl = QUrl::fromLocalFile(
kbdShortcutsDir.absoluteFilePath(MIXXX_KBD_SHORTCUTS_FILENAME));
} else {
Expand Down