More CMake work:

- various fixes for using CMake on Windows
- support building external SDL, zlib, CLRun, wxWidgets
- support using precompiled GLew and WiiUse libs on Windows

For what it's worth, I'm not quite sure if I got all the wx files right...
Building with MSVC2008 still doesn't work yet, but is a lot closer now.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6361 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-11-08 14:04:56 +00:00
parent b565618442
commit 4782a8fc5a
9 changed files with 520 additions and 49 deletions

View File

@ -49,6 +49,12 @@ if(VISIBILITY_HIDDEN)
add_definitions(-fvisibility=hidden)
endif(VISIBILITY_HIDDEN)
if(WIN32)
add_definitions(-D_SECURE_SCL=0)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(WIN32)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
if(NOT CMAKE_BUILD_TYPE)
@ -89,9 +95,7 @@ include(FindOpenGL REQUIRED)
include(FindALSA OPTIONAL)
include(FindOpenAL OPTIONAL)
set(DISABLE_WX FALSE CACHE BOOL "Disable wxWidgets (use CLI interface)")
if(NOT DISABLE_WX)
include(FindwxWidgets OPTIONAL)
endif(NOT DISABLE_WX)
if(UNIX)
include(FindX11 REQUIRED)
endif(UNIX)
@ -148,26 +152,6 @@ else()
message("OpenAL NOT found, disabling OpenAL sound backend")
endif(OPENAL_FOUND)
if(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=1)
include(${wxWidgets_USE_FILE})
if(UNIX)
pkg_search_module(GTK2 REQUIRED gtk+-2.0)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
message("GTK 2 found")
else(GTK2_FOUND)
message("GTK 2 NOT found")
endif(GTK2_FOUND)
endif(UNIX)
message("wxWidgets found, enabling GUI build")
else(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=0)
message("wxWidgets NOT found, disabling GUI build (using CLI interface)")
endif(wxWidgets_FOUND)
if(X11_FOUND)
add_definitions(-DHAVE_X11=1)
include_directories(${X11_INCLUDE_DIR})
@ -202,19 +186,6 @@ else()
set(PORTAUDIO_FOUND FALSE)
endif(PORTAUDIO)
find_library(OPENCL OpenCL)
find_path(OPENCL_INCLUDE CL/cl.h)
if(OPENCL AND OPENCL_INCLUDE)
message("OpenCL found")
add_definitions(-DHAVE_OPENCL=1)
include_directories(${OPENCL_INCLUDE})
set(OPENCL_FOUND TRUE)
else()
message("OpenCL not found")
add_definitions(-DHAVE_OPENCL=0)
set(OPENCL_FOUND FALSE)
endif(OPENCL AND OPENCL_INCLUDE)
########################################
# Setup include directories (and make sure they are preferred over the Externals)
@ -269,10 +240,10 @@ if(SDL_FOUND)
message("Using shared SDL")
include_directories(${SDL_INCLUDE_DIR})
else(SDL_FOUND)
# TODO: No CMakeLists.txt there, yet...
# TODO: Use the prebuild one on Windows
message("Shared SDL not found, falling back to the static library")
add_subdirectory(Externals/SDL)
include_directories(Externals/SDL/include)
add_subdirectory(Externals/SDL)
endif(SDL_FOUND)
find_library(SFML_NETWORK sfml-network)
@ -297,17 +268,71 @@ else()
include_directories(Externals/SOIL)
endif(SOIL AND SOIL_INCLUDE)
include(FindZLIB OPTIONAL) # TODO: Move to top
include(FindZLIB OPTIONAL) # TODO: Move to top, TODO: Module prints out an error?
if(ZLIB_FOUND)
message("Using shared zlib")
include_directories(${ZLIB_INCLUDE_DIRS})
else(ZLIB_FOUND)
# TODO: No CMakeLists.txt there, yet...
message("Shared zlib not found, falling back to the static library")
add_subdirectory(Externals/zlib)
include_directories(Externals/zlib)
endif(ZLIB_FOUND)
add_subdirectory(Externals/WiiUse)
include_directories(Externals/WiiUse/Src)
if(UNIX OR APPLE)
add_subdirectory(Externals/WiiUse)
include_directories(Externals/WiiUse/Src)
elseif(WIN32)
# use the precompiled ones
# TODO: Use the 64 bit lib on 64 bit systems...
# TODO: If WDK is installed, we can compile this from source as well
find_library(WIIUSE wiiuse PATHS Externals/WiiUse/Win32 NO_DEFAULT_PATH)
include_directories(Externals/WiiUse/Src)
endif()
if(WIN32)
find_library(GLEW glew32s PATHS Externals/GLew)
include_directories(Externals/GLew/include)
endif()
find_library(OPENCL OpenCL)
find_path(OPENCL_INCLUDE CL/cl.h)
if(OPENCL AND OPENCL_INCLUDE)
message("OpenCL found")
add_definitions(-DHAVE_OPENCL=1)
include_directories(${OPENCL_INCLUDE})
set(OPENCL_FOUND TRUE)
else()
message("OpenCL not found, using CLRun instead")
include_directories(Externals/CLRun/include)
add_subdirectory(Externals/CLRun)
endif(OPENCL AND OPENCL_INCLUDE)
if(NOT DISABLE_WX)
include(FindwxWidgets OPTIONAL)
if(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=1)
include(${wxWidgets_USE_FILE})
if(UNIX)
pkg_search_module(GTK2 REQUIRED gtk+-2.0)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
message("GTK 2 found")
else(GTK2_FOUND)
message("GTK 2 NOT found")
endif(GTK2_FOUND)
endif(UNIX)
message("wxWidgets found, enabling GUI build")
else(wxWidgets_FOUND)
message("Shared wxWidgets not found, falling back to the static library")
add_definitions(-DHAVE_WX=1)
include_directories(Externals/wxWidgets/include)
add_subdirectory(Externals/wxWidgets)
endif(wxWidgets_FOUND)
endif(NOT DISABLE_WX)
########################################

