Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ if(WIN32)
find_package(dlfcn-win32 REQUIRED)
set(CMAKE_DL_LIBS dlfcn-win32::dl)
endif()
if(MINGW)
string(REPLACE "iconv" "pthread" MLT_PTHREAD_LIBS "${Iconv_LIBRARY}")
endif()
endif()

find_package(SDL2)
Expand Down
10 changes: 9 additions & 1 deletion src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,19 @@ set_target_properties(mlt PROPERTIES

if(WIN32)
if(MINGW)
target_link_libraries(mlt PRIVATE ${MLT_PTHREAD_LIBS})
target_link_options(mlt PRIVATE -Wl,--output-def,${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libmlt-${MLT_VERSION_MAJOR}.def)
install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libmlt-${MLT_VERSION_MAJOR}.def" DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

include(CheckSymbolExists)
set(CMAKE_REQUIRED_LIBRARIES Threads::Threads)
check_symbol_exists(nanosleep "pthread.h;pthread_time.h" HAVE_PTHREAD_NANOSLEEP)
unset(CMAKE_REQUIRED_LIBRARIES)

target_sources(mlt PRIVATE ../win32/win32.c)
set_source_files_properties(../win32/win32.c PROPERTIES
COMPILE_DEFINITIONS "HAVE_PTHREAD_NANOSLEEP=${HAVE_PTHREAD_NANOSLEEP}")

target_link_libraries(mlt PRIVATE Iconv::Iconv)
if(NOT WINDOWS_DEPLOY)
target_compile_definitions(mlt PRIVATE NODEPLOY)
Expand Down
6 changes: 5 additions & 1 deletion src/framework/mlt_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* \file mlt_types.h
* \brief Provides forward definitions of all public types
*
* Copyright (C) 2003-2025 Meltytech, LLC
* Copyright (C) 2003-2023 Meltytech, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -22,6 +22,10 @@
#ifndef MLT_TYPES_H
#define MLT_TYPES_H

#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/melt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ target_link_libraries(melt PRIVATE mlt Threads::Threads)
target_compile_definitions(melt PRIVATE VERSION="${MLT_VERSION}")

if(SDL2_FOUND AND NOT ANDROID)
target_link_libraries(melt PRIVATE SDL2::SDL2)
target_compile_definitions(melt PRIVATE HAVE_SDL2)
if(MINGW)
target_link_libraries(melt PRIVATE ${MLT_PTHREAD_LIBS})
target_compile_definitions(melt PRIVATE main=SDL_main)
target_link_libraries(melt PRIVATE mingw32 SDL2main SDL2)
target_link_libraries(melt PRIVATE mingw32 SDL2::SDL2main SDL2::SDL2)
else()
target_link_libraries(melt PRIVATE SDL2::SDL2)
endif()
endif()

Expand Down
3 changes: 0 additions & 3 deletions src/modules/avformat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ endif()

if(WIN32)
target_compile_definitions(mltavformat PRIVATE AVDATADIR="share/ffmpeg/")
if(MINGW)
target_link_libraries(mltavformat PRIVATE ${MLT_PTHREAD_LIBS})
endif()
endif()

if(CPU_MMX)
Expand Down
4 changes: 0 additions & 4 deletions src/modules/sdl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ else()
target_link_libraries(mltsdl2 PRIVATE m)
endif()

if(MINGW)
target_link_libraries(mltsdl2 PRIVATE ${MLT_PTHREAD_LIBS})
endif()

set_target_properties(mltsdl2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${MLT_MODULE_OUTPUT_DIRECTORY}")

install(TARGETS mltsdl2 LIBRARY DESTINATION ${MLT_INSTALL_MODULE_DIR})
Expand Down
8 changes: 4 additions & 4 deletions src/win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ int usleep(unsigned int useconds)
return 0;
}

#ifndef WIN_PTHREADS_TIME_H
int nanosleep(const struct timespec * rqtp, struct timespec * rmtp)
#if !HAVE_PTHREAD_NANOSLEEP
int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
{
if (rqtp->tv_nsec > 999999999) {
/* The time interval specified 1,000,000 or more microseconds. */
errno = EINVAL;
return -1;
}
return usleep(rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000);
}
return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 );
}
#endif

int setenv(const char *name, const char *value, int overwrite)
Expand Down
Loading