diff --git a/src/tomahawk/CMakeLists.linux.cmake b/src/libtomahawk/CMakeLists.linux.cmake similarity index 100% rename from src/tomahawk/CMakeLists.linux.cmake rename to src/libtomahawk/CMakeLists.linux.cmake diff --git a/src/tomahawk/CMakeLists.osx.cmake b/src/libtomahawk/CMakeLists.osx.cmake similarity index 100% rename from src/tomahawk/CMakeLists.osx.cmake rename to src/libtomahawk/CMakeLists.osx.cmake diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 7f6300067..8addd4c59 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -6,9 +6,16 @@ add_definitions( -DDLLEXPORT_PRO ) add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS ) add_definitions( -DPORTFWDDLLEXPORT_STATIC ) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../tomahawk/Config.h.in +IF( WIN32 ) + INCLUDE( "CMakeLists.win32.cmake" ) +ENDIF( WIN32 ) +IF( UNIX ) + INCLUDE( "CMakeLists.unix.cmake" ) +ENDIF( UNIX ) + +configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../tomahawk/TomahawkVersion.h.in +configure_file(TomahawkVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/TomahawkVersion.h) set( libGuiSources diff --git a/src/tomahawk/CMakeLists.unix.cmake b/src/libtomahawk/CMakeLists.unix.cmake similarity index 100% rename from src/tomahawk/CMakeLists.unix.cmake rename to src/libtomahawk/CMakeLists.unix.cmake diff --git a/src/tomahawk/CMakeLists.win32.cmake b/src/libtomahawk/CMakeLists.win32.cmake similarity index 51% rename from src/tomahawk/CMakeLists.win32.cmake rename to src/libtomahawk/CMakeLists.win32.cmake index b7a2e2a78..cd883d2df 100644 --- a/src/tomahawk/CMakeLists.win32.cmake +++ b/src/libtomahawk/CMakeLists.win32.cmake @@ -1,5 +1,5 @@ -ADD_DEFINITIONS( /DNOMINMAX ) -ADD_DEFINITIONS( /DWIN32_LEAN_AND_MEAN ) +ADD_DEFINITIONS( -DNOMINMAX ) +ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN ) ADD_DEFINITIONS( -static-libgcc ) ADD_DEFINITIONS( -DUNICODE ) @@ -21,3 +21,13 @@ SET( OS_SPECIFIC_LINK_LIBRARIES if(QTSPARKLE_FOUND) list(APPEND OS_SPECIFIC_LINK_LIBRARIES ${QTSPARKLE_LIBRARIES}) endif() + + +include(CheckCXXSourceCompiles) + +check_cxx_source_compiles( "#include + int main(){ + std::ofstream stream(L\"Test\"); + return 0; + }" + OFSTREAM_CAN_OPEN_WCHAR_FILE_NAMES) \ No newline at end of file diff --git a/src/tomahawk/Config.h.in b/src/libtomahawk/Config.h.in similarity index 90% rename from src/tomahawk/Config.h.in rename to src/libtomahawk/Config.h.in index 467354fdb..e662103e8 100644 --- a/src/tomahawk/Config.h.in +++ b/src/libtomahawk/Config.h.in @@ -15,16 +15,18 @@ #cmakedefine WITH_CRASHREPORTER #cmakedefine WITH_BINARY_ATTICA -#cmakedefine WITH_QtSparkle #cmakedefine WITH_UPOWER #cmakedefine WITH_GNOMESHORTCUTHANDLER #cmakedefine LIBLASTFM_FOUND #cmakedefine QCA2_FOUND +#cmakedefine QTSPARKLE_FOUND #cmakedefine TOMAHAWK_FINEGRAINED_MESSAGES #cmakedefine COMPLEX_TAGLIB_FILENAME #cmakedefine HAVE_VLC_ALBUMARTIST #cmakedefine HAVE_X11 +#cmakedefine OFSTREAM_CAN_OPEN_WCHAR_FILE_NAMES + #endif // CONFIG_H_IN diff --git a/src/tomahawk/TomahawkVersion.h.in b/src/libtomahawk/TomahawkVersion.h.in similarity index 100% rename from src/tomahawk/TomahawkVersion.h.in rename to src/libtomahawk/TomahawkVersion.h.in diff --git a/src/libtomahawk/utils/Logger.cpp b/src/libtomahawk/utils/Logger.cpp index 80b01236f..d57646127 100644 --- a/src/libtomahawk/utils/Logger.cpp +++ b/src/libtomahawk/utils/Logger.cpp @@ -188,10 +188,9 @@ setupLogfile( QFile& f ) } } -#ifdef _WIN32 +#ifdef OFSTREAM_CAN_OPEN_WCHAR_FILE_NAMES // this is not supported in upstream libstdc++ as shipped with GCC // GCC needs the patch from https://gcc.gnu.org/ml/libstdc++/2011-06/msg00066.html applied - // we could create a CMake check like the one for taglib, but I don't care right now :P logStream.open( f.fileName().toStdWString().c_str() ); #else logStream.open( f.fileName().toStdString().c_str() ); diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index 027af3371..9cc2255d8 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -109,13 +109,6 @@ INCLUDE_DIRECTORIES( SET( OS_SPECIFIC_LINK_LIBRARIES "" ) -IF( WIN32 ) - INCLUDE( "CMakeLists.win32.cmake" ) -ENDIF( WIN32 ) -IF( UNIX ) - INCLUDE( "CMakeLists.unix.cmake" ) -ENDIF( UNIX ) - IF( APPLE ) SET( CMAKE_LINKER_FLAGS "-headerpad_max_install_names ${CMAKE_LINKER_FLAGS}" ) @@ -130,12 +123,6 @@ ENDIF( QCA2_FOUND ) INCLUDE(GNUInstallDirs) -# currently only in libtomahawk, we might want to properly split what's in which config file -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in -# ${CMAKE_CURRENT_BINARY_DIR}/config.h) -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TomahawkVersion.h.in -# ${CMAKE_CURRENT_BINARY_DIR}/TomahawkVersion.h) - # translations include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake ) add_tomahawk_translations( ${TOMAHAWK_TRANSLATION_LANGUAGES} ) diff --git a/src/tomahawk/TomahawkWindow.cpp b/src/tomahawk/TomahawkWindow.cpp index 630319ceb..b382eaa38 100644 --- a/src/tomahawk/TomahawkWindow.cpp +++ b/src/tomahawk/TomahawkWindow.cpp @@ -88,7 +88,7 @@ #include "config.h" #if defined( Q_OS_WIN ) - #if defined ( WITH_QtSparkle ) + #if defined ( QTSPARKLE_FOUND ) #if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 ) #include #else @@ -521,7 +521,7 @@ TomahawkWindow::setupUpdateCheck() #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) ); - #elif defined( Q_OS_WIN ) && defined( WITH_QtSparkle ) + #elif defined( Q_OS_WIN ) && defined( QTSPARKLE_FOUND ) QUrl updaterUrl; if ( qApp->arguments().contains( "--debug" ) )