mxe/src/libechonest-1-fixes.patch

85 lines
3.6 KiB
Diff
Raw Normal View History

This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sat, 24 Feb 2018 14:46:16 +1100
Subject: [PATCH 1/1] enable static, install *.pc, standard include dir
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1111111..2222222 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,11 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO
option(ECHONEST_BUILD_TESTS "Build all unit tests" ON)
option(BUILD_WITH_QT4 "Build libechonest with Qt4 no matter if Qt5 was found" ON)
+if(NOT BUILD_SHARED)
+ add_definitions(-DECHONEST_STATIC)
+ set(ECHONEST_PC_CFLAGS "-DECHONEST_STATIC")
+endif()
+
if( NOT BUILD_WITH_QT4 )
find_package(Qt5Core QUIET)
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets
@@ -105,7 +110,7 @@ endif( APPLE )
SET (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
-IF (NOT WIN32)
+IF (MINGW OR NOT WIN32)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libechonest.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libechonest${ECHONEST_LIB_VERSION_SUFFIX}.pc
@ONLY)
diff --git a/libechonest.pc.in b/libechonest.pc.in
index 1111111..2222222 100644
--- a/libechonest.pc.in
+++ b/libechonest.pc.in
@@ -8,4 +8,4 @@ Description: libechonest is a qt-based library that makes the Echo Nest APIs eas
Version: @ECHONEST_LIB_MAJOR_VERSION@.@ECHONEST_LIB_MINOR_VERSION@.@ECHONEST_LIB_PATCH_VERSION@
Requires: Qt@ECHONEST_QT_MAJOR_VERSION@Core Qt@ECHONEST_QT_MAJOR_VERSION@Network @ECHONEST_PC_DEPS@
Libs: -L${libdir} -lechonest@ECHONEST_LIB_VERSION_SUFFIX@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @ECHONEST_PC_CFLAGS@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1111111..2222222 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -44,7 +44,7 @@ set( LIBECHONEST_H
QT_WRAP_CPP( ${LIBECHONEST_H} )
-add_library( ${ECHONEST_LIB_TARGET_NAME} SHARED ${LIBECHONEST_SRC} )
+add_library( ${ECHONEST_LIB_TARGET_NAME} ${LIBECHONEST_SRC} )
target_link_libraries( ${ECHONEST_LIB_TARGET_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QJSON_LIBRARIES} )
set_target_properties( ${ECHONEST_LIB_TARGET_NAME} PROPERTIES VERSION ${ECHONEST_LIB_VERSION} SOVERSION ${ECHONEST_LIB_VERSION_SONAME} )
qt5_use_modules( ${ECHONEST_LIB_TARGET_NAME} Core Network Xml )
@@ -53,4 +53,4 @@ install( TARGETS ${ECHONEST_LIB_TARGET_NAME} RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
-install( FILES ${LIBECHONEST_H} DESTINATION include/echonest${ECHONEST_LIB_VERSION_SUFFIX} COMPONENT Devel )
+install( FILES ${LIBECHONEST_H} DESTINATION include/echonest COMPONENT Devel )
diff --git a/src/echonest_export.h b/src/echonest_export.h
index 1111111..2222222 100644
--- a/src/echonest_export.h
+++ b/src/echonest_export.h
@@ -18,11 +18,15 @@
#define ECHONEST_EXPORT_H
#if defined _WIN32
+ #ifdef ECHONEST_STATIC
+ #define ECHONEST_EXPORT
+ #else
#if defined ( echonest_EXPORTS ) || defined ( echonest5_EXPORTS )
#define ECHONEST_EXPORT __declspec(dllexport)
#else
#define ECHONEST_EXPORT __declspec(dllimport)
#endif
+ #endif
#elif __GNUC__ >= 4
#define ECHONEST_EXPORT __attribute__ ((visibility("default")))
#else