diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 85ea29306..899a8aee8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 2.6) project( core ) SET (CMAKE_BUILD_TYPE DEBUG) @@ -71,6 +72,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(NOT DEFINED MINGW) SET(SOURCES ${SOURCES} ${WINDOWS_EXTRAS}) endif(NOT DEFINED MINGW) +else(CMAKE_SYSTEM_NAME MATCHES "Windows") + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive) endif(CMAKE_SYSTEM_NAME MATCHES "Windows") include_directories( @@ -86,5 +89,5 @@ add_definitions( -D_DEBUG ) -add_library( core STATIC ${SOURCES} ) +add_library( core SHARED ${SOURCES} ) diff --git a/src/core/Common.cpp b/src/core/Common.cpp index ccda2f46b..06c20d2e6 100644 --- a/src/core/Common.cpp +++ b/src/core/Common.cpp @@ -113,11 +113,15 @@ utfstring musik::core::GetDataDirectory(){ ///String with path. ////////////////////////////////////////// utfstring musik::core::GetPath(const utfstring &sFile){ + utfstring sPath; + int iStrLength; + +#ifdef WIN32 utfchar szPath[2048]; utfchar *szFile=NULL; - int iStrLength = GetFullPathName(sFile.c_str(),2048,szPath,&szFile); + iStrLength = GetFullPathName(sFile.c_str(),2048,szPath,&szFile); if(iStrLength!=0 && iStrLength<2048 ){ sPath.assign(szPath); if(szFile!=0){ @@ -127,7 +131,11 @@ utfstring musik::core::GetPath(const utfstring &sFile){ }else{ sPath.assign(sFile); } + #else //TODO: check this POSIX GetPath works + utfchar* szDir; + sPath.assign(getcwd((char*)szDir, (size_t) iStrLength)); + #endif //WIN32 return sPath; } diff --git a/src/core/Common.h b/src/core/Common.h index 8538d12ad..2d29e545f 100644 --- a/src/core/Common.h +++ b/src/core/Common.h @@ -85,4 +85,3 @@ namespace musik{ namespace core{ #define UTF16_TO_UTF(s) musik::core::ConvertUTF8(s) #endif - diff --git a/src/core/PluginFactory.h b/src/core/PluginFactory.h index 3df0ca92b..b69d49149 100644 --- a/src/core/PluginFactory.h +++ b/src/core/PluginFactory.h @@ -44,6 +44,10 @@ #include #include +#ifndef WIN32 + #include +#endif //WIN32 + namespace musik{ namespace core{ class PluginFactory{ @@ -92,7 +96,7 @@ namespace musik{ namespace core{ template std::vector< boost::shared_ptr > QueryInterface(const char* functionName){ boost::mutex::scoped_lock lock(this->mutex); - typedef T* (__stdcall* PluginInterfaceCall)(); + typedef T* STDCALL((* PluginInterfaceCall)()); std::vector< boost::shared_ptr > plugins; HandleList& allDlls = PluginFactory::sInstance.loadedDLLs; @@ -100,9 +104,13 @@ namespace musik{ namespace core{ typedef HandleList::iterator Iterator; Iterator currentDll = allDlls.begin(); while (currentDll != allDlls.end()){ - PluginInterfaceCall funcPtr = - (PluginInterfaceCall) GetProcAddress((HMODULE)(*currentDll), functionName); + PluginInterfaceCall funcPtr = +#ifdef WIN32 + (PluginInterfaceCall) GetProcAddress((HMODULE)(*currentDll), functionName); +#else + (PluginInterfaceCall) dlsym(*currentDll, functionName); +#endif //WIN32 if(funcPtr) { T* result = funcPtr(); if (result) { diff --git a/src/core/Query/Base.cpp b/src/core/Query/Base.cpp index 4ca7b5862..a69d33f7a 100644 --- a/src/core/Query/Base.cpp +++ b/src/core/Query/Base.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include diff --git a/src/core/Query/Base.h b/src/core/Query/Base.h index 05c76e7d3..039f6dc4a 100644 --- a/src/core/Query/Base.h +++ b/src/core/Query/Base.h @@ -137,9 +137,10 @@ class Base : public sigslot::has_slots<> { unsigned int options; protected: - friend class Library::Base; + /*friend class Library::Base; friend class Library::LocalDB; - friend class server::Connection; + friend class server::Connection;*/ + //Friended twice - throwing up lots of warnings // Methods: virtual std::string Name(); diff --git a/src/core/Query/Factory.cpp b/src/core/Query/Factory.cpp index 9a036aaed..10553130c 100644 --- a/src/core/Query/Factory.cpp +++ b/src/core/Query/Factory.cpp @@ -33,7 +33,7 @@ // POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include diff --git a/src/core/Query/ListBase.cpp b/src/core/Query/ListBase.cpp index e2e5ea30d..b87ae21d8 100644 --- a/src/core/Query/ListBase.cpp +++ b/src/core/Query/ListBase.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/ListSelection.cpp b/src/core/Query/ListSelection.cpp index ee5dbd0bf..55af0be66 100644 --- a/src/core/Query/ListSelection.cpp +++ b/src/core/Query/ListSelection.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/PlaylistLoad.cpp b/src/core/Query/PlaylistLoad.cpp index 5965d5805..2a33b439f 100644 --- a/src/core/Query/PlaylistLoad.cpp +++ b/src/core/Query/PlaylistLoad.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include diff --git a/src/core/Query/PlaylistSave.cpp b/src/core/Query/PlaylistSave.cpp index 3e4b753e9..857d2f658 100644 --- a/src/core/Query/PlaylistSave.cpp +++ b/src/core/Query/PlaylistSave.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/Playlists.cpp b/src/core/Query/Playlists.cpp index 361cbdc04..123939540 100644 --- a/src/core/Query/Playlists.cpp +++ b/src/core/Query/Playlists.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/SortTracks.cpp b/src/core/Query/SortTracks.cpp index 9ee73abef..0bad55afe 100644 --- a/src/core/Query/SortTracks.cpp +++ b/src/core/Query/SortTracks.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/SortTracksWithData.cpp b/src/core/Query/SortTracksWithData.cpp index 613458fdb..306652110 100644 --- a/src/core/Query/SortTracksWithData.cpp +++ b/src/core/Query/SortTracksWithData.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/Query/TrackMetadata.cpp b/src/core/Query/TrackMetadata.cpp index 6fa8dd44f..b0de0434b 100644 --- a/src/core/Query/TrackMetadata.cpp +++ b/src/core/Query/TrackMetadata.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include diff --git a/src/core/config.h b/src/core/config.h index db75d3765..97691380f 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -54,9 +54,12 @@ #endif typedef unsigned __int64 UINT64; + #define STDCALL(fp) __stdcall fp #else typedef unsigned long long UINT64; typedef long long __int64; //TODO: Is this necessary? + + #define STDCALL(fp) fp __attribute__((stdcall)) #endif // WIN32 //////////////////////////////// diff --git a/src/core/tracklist/Base.cpp b/src/core/tracklist/Base.cpp index 244210927..ad1bd652f 100644 --- a/src/core/tracklist/Base.cpp +++ b/src/core/tracklist/Base.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include ////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/tracklist/LibraryList.cpp b/src/core/tracklist/LibraryList.cpp index 199c7af32..b012f6ccf 100644 --- a/src/core/tracklist/LibraryList.cpp +++ b/src/core/tracklist/LibraryList.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include diff --git a/src/core/tracklist/MultiLibraryList.cpp b/src/core/tracklist/MultiLibraryList.cpp index 3500cc678..dd6b12467 100644 --- a/src/core/tracklist/MultiLibraryList.cpp +++ b/src/core/tracklist/MultiLibraryList.cpp @@ -34,7 +34,7 @@ // ////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" +#include "../pch.hpp" #include #include #include