From 26acc836d9c9a0be5363c306f825f33602298c5d Mon Sep 17 00:00:00 2001 From: Philipp David Date: Mon, 21 Mar 2022 09:40:20 +0100 Subject: [PATCH 1/2] Revert "fix: use our own prefix for rainbow lib" This reverts commit 61db1c46beb465c33124ec4f34dfdcefd4d804d3. --- launcher/CMakeLists.txt | 2 +- libraries/rainbow/CMakeLists.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 6491ccce..ab031a00 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -941,7 +941,7 @@ target_link_libraries(Launcher_logic Launcher_iconfix QuaZip::QuaZip hoedown - PolyMC_rainbow + Launcher_rainbow LocalPeer ) diff --git a/libraries/rainbow/CMakeLists.txt b/libraries/rainbow/CMakeLists.txt index a07135c3..833538e3 100644 --- a/libraries/rainbow/CMakeLists.txt +++ b/libraries/rainbow/CMakeLists.txt @@ -9,14 +9,14 @@ src/rainbow.cpp ) add_definitions(-DRAINBOW_LIBRARY) -add_library(PolyMC_rainbow SHARED ${RAINBOW_SOURCES}) -target_include_directories(PolyMC_rainbow PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +add_library(Launcher_rainbow SHARED ${RAINBOW_SOURCES}) +target_include_directories(Launcher_rainbow PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(PolyMC_rainbow Qt5::Core Qt5::Gui) +target_link_libraries(Launcher_rainbow Qt5::Core Qt5::Gui) # Install it install( - TARGETS PolyMC_rainbow + TARGETS Launcher_rainbow RUNTIME DESTINATION ${LIBRARY_DEST_DIR} LIBRARY DESTINATION ${LIBRARY_DEST_DIR} ) From e8373bbf65c62096588a19c09959f1212ae14403 Mon Sep 17 00:00:00 2001 From: Philipp David Date: Fri, 18 Mar 2022 10:28:35 +0100 Subject: [PATCH 2/2] Build with static rainbow --- launcher/CMakeLists.txt | 2 +- libraries/rainbow/CMakeLists.txt | 10 +-------- libraries/rainbow/include/rainbow.h | 20 ++++++++--------- libraries/rainbow/include/rainbow_config.h | 26 ---------------------- 4 files changed, 11 insertions(+), 47 deletions(-) delete mode 100644 libraries/rainbow/include/rainbow_config.h diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index ab031a00..98cb0a3b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -941,8 +941,8 @@ target_link_libraries(Launcher_logic Launcher_iconfix QuaZip::QuaZip hoedown - Launcher_rainbow LocalPeer + Launcher_rainbow ) target_link_libraries(Launcher_logic) diff --git a/libraries/rainbow/CMakeLists.txt b/libraries/rainbow/CMakeLists.txt index 833538e3..e57dbbc2 100644 --- a/libraries/rainbow/CMakeLists.txt +++ b/libraries/rainbow/CMakeLists.txt @@ -8,15 +8,7 @@ set(RAINBOW_SOURCES src/rainbow.cpp ) -add_definitions(-DRAINBOW_LIBRARY) -add_library(Launcher_rainbow SHARED ${RAINBOW_SOURCES}) +add_library(Launcher_rainbow STATIC ${RAINBOW_SOURCES}) target_include_directories(Launcher_rainbow PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(Launcher_rainbow Qt5::Core Qt5::Gui) - -# Install it -install( - TARGETS Launcher_rainbow - RUNTIME DESTINATION ${LIBRARY_DEST_DIR} - LIBRARY DESTINATION ${LIBRARY_DEST_DIR} -) diff --git a/libraries/rainbow/include/rainbow.h b/libraries/rainbow/include/rainbow.h index 67c46300..57be87f1 100644 --- a/libraries/rainbow/include/rainbow.h +++ b/libraries/rainbow/include/rainbow.h @@ -23,8 +23,6 @@ #pragma once -#include "rainbow_config.h" - #include class QColor; @@ -43,13 +41,13 @@ namespace Rainbow * * @see http://en.wikipedia.org/wiki/Luma_(video) */ -RAINBOW_EXPORT qreal luma(const QColor &); +qreal luma(const QColor &); /** * Calculate hue, chroma and luma of a color in one call. * @since 5.0 */ -RAINBOW_EXPORT void getHcy(const QColor &, qreal *hue, qreal *chroma, qreal *luma, +void getHcy(const QColor &, qreal *hue, qreal *chroma, qreal *luma, qreal *alpha = 0); /** @@ -64,7 +62,7 @@ RAINBOW_EXPORT void getHcy(const QColor &, qreal *hue, qreal *chroma, qreal *lum * * @see Rainbow::luma */ -RAINBOW_EXPORT qreal contrastRatio(const QColor &, const QColor &); +qreal contrastRatio(const QColor &, const QColor &); /** * Adjust the luma of a color by changing its distance from white. @@ -81,7 +79,7 @@ RAINBOW_EXPORT qreal contrastRatio(const QColor &, const QColor &); * component of the color; 1.0 means no change, 0.0 maximizes chroma * @see Rainbow::shade */ -RAINBOW_EXPORT QColor +QColor lighten(const QColor &, qreal amount = 0.5, qreal chromaInverseGain = 1.0); /** @@ -99,7 +97,7 @@ lighten(const QColor &, qreal amount = 0.5, qreal chromaInverseGain = 1.0); * component of the color; 1.0 means no change, 0.0 minimizes chroma * @see Rainbow::shade */ -RAINBOW_EXPORT QColor darken(const QColor &, qreal amount = 0.5, qreal chromaGain = 1.0); +QColor darken(const QColor &, qreal amount = 0.5, qreal chromaGain = 1.0); /** * Adjust the luma and chroma components of a color. The amount is added @@ -113,7 +111,7 @@ RAINBOW_EXPORT QColor darken(const QColor &, qreal amount = 0.5, qreal chromaGai * 1.0 maximizes chroma * @see Rainbow::luma */ -RAINBOW_EXPORT QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount = 0.0); +QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount = 0.0); /** * Create a new color by tinting one color with another. This function is @@ -127,7 +125,7 @@ RAINBOW_EXPORT QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount * @param amount how strongly to tint the base; 0.0 gives @p base, * 1.0 gives @p color */ -RAINBOW_EXPORT QColor tint(const QColor &base, const QColor &color, qreal amount = 0.3); +QColor tint(const QColor &base, const QColor &color, qreal amount = 0.3); /** * Blend two colors into a new color by linear combination. @@ -140,7 +138,7 @@ RAINBOW_EXPORT QColor tint(const QColor &base, const QColor &color, qreal amount * @p bias >= 1 gives @p c2. @p bias == 0.5 gives a 50% blend of @p c1 * and @p c2. */ -RAINBOW_EXPORT QColor mix(const QColor &c1, const QColor &c2, qreal bias = 0.5); +QColor mix(const QColor &c1, const QColor &c2, qreal bias = 0.5); /** * Blend two colors into a new color by painting the second color over the @@ -154,7 +152,7 @@ RAINBOW_EXPORT QColor mix(const QColor &c1, const QColor &c2, qreal bias = 0.5); * @param paint the color to be overlayed onto the base color. * @param comp the CompositionMode used to do the blending. */ -RAINBOW_EXPORT QColor +QColor overlayColors(const QColor &base, const QColor &paint, QPainter::CompositionMode comp = QPainter::CompositionMode_SourceOver); } diff --git a/libraries/rainbow/include/rainbow_config.h b/libraries/rainbow/include/rainbow_config.h deleted file mode 100644 index 52cc7388..00000000 --- a/libraries/rainbow/include/rainbow_config.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#ifdef RAINBOW_STATIC - #define RAINBOW_EXPORT -#else - #ifdef RAINBOW_LIBRARY - #define RAINBOW_EXPORT Q_DECL_EXPORT - #else - #define RAINBOW_EXPORT Q_DECL_IMPORT - #endif -#endif \ No newline at end of file