6
Externals/CLRun/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
set(SRCS clrun/clrun.c
clrun/dynamiclib.c
clrun/gencl.c
clrun/genclgl.c)
add_library(clrun STATIC ${SRCS})

21
Externals/SDL/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,21 @@
add_definitions(-DSDL_VIDEO_DISABLED=1)
add_definitions(-DSDL_EVENTS_DISABLED=1)
set(SRCS src/SDL.c
src/SDL_error.c
src/SDL_fatal.c
src/joystick/SDL_joystick.c)
# TODO: for BSD: add usbhid to libs, add joystick/bsd/SDL_sysjoystick.c, stdlib/SDL_malloc.c and stdlib/SDL_string.c to sources
if(APPLE)
set(SRCS ${SRCS} src/joystick/darwin/SDL_sysjoystick.c)
elseif(UNIX)
set(SRCS ${SRCS} src/joystick/linux/SDL_sysjoystick.c)
elseif(WIN32)
set(SRCS ${SRCS} src/joystick/win32/SDL_mmjoystick.c)
else()
set(SRCS ${SRCS} src/joystick/dummy/SDL_sysjoystick.c)
endif()
add_library(SDL STATIC ${SRCS})

View File

@ -6,7 +6,12 @@ set(SRCS src/SFML/Network/Ftp.cpp
src/SFML/Network/Packet.cpp
src/SFML/Network/SelectorBase.cpp
src/SFML/Network/SocketTCP.cpp
src/SFML/Network/SocketUDP.cpp
src/SFML/Network/Unix/SocketHelper.cpp)
src/SFML/Network/SocketUDP.cpp)
if(UNIX OR APPLE)
set(SRCS ${SRCS} src/SFML/Network/Unix/SocketHelper.cpp)
elseif(WIN32)
set(SRCS ${SRCS} src/SFML/Network/Win32/SocketHelper.cpp)
endif()
add_library(sfml-network ${SRCS})

