Merge pull request #4699 from Orphis/cmake_cleanup

CMake cleanup (but wait, there's more!)
This commit is contained in:
Matthew Parlane 2017-01-21 16:38:09 +13:00 committed by GitHub
commit 7ebfd357b5
9 changed files with 93 additions and 45 deletions

View File

@ -589,7 +589,7 @@ if(USE_X11)
add_definitions(-DHAVE_XRANDR=0)
endif(XRANDR_FOUND)
pkg_check_modules(XINPUT2 REQUIRED xi>=1.5.0)
pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0)
endif()
if(ENCODE_FRAMEDUMPS)
check_libav()

View File

@ -61,30 +61,66 @@ macro(check_libav)
pkg_check_modules(LIBAV libavcodec>=54.35.0 libavformat>=54.20.4
libswscale>=2.1.1 libavutil>=52.3.0)
else()
# Attempt to find it through static means
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS})
CHECK_CXX_SOURCE_COMPILES(
"extern \"C\" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
}
int main(int argc, char **argv)
{
av_register_all();
return 0;
}"
LIBAV_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
if(WIN32)
add_library(avcodec STATIC IMPORTED)
set_target_properties(avcodec PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avcodec.lib
)
add_library(avformat STATIC IMPORTED)
set_target_properties(avformat PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avformat.lib
)
add_library(avutil STATIC IMPORTED)
set_target_properties(avutil PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avutil.lib
)
add_library(swresample STATIC IMPORTED)
set_target_properties(swresample PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swresample.lib
)
add_library(swscale STATIC IMPORTED)
set_target_properties(swscale PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swscale.lib
)
set(LIBAV_FOUND ON)
set(LIBAV_LIBRARIES avcodec avformat avutil swresample swscale)
else()
# Attempt to find it through static means
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS})
CHECK_CXX_SOURCE_COMPILES(
"extern \"C\" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
}
int main(int argc, char **argv)
{
av_register_all();
return 0;
}"
LIBAV_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()
endif()
if(LIBAV_FOUND)
message(STATUS "libav/ffmpeg found, enabling AVI frame dumps")
add_definitions(-DHAVE_LIBAV)
include_directories(${LIBAV_INCLUDE_DIRS})
if(LIBAV_INCLUDE_DIRS)
include_directories(${LIBAV_INCLUDE_DIRS})
endif()
else()
message(STATUS "libav/ffmpeg not found, disabling AVI frame dumps")
endif()
endmacro()

View File

@ -18,5 +18,7 @@ set(SRCS
pngwtran.c
pngwutil.c
)
add_definitions(-Wno-self-assign)
if(NOT MSVC)
add_definitions(-Wno-self-assign)
endif()
add_library(png STATIC ${SRCS})

View File

