Merge pull request #807 from wolfman2000/wolf-cmake-mingw-partial
Bring us closer to working with MinGW again.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
set(SM_FFMPEG_VERSION "2.1.3")
|
||||
set(SM_FFMPEG_SRC_LIST "${SM_EXTERN_DIR}" "/ffmpeg-linux-" "${SM_FFMPEG_VERSION}")
|
||||
sm_join("${SM_FFMPEG_SRC_LIST}" "" SM_FFMPEG_SRC_DIR)
|
||||
set(SM_FFMPEG_ROOT "${CMAKE_BINARY_DIR}/ffmpeg-prefix/src/ffmpeg-build")
|
||||
set(SM_FFMPEG_CONFIGURE_EXE "${SM_FFMPEG_SRC_DIR}/configure")
|
||||
if (MINGW)
|
||||
# Borrow from http://stackoverflow.com/q/11845823
|
||||
# string(SUBSTRING ${SM_FFMPEG_CONFIGURE_EXE} 0 1 FIRST_LETTER)
|
||||
# string(TOLOWER ${FIRST_LETTER} FIRST_LETTER_LOW)
|
||||
# string(REPLACE "${FIRST_LETTER}:" "/${FIRST_LETTER_LOW}" # SM_FFMPEG_CONFIGURE_EXE ${SM_FFMPEG_CONFIGURE_EXE})
|
||||
# string(REGEX REPLACE "\\\\" "/" SM_FFMPEG_CONFIGURE_EXE "${SM_FFMPEG_CONFIGURE_EXE}")
|
||||
set(SM_FFMPEG_CONFIGURE_EXE "extern/ffmpeg-linux-${SM_FFMPEG_VERSION}/configure")
|
||||
endif()
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"${SM_FFMPEG_CONFIGURE_EXE}"
|
||||
"--disable-programs"
|
||||
"--disable-doc"
|
||||
"--disable-avdevice"
|
||||
"--disable-swresample"
|
||||
"--disable-postproc"
|
||||
"--disable-avfilter"
|
||||
"--disable-shared"
|
||||
"--enable-static"
|
||||
)
|
||||
if(WITH_GPL_LIBS)
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"--enable-gpl"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WITH_CRYSTALHD_DISABLED)
|
||||
list(APPEND FFMPEG_CONFIGURE "--disable-crystalhd")
|
||||
endif()
|
||||
|
||||
if (NOT WITH_EXTERNAL_WARNINGS)
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"--extra-cflags=-w"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (IS_DIRECTORY "${SM_FFMPEG_SRC_DIR}")
|
||||
externalproject_add("ffmpeg"
|
||||
SOURCE_DIR "${SM_FFMPEG_SRC_DIR}"
|
||||
CONFIGURE_COMMAND ${FFMPEG_CONFIGURE}
|
||||
BUILD_COMMAND "make"
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
else()
|
||||
# --shlibdir=$our_installdir/stepmania-$VERSION
|
||||
externalproject_add("ffmpeg"
|
||||
DOWNLOAD_COMMAND git clone "--branch" "n${SM_FFMPEG_VERSION}" "--depth" "1" "git://source.ffmpeg.org/ffmpeg.git" "${SM_FFMPEG_SRC_DIR}"
|
||||
CONFIGURE_COMMAND "${FFMPEG_CONFIGURE}"
|
||||
BUILD_COMMAND "make"
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
+36
-75
@@ -115,6 +115,12 @@ check_symbol_exists(size_t stdlib.h HAVE_SIZE_T_STDLIB)
|
||||
check_symbol_exists(size_t stdio.h HAVE_SIZE_T_STDIO)
|
||||
check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
|
||||
|
||||
if (MINGW)
|
||||
set(NEED_WINDOWS_LOADING_WINDOW TRUE)
|
||||
check_symbol_exists(PBS_MARQUEE commctrl.h HAVE_PBS_MARQUEE)
|
||||
check_symbol_exists(PBM_SETMARQUEE commctrl.h HAVE_PBM_SETMARQUEE)
|
||||
endif()
|
||||
|
||||
# Checks to make it easier to work with 32-bit/64-bit builds if required.
|
||||
include(CheckTypeSize)
|
||||
check_type_size(int16_t SIZEOF_INT16_T)
|
||||
@@ -215,30 +221,42 @@ endif()
|
||||
find_package(nasm)
|
||||
find_package(yasm)
|
||||
|
||||
find_package(Threads)
|
||||
if (${Threads_FOUND})
|
||||
set(HAS_PTHREAD TRUE)
|
||||
else()
|
||||
set(HAS_PTHREAD FALSE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(SYSTEM_PCRE_FOUND FALSE)
|
||||
find_package(DirectX REQUIRED)
|
||||
|
||||
# FFMPEG...it can be evil.
|
||||
find_library(LIB_SWSCALE NAMES "swscale"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_SWSCALE ${LIB_SWSCALE} NAME)
|
||||
if (MINGW)
|
||||
include("${SM_CMAKE_DIR}/SetupFfmpeg.cmake")
|
||||
set(HAS_FFMPEG TRUE)
|
||||
else()
|
||||
# FFMPEG...it can be evil.
|
||||
find_library(LIB_SWSCALE NAMES "swscale"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_SWSCALE ${LIB_SWSCALE} NAME)
|
||||
|
||||
find_library(LIB_AVCODEC NAMES "avcodec"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVCODEC ${LIB_AVCODEC} NAME)
|
||||
find_library(LIB_AVCODEC NAMES "avcodec"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVCODEC ${LIB_AVCODEC} NAME)
|
||||
|
||||
find_library(LIB_AVFORMAT NAMES "avformat"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVFORMAT ${LIB_AVFORMAT} NAME)
|
||||
find_library(LIB_AVFORMAT NAMES "avformat"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVFORMAT ${LIB_AVFORMAT} NAME)
|
||||
|
||||
find_library(LIB_AVUTIL NAMES "avutil"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVUTIL ${LIB_AVUTIL} NAME)
|
||||
find_library(LIB_AVUTIL NAMES "avutil"
|
||||
PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" NO_DEFAULT_PATH
|
||||
)
|
||||
get_filename_component(LIB_AVUTIL ${LIB_AVUTIL} NAME)
|
||||
endif()
|
||||
elseif(MACOSX)
|
||||
set(SYSTEM_PCRE_FOUND FALSE)
|
||||
set(WITH_CRASH_HANDLER TRUE)
|
||||
@@ -363,13 +381,6 @@ elseif(LINUX)
|
||||
message(STATUS "-- At least one sound library was found. Do not worry if any were not found at this stage.")
|
||||
endif()
|
||||
|
||||
find_package(Threads)
|
||||
if (${Threads_FOUND})
|
||||
set(HAS_PTHREAD TRUE)
|
||||
else()
|
||||
set(HAS_PTHREAD FALSE)
|
||||
endif()
|
||||
|
||||
if (WITH_FFMPEG AND NOT YASM_FOUND AND NOT NASM_FOUND)
|
||||
message("Neither NASM nor YASM were found. Please install at least one of them if you wish for ffmpeg support.")
|
||||
set(WITH_FFMPEG OFF)
|
||||
@@ -388,57 +399,7 @@ elseif(LINUX)
|
||||
set(HAS_FFMPEG TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(SM_FFMPEG_VERSION "2.1.3")
|
||||
set(SM_FFMPEG_SRC_LIST "${SM_EXTERN_DIR}" "/ffmpeg-linux-" "${SM_FFMPEG_VERSION}")
|
||||
sm_join("${SM_FFMPEG_SRC_LIST}" "" SM_FFMPEG_SRC_DIR)
|
||||
set(SM_FFMPEG_ROOT "${CMAKE_BINARY_DIR}/ffmpeg-prefix/src/ffmpeg-build")
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"${SM_FFMPEG_SRC_DIR}/configure"
|
||||
"--disable-programs"
|
||||
"--disable-doc"
|
||||
"--disable-avdevice"
|
||||
"--disable-swresample"
|
||||
"--disable-postproc"
|
||||
"--disable-avfilter"
|
||||
"--disable-shared"
|
||||
"--enable-static"
|
||||
)
|
||||
if(WITH_GPL_LIBS)
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"--enable-gpl"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WITH_CRYSTALHD_DISABLED)
|
||||
list(APPEND FFMPEG_CONFIGURE "--disable-crystalhd")
|
||||
endif()
|
||||
|
||||
if (NOT WITH_EXTERNAL_WARNINGS)
|
||||
list(APPEND FFMPEG_CONFIGURE
|
||||
"--extra-cflags=-w"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (IS_DIRECTORY "${SM_FFMPEG_SRC_DIR}")
|
||||
externalproject_add("ffmpeg"
|
||||
SOURCE_DIR "${SM_FFMPEG_SRC_DIR}"
|
||||
CONFIGURE_COMMAND ${FFMPEG_CONFIGURE}
|
||||
BUILD_COMMAND "make"
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
else()
|
||||
# --shlibdir=$our_installdir/stepmania-$VERSION
|
||||
externalproject_add("ffmpeg"
|
||||
DOWNLOAD_COMMAND git clone "--branch" "n${SM_FFMPEG_VERSION}" "--depth" "1" "git://source.ffmpeg.org/ffmpeg.git" "${SM_FFMPEG_SRC_DIR}"
|
||||
CONFIGURE_COMMAND "${FFMPEG_CONFIGURE}"
|
||||
BUILD_COMMAND "make"
|
||||
UPDATE_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
include("${SM_CMAKE_DIR}/SetupFfmpeg.cmake")
|
||||
set(HAS_FFMPEG TRUE)
|
||||
endif()
|
||||
else()
|
||||
|
||||
@@ -274,6 +274,16 @@ if(NOT APPLE)
|
||||
list(APPEND SMDATA_ARCH_LIGHTS_HPP
|
||||
"arch/Lights/LightsDriver_Export.h"
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
list(APPEND SMDATA_ARCH_LIGHTS_SRC
|
||||
"arch/Lights/LightsDriver_SextetStream.cpp"
|
||||
)
|
||||
list(APPEND SMDATA_ARCH_LIGHTS_SRC
|
||||
"arch/Lights/LightsDriver_SextetStream.h"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND SMDATA_ARCH_LIGHTS_SRC
|
||||
"arch/Lights/LightsDriver_Win32Parallel.cpp"
|
||||
@@ -341,6 +351,14 @@ if(WIN32)
|
||||
"arch/InputHandler/InputHandler_Win32_Para.h"
|
||||
"arch/InputHandler/InputHandler_Win32_Pump.h"
|
||||
)
|
||||
if (NOT MSVC)
|
||||
list(APPEND SMDATA_ARCH_INPUT_SRC
|
||||
"arch/InputHandler/InputHandler_SextetStream.cpp"
|
||||
)
|
||||
list(APPEND SMDATA_ARCH_INPUT_HPP
|
||||
"arch/InputHandler/InputHandler_SextetStream.h"
|
||||
)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
list(APPEND SMDATA_ARCH_INPUT_SRC
|
||||
"arch/InputHandler/InputHandler_MacOSX_HID.cpp"
|
||||
@@ -355,12 +373,14 @@ else() # Unix/Linux
|
||||
"arch/InputHandler/InputHandler_Linux_Joystick.cpp"
|
||||
"arch/InputHandler/InputHandler_Linux_Event.cpp"
|
||||
"arch/InputHandler/InputHandler_Linux_PIUIO.cpp"
|
||||
"arch/InputHandler/InputHandler_SextetStream.cpp"
|
||||
)
|
||||
list(APPEND SMDATA_ARCH_INPUT_SRC
|
||||
"arch/InputHandler/LinuxInputManager.h"
|
||||
"arch/InputHandler/InputHandler_Linux_Joystick.h"
|
||||
"arch/InputHandler/InputHandler_Linux_Event.h"
|
||||
"arch/InputHandler/InputHandler_Linux_PIUIO.h"
|
||||
"arch/InputHandler/InputHandler_SextetStream.h"
|
||||
)
|
||||
if(WITH_TTY)
|
||||
list(APPEND SMDATA_ARCH_INPUT_SRC
|
||||
|
||||
@@ -22,7 +22,9 @@ InputHandler_Win32_Pump::InputHandler_Win32_Pump()
|
||||
m_pDevice = new USBDevice[NUM_PUMPS];
|
||||
|
||||
int iNumFound = 0;
|
||||
for( int p = 0; p < ARRAYSIZE(pump_usb_pids); ++p )
|
||||
// TODO: Use C++1x semantics to loop through the pids.
|
||||
// Hardcoding for now to keep this moving.
|
||||
for( int p = 0; p < 2; ++p )
|
||||
{
|
||||
const int pump_usb_pid = pump_usb_pids[p];
|
||||
for( int i = 0; i < NUM_PUMPS; ++i )
|
||||
|
||||
@@ -89,8 +89,10 @@ struct tm *my_localtime_r( const time_t *timep, struct tm *result );
|
||||
#define localtime_r my_localtime_r
|
||||
struct tm *my_gmtime_r( const time_t *timep, struct tm *result );
|
||||
#define gmtime_r my_gmtime_r
|
||||
#if defined(_MSC_VER)
|
||||
void my_usleep( unsigned long usec );
|
||||
#define usleep my_usleep
|
||||
#endif
|
||||
|
||||
// Missing stdint types:
|
||||
#if !defined(__MINGW32__) // MinGW headers define these for us
|
||||
|
||||
@@ -126,6 +126,24 @@ typedef long ssize_t;
|
||||
/* Defined to 1 if compiling with OGG support. */
|
||||
#cmakedefine HAS_OGG 1
|
||||
|
||||
/* Defined to 1 if building on a windows system, and thus uses the windows loading window. */
|
||||
#cmakedefine NEED_WINDOWS_LOADING_WINDOW 1
|
||||
|
||||
/* Defined to 1 if the PBS_MARQUEE symbol was found. */
|
||||
#cmakedefine HAVE_PBS_MARQUEE 1
|
||||
|
||||
/* Defined to 1 if the PBM_SETMARQUEE symbol was found. */
|
||||
#cmakedefine HAVE_PBM_SETMARQUEE 1
|
||||
|
||||
#if defined(NEED_WINDOWS_LOADING_WINDOW)
|
||||
#if !defined(HAVE_PBS_MARQUEE)
|
||||
#define PBS_MARQUEE 0x08
|
||||
#endif
|
||||
#if !defined(HAVE_PBM_SETMARQUEE)
|
||||
#define PBM_SETMARQUEE (WM_USER+10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/** @brief Define a macro to tell the compiler that a function has printf()
|
||||
* semantics, to aid warning output. */
|
||||
|
||||
Reference in New Issue
Block a user