396
Externals/wxWidgets/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,396 @@
# wxAdv28
set(SRCS src/common/accesscmn.cpp
src/common/datavcmn.cpp
src/common/dummy.cpp
src/common/taskbarcmn.cpp
src/generic/aboutdlgg.cpp
src/generic/animateg.cpp
src/generic/bmpcboxg.cpp
src/generic/calctrl.cpp
src/generic/datavgen.cpp
src/generic/datectlg.cpp
src/generic/grid.cpp
src/generic/gridctrl.cpp
src/generic/gridsel.cpp
src/generic/helpext.cpp
src/generic/hyperlink.cpp
src/generic/laywin.cpp
src/generic/odcombo.cpp
src/generic/propdlg.cpp
src/generic/sashwin.cpp
src/generic/splash.cpp
src/generic/tipdlg.cpp
src/generic/wizard.cpp
src/msw/aboutdlg.cpp
src/msw/datectrl.cpp
src/msw/joystick.cpp
src/msw/sound.cpp
src/msw/taskbar.cpp)
add_library(wxAdv28 STATIC ${SRCS})
# wxAui
set(SRCS src/aui/auibar.cpp
src/aui/auibook.cpp
src/aui/dockart.cpp
src/aui/floatpane.cpp
src/aui/framemanager.cpp
src/aui/tabmdi.cpp
src/common/dummy.cpp)
add_library(wxAui STATIC ${SRCS})
# wxBase28
set(SRCS src/common/appbase.cpp
src/common/arcall.cpp
src/common/arcfind.cpp
src/common/archive.cpp
src/common/clntdata.cpp
src/common/cmdline.cpp
src/common/config.cpp
src/common/convauto.cpp
src/common/datetime.cpp
src/common/datstrm.cpp
src/common/dircmn.cpp
src/common/dummy.cpp
src/common/dynarray.cpp
src/common/dynlib.cpp
src/common/dynload.cpp
src/common/encconv.cpp
src/common/event.cpp
src/common/extended.c
src/common/ffile.cpp
src/common/file.cpp
src/common/fileback.cpp
src/common/fileconf.cpp
src/common/filefn.cpp
src/common/filename.cpp
src/common/filesys.cpp
src/common/filtall.cpp
src/common/filtfind.cpp
src/common/fmapbase.cpp
src/common/fs_arc.cpp
src/common/fs_filter.cpp
src/common/fs_mem.cpp
src/common/hash.cpp
src/common/hashmap.cpp
src/common/init.cpp
src/common/intl.cpp
src/common/ipcbase.cpp
src/common/list.cpp
src/common/log.cpp
src/common/longlong.cpp
src/common/memory.cpp
src/common/mimecmn.cpp
src/common/module.cpp
src/common/msgout.cpp
src/common/mstream.cpp
src/common/object.cpp
src/common/platinfo.cpp
src/common/powercmn.cpp
src/common/process.cpp
src/common/regex.cpp
src/common/sstream.cpp
src/common/stdpbase.cpp
src/common/stopwatch.cpp
src/common/strconv.cpp
src/common/stream.cpp
src/common/string.cpp
src/common/sysopt.cpp
src/common/tarstrm.cpp
src/common/textbuf.cpp
src/common/textfile.cpp
src/common/tokenzr.cpp
src/common/txtstrm.cpp
src/common/uri.cpp
src/common/utilscmn.cpp
src/common/variant.cpp
src/common/wfstream.cpp
src/common/wxchar.cpp
src/common/xti.cpp
src/common/xtistrm.cpp
src/common/zipstrm.cpp
src/common/zstream.cpp
src/msw/basemsw.cpp
src/msw/crashrpt.cpp
src/msw/dde.cpp
src/msw/debughlp.cpp
src/msw/dir.cpp
src/msw/dlmsw.cpp
src/msw/main.cpp
src/msw/mimetype.cpp
src/msw/mslu.cpp
src/msw/power.cpp
src/msw/regconf.cpp
src/msw/registry.cpp
src/msw/snglinst.cpp
src/msw/stackwalk.cpp
src/msw/stdpaths.cpp
src/msw/thread.cpp
src/msw/utils.cpp
src/msw/utilsexc.cpp
src/msw/volume.cpp)
add_library(wxBase28 STATIC ${SRCS})
# wxCore28
set(SRCS src/common/accesscmn.cpp
src/common/anidecod.cpp
src/common/appcmn.cpp
src/common/artprov.cpp
src/common/artstd.cpp
src/common/bmpbase.cpp
src/common/bookctrl.cpp
src/common/choiccmn.cpp
src/common/clipcmn.cpp
src/common/clrpickercmn.cpp
src/common/cmdproc.cpp
src/common/cmndata.cpp
src/common/colourcmn.cpp
src/common/combocmn.cpp
src/common/containr.cpp
src/common/cshelp.cpp
src/common/ctrlcmn.cpp
src/common/ctrlsub.cpp
src/common/datacmn.cpp
src/common/dcbase.cpp
src/common/dcbufcmn.cpp
src/common/dcgraph.cpp
src/common/dlgcmn.cpp
src/common/dndcmn.cpp
src/common/dobjcmn.cpp
src/common/docmdi.cpp
src/common/docview.cpp
src/common/dpycmn.cpp
src/common/dseldlg.cpp
src/common/dummy.cpp
src/common/effects.cpp
src/common/event.cpp
src/common/evtloopcmn.cpp
src/common/fddlgcmn.cpp
src/common/filepickercmn.cpp
src/common/fldlgcmn.cpp
src/common/fontcmn.cpp
src/common/fontenumcmn.cpp
src/common/fontmap.cpp
src/common/fontpickercmn.cpp
src/common/framecmn.cpp
src/common/fs_mem.cpp
src/common/gaugecmn.cpp
src/common/gbsizer.cpp
src/common/gdicmn.cpp
src/common/geometry.cpp
src/common/gifdecod.cpp
src/common/graphcmn.cpp
src/common/helpbase.cpp
src/common/iconbndl.cpp
src/common/imagall.cpp
src/common/imagbmp.cpp
src/common/image.cpp
src/common/imagfill.cpp
src/common/imaggif.cpp
src/common/imagiff.cpp
src/common/imagjpeg.cpp
src/common/imagpcx.cpp
src/common/imagpng.cpp
src/common/imagpnm.cpp
src/common/imagtga.cpp
src/common/imagtiff.cpp
src/common/imagxpm.cpp
src/common/layout.cpp
src/common/lboxcmn.cpp
src/common/listctrlcmn.cpp
src/common/matrix.cpp
src/common/menucmn.cpp
src/common/msgout.cpp
src/common/nbkbase.cpp
src/common/overlaycmn.cpp
src/common/paper.cpp
src/common/pickerbase.cpp
src/common/popupcmn.cpp
src/common/prntbase.cpp
src/common/quantize.cpp
src/common/radiocmn.cpp
src/common/rendcmn.cpp
src/common/rgncmn.cpp
src/common/settcmn.cpp
src/common/sizer.cpp
src/common/statbar.cpp
src/common/stockitem.cpp
src/common/tbarbase.cpp
src/common/textcmn.cpp
src/common/timercmn.cpp
src/common/toplvcmn.cpp
src/common/treebase.cpp
src/common/utilscmn.cpp
src/common/valgen.cpp
src/common/validate.cpp
src/common/valtext.cpp
src/common/wincmn.cpp
src/common/xpmdecod.cpp
src/generic/aboutdlgg.cpp
src/generic/accel.cpp
src/generic/busyinfo.cpp
src/generic/buttonbar.cpp
src/generic/choicbkg.cpp
src/generic/choicdgg.cpp
src/generic/clrpickerg.cpp
src/generic/collpaneg.cpp
src/generic/colrdlgg.cpp
src/generic/combog.cpp
src/generic/dcpsg.cpp
src/generic/dcpsg.cpp
src/generic/dirctrlg.cpp
src/generic/dirdlgg.cpp
src/generic/dragimgg.cpp
src/generic/fdrepdlg.cpp
src/generic/filedlgg.cpp
src/generic/filepickerg.cpp
src/generic/fontdlgg.cpp
src/generic/fontpickerg.cpp
src/generic/hyperlink.cpp
src/generic/hyperlink.cpp
src/generic/listbkg.cpp
src/generic/listctrl.cpp
src/generic/logg.cpp
src/generic/mdig.cpp
src/generic/msgdlgg.cpp
src/generic/numdlgg.cpp
src/generic/panelg.cpp
src/generic/printps.cpp
src/generic/prntdlgg.cpp
src/generic/progdlgg.cpp
src/generic/renderg.cpp
src/generic/scrlwing.cpp
src/generic/selstore.cpp
src/generic/spinctlg.cpp
src/generic/splitter.cpp
src/generic/srchctlg.cpp
src/generic/statusbr.cpp
src/generic/tabg.cpp
src/generic/textdlgg.cpp
src/generic/tipwin.cpp
src/generic/toolbkg.cpp
src/generic/treebkg.cpp
src/generic/treectlg.cpp
src/generic/vlbox.cpp
src/generic/vscroll.cpp
src/msw/aboutdlg.cpp
src/msw/accel.cpp
src/msw/app.cpp
src/msw/bitmap.cpp
src/msw/bmpbuttn.cpp
src/msw/brush.cpp
src/msw/button.cpp
src/msw/caret.cpp
src/msw/checkbox.cpp
src/msw/checklst.cpp
src/msw/choice.cpp
src/msw/clipbrd.cpp
src/msw/colordlg.cpp
src/msw/colour.cpp
src/msw/combo.cpp
src/msw/combobox.cpp
src/msw/control.cpp
src/msw/cursor.cpp
src/msw/data.cpp
src/msw/dc.cpp
src/msw/dcclient.cpp
src/msw/dcmemory.cpp
src/msw/dcprint.cpp
src/msw/dcscreen.cpp
src/msw/dialog.cpp
src/msw/dialup.cpp
src/msw/dib.cpp
src/msw/dirdlg.cpp
src/msw/display.cpp
src/msw/dragimag.cpp
src/msw/enhmeta.cpp
src/msw/evtloop.cpp
src/msw/fdrepdlg.cpp
src/msw/filedlg.cpp
src/msw/font.cpp
src/msw/fontdlg.cpp
src/msw/fontenum.cpp
src/msw/fontutil.cpp
src/msw/frame.cpp
src/msw/gauge95.cpp
src/msw/gdiimage.cpp
src/msw/gdiobj.cpp
src/msw/graphics.cpp
src/msw/gsockmsw.cpp
src/msw/helpchm.cpp
src/msw/helpwin.cpp
src/msw/icon.cpp
src/msw/imaglist.cpp
src/msw/iniconf.cpp
src/msw/listbox.cpp
src/msw/listctrl.cpp
src/msw/main.cpp
src/msw/mdi.cpp
src/msw/menu.cpp
src/msw/menuitem.cpp
src/msw/metafile.cpp
src/msw/minifram.cpp
src/msw/msgdlg.cpp
src/msw/mslu.cpp
src/msw/nativdlg.cpp
src/msw/notebook.cpp
src/msw/ownerdrw.cpp
src/msw/palette.cpp
src/msw/pen.cpp
src/msw/popupwin.cpp
src/msw/printdlg.cpp
src/msw/printwin.cpp
src/msw/radiobox.cpp
src/msw/radiobut.cpp
src/msw/region.cpp
src/msw/renderer.cpp
src/msw/scrolbar.cpp
src/msw/settings.cpp
src/msw/slider95.cpp
src/msw/spinbutt.cpp
src/msw/spinctrl.cpp
src/msw/statbmp.cpp
src/msw/statbox.cpp
src/msw/statbr95.cpp
src/msw/statline.cpp
src/msw/stattext.cpp
src/msw/tabctrl.cpp
src/msw/tbar95.cpp
src/msw/textctrl.cpp
src/msw/tglbtn.cpp
src/msw/timer.cpp
src/msw/tooltip.cpp
src/msw/toplevel.cpp
src/msw/treectrl.cpp
src/msw/utilsgui.cpp
src/msw/uxtheme.cpp
src/msw/volume.cpp
src/msw/window.cpp
src/msw/ole/access.cpp
src/msw/ole/automtn.cpp
src/msw/ole/dataobj.cpp
src/msw/ole/dropsrc.cpp
src/msw/ole/droptgt.cpp
src/msw/ole/oleutils.cpp
src/msw/ole/uuid.cpp
src/png/png.c
src/png/pngerror.c
src/png/pnggccrd.c
src/png/pngget.c
src/png/pngmem.c
src/png/pngpread.c
src/png/pngread.c
src/png/pngrio.c
src/png/pngrtran.c
src/png/pngrutil.c
src/png/pngset.c
src/png/pngtest.c
src/png/pngtrans.c
src/png/pngvcrd.c
src/png/pngwio.c
src/png/pngwrite.c
src/png/pngwtran.c
src/png/pngwutil.c)
add_library(wxCore28 STATIC ${SRCS})