@ -164,7 +164,7 @@ set(SRCS_COMMON
"src/common/object.cpp"
"src/common/odcombocmn.cpp"
"src/common/overlaycmn.cpp"
#"src/common/ownerdrwcmn.cpp"
"src/common/ownerdrwcmn.cpp"
"src/common/panelcmn.cpp"
"src/common/paper.cpp"
"src/common/persist.cpp"
@ -265,7 +265,7 @@ set(SRCS_GENERIC
"src/generic/busyinfo.cpp"
"src/generic/buttonbar.cpp"
"src/generic/calctrlg.cpp"
"src/generic/caret.cpp"
#"src/generic/caret.cpp"
"src/generic/choicbkg.cpp"
"src/generic/choicdgg.cpp"
"src/generic/collheaderctrlg.cpp"
@ -279,7 +279,7 @@ set(SRCS_GENERIC
"src/generic/dirctrlg.cpp"
"src/generic/dragimgg.cpp"
"src/generic/editlbox.cpp"
"src/generic/fdrepdlg.cpp"
#"src/generic/fdrepdlg.cpp"
"src/generic/filectrlg.cpp"
"src/generic/filepickerg.cpp"
"src/generic/fontdlgg.cpp"
@ -348,7 +348,8 @@ set(SRCS_GENERICGTK
"src/generic/preferencesg.cpp")
set(SRCS_GENERICMSW
"src/generic/activityindicator.cpp")
"src/generic/activityindicator.cpp"
"src/generic/collpaneg.cpp")
set(SRCS_GENERICOSX
"src/generic/animateg.cpp"
@ -504,7 +505,7 @@ set(SRCS_MSW
"src/msw/dragimag.cpp"
#"src/msw/enhmeta.cpp"
"src/msw/evtloop.cpp"
#"src/msw/evtloopconsole.cpp"
"src/msw/evtloopconsole.cpp"
"src/msw/fdrepdlg.cpp"
"src/msw/filedlg.cpp"
"src/msw/font.cpp"
@ -608,11 +609,11 @@ set(SRCS_MSW
"src/msw/utilsgui.cpp"
"src/msw/utilswin.cpp"
"src/msw/uxtheme.cpp"
"src/msw/version.rc"
#"src/msw/version.rc"
"src/msw/volume.cpp"
#"src/msw/webview_ie.cpp"
"src/msw/window.cpp"
"src/msw/winestub.c"
#"src/msw/winestub.c"
#"src/msw/rt/notifmsgrt.cpp"
#"src/msw/rt/utilsrt.cpp"
)
@ -872,16 +873,23 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
${X11_Xinerama_LIB})
else()
add_definitions(-D__WXMSW__)
add_definitions(-DNOPCH)
remove_definitions(-DWIN32_LEAN_AND_MEAN)
set(SRCS
${SRCS}
${SRCS_GENERICMSW}
${SRCS_MSW})
set(LIBS
Comctl32.lib
Rpcrt4.lib
${OPENGL_LIBRARIES}
)
endif()
add_definitions(-DWXBUILDING)
# wxWidgets warnings are not our problem.
add_definitions(-w)
enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS)
#enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS)
add_library(wx STATIC ${PNG_SRCS} ${SRCS})
target_link_libraries(wx ${LIBS})

View File

@ -1370,6 +1370,9 @@
<ClCompile>
<PreprocessorDefinitions>__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Lib>
<AdditionalOptions>/ignore:4221</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">

View File

@ -269,7 +269,7 @@
#define wxUSE_DYNAMIC_LOADER 1
#define wxUSE_SOCKETS 1
#define wxUSE_SOCKETS 0
#define wxUSE_IPV6 1
@ -279,7 +279,7 @@
#define wxUSE_FS_ARCHIVE 1
#define wxUSE_FS_INET 1
#define wxUSE_FS_INET 0
#define wxUSE_ARCHIVE_STREAMS 1
@ -299,13 +299,13 @@
#define wxUSE_MIMETYPE 1
#define wxUSE_PROTOCOL 1
#define wxUSE_PROTOCOL 0
#define wxUSE_PROTOCOL_FILE 1
#define wxUSE_PROTOCOL_FTP 1
#define wxUSE_PROTOCOL_HTTP 1
#define wxUSE_URL 1
#define wxUSE_URL 0
#define wxUSE_URL_NATIVE 0
@ -1173,7 +1173,7 @@
#define HAVE_ICONV 1
/* Define as "const" if the declaration of iconv() needs const. */
#define ICONV_CONST
#define ICONV_CONST
/* Define if you have the <langinfo.h> header file. */
#define HAVE_LANGINFO_H 1
@ -1289,4 +1289,3 @@
/* #undef wxHAS_WORKING_GTK_DC_BLIT */
#endif /* __WX_SETUP_H__ */

View File

@ -259,7 +259,7 @@
#define wxUSE_DYNAMIC_LOADER 1
#define wxUSE_SOCKETS 1
#define wxUSE_SOCKETS 0
#define wxUSE_IPV6 1
@ -269,7 +269,7 @@
#define wxUSE_FS_ARCHIVE 1
#define wxUSE_FS_INET 1
#define wxUSE_FS_INET 0
#define wxUSE_ARCHIVE_STREAMS 1
@ -289,13 +289,13 @@
#define wxUSE_MIMETYPE 1
#define wxUSE_PROTOCOL 1
#define wxUSE_PROTOCOL 0
#define wxUSE_PROTOCOL_FILE 1
#define wxUSE_PROTOCOL_FTP 1
#define wxUSE_PROTOCOL_HTTP 1
#define wxUSE_URL 1
#define wxUSE_URL 0
#define wxUSE_URL_NATIVE 0
@ -1283,4 +1283,3 @@
/* #undef wxHAS_WORKING_GTK_DC_BLIT */
#endif /* __WX_SETUP_H__ */

View File

@ -544,7 +544,7 @@
#define wxUSE_DYNAMIC_LOADER 1
// Set to 1 to use socket classes
#define wxUSE_SOCKETS 1
#define wxUSE_SOCKETS 0
// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS)
//
@ -567,7 +567,7 @@
#define wxUSE_FS_ARCHIVE 1
// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM)
#define wxUSE_FS_INET 1
#define wxUSE_FS_INET 0
// wxArchive classes for accessing archives such as zip and tar
#define wxUSE_ARCHIVE_STREAMS 1
@ -609,7 +609,7 @@
// Default is 1.
//
// Recommended setting: 1
#define wxUSE_PROTOCOL 1
#define wxUSE_PROTOCOL 0
// The settings for the individual URL schemes
#define wxUSE_PROTOCOL_FILE 1
@ -617,7 +617,7 @@
#define wxUSE_PROTOCOL_HTTP 1
// Define this to use wxURL class.
#define wxUSE_URL 1
#define wxUSE_URL 0
// Define this to use native platform url and protocol support.
// Currently valid only for MS-Windows.

View File

@ -10,6 +10,7 @@ if(WIN32)
ControllerInterface/DInput/DInput.cpp
ControllerInterface/DInput/DInputJoystick.cpp
ControllerInterface/DInput/DInputKeyboardMouse.cpp
ControllerInterface/DInput/XInputFilter.cpp
ControllerInterface/XInput/XInput.cpp
ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp)
elseif(APPLE)
@ -27,7 +28,7 @@ elseif(APPLE)
elseif(X11_FOUND)
set(SRCS ${SRCS}
ControllerInterface/Xlib/XInput2.cpp)
set(LIBS ${LIBS} ${X11_LIBRARIES} ${XINPUT2_LIBRARIES})
set(LIBS ${LIBS} ${X11_LIBRARIES} ${X11_INPUT_LIBRARIES})
elseif(ANDROID)
add_definitions(-DCIFACE_USE_ANDROID)
set(SRCS ${SRCS}