Skip to content

Commit

Permalink
mingw buildability
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrra authored and igorkorsukov committed Sep 13, 2023
1 parent 458d23a commit 30fbb87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
18 changes: 5 additions & 13 deletions build/cmake/FindSndFile.cmake
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
include(GetPlatformInfo)

if (OS_IS_WIN)
if (OS_IS_WIN AND (NOT MINGW))
find_path(SNDFILE_INCDIR sndfile.h PATHS ${PROJECT_SOURCE_DIR}/dependencies/include;)
if (MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
else (MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif (MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
find_library(SNDFILE_LIB NAMES sndfile libsndfile-1 PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)
if (MINGW)
set(SNDFILE_DLL ${SNDFILE_LIB})
else (MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(SNDFILE_DLL NAMES sndfile libsndfile-1 PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)
message(STATUS "Found sndfile DLL: ${SNDFILE_DLL}")
endif (MINGW)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(SNDFILE_DLL NAMES sndfile libsndfile-1 PATHS ${DEPENDENCIES_DIR} NO_DEFAULT_PATH)
message(STATUS "Found sndfile DLL: ${SNDFILE_DLL}")

elseif (OS_IS_WASM)
set(LIBSND_PATH "" CACHE PATH "Path to libsnd sources")
Expand Down
8 changes: 4 additions & 4 deletions src/framework/global/dlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef MU_GLOBAL_DLIB_H
#define MU_GLOBAL_DLIB_H

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(__MINGW64__)
#include <windows.h>
#else
#include <dlfcn.h>
Expand All @@ -34,7 +34,7 @@
namespace mu {
inline void* loadLib(const io::path_t& path)
{
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(__MINGW64__)
return LoadLibrary(path.toStdWString().c_str());
#else
return dlopen(path.c_str(), RTLD_LAZY);
Expand All @@ -43,7 +43,7 @@ inline void* loadLib(const io::path_t& path)

inline void* getLibFunc(void* libHandle, const char* funcName)
{
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(__MINGW64__)
return GetProcAddress((HINSTANCE)libHandle, funcName);
#else
return dlsym(libHandle, funcName);
Expand All @@ -52,7 +52,7 @@ inline void* getLibFunc(void* libHandle, const char* funcName)

inline void closeLib(void* libHandle)
{
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(__MINGW64__)
UNUSED(libHandle);
return;
#else
Expand Down

0 comments on commit 30fbb87

Please sign in to comment.