14
Externals/zlib/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,14 @@
set(SRCS adler32.c
compress.c
crc32.c
deflate.c
gzio.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c)
add_library(z STATIC ${SRCS})

View File

@ -22,5 +22,6 @@ endif(wxWidgets_FOUND)
add_library(Plugin_DSP_HLE SHARED ${SRCS})
target_link_libraries(Plugin_DSP_HLE common audiocommon)
install(TARGETS Plugin_DSP_HLE LIBRARY DESTINATION ${plugindir})
install(TARGETS Plugin_DSP_HLE
LIBRARY DESTINATION ${plugindir}
RUNTIME DESTINATION ${plugindir})

View File

@ -20,5 +20,7 @@ endif(wxWidgets_FOUND)
add_library(Plugin_DSP_LLE SHARED ${SRCS})
target_link_libraries(Plugin_DSP_LLE ${LIBS})
install(TARGETS Plugin_DSP_LLE LIBRARY DESTINATION ${plugindir})
install(TARGETS Plugin_DSP_LLE
LIBRARY DESTINATION ${plugindir}
RUNTIME DESTINATION ${plugindir})

View File

@ -36,5 +36,6 @@ endif()
add_library(Plugin_VideoOGL SHARED ${SRCS})
target_link_libraries(Plugin_VideoOGL ${LIBS})
install(TARGETS Plugin_VideoOGL LIBRARY DESTINATION ${plugindir})
install(TARGETS Plugin_VideoOGL
LIBRARY DESTINATION ${plugindir}
RUNTIME DESTINATION ${plugindir})