cmakelists changes, wxwidgets interface build fix to follow.

This commit is contained in:
wowzaman12 2015-03-27 17:48:42 +00:00
parent 2af279f274
commit dc3b921700
4 changed files with 160 additions and 184 deletions

View File

@ -7,6 +7,8 @@ if( COMMAND cmake_policy )
cmake_policy( SET CMP0005 OLD )
endif( COMMAND cmake_policy )
SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts )
#Output all binaries at top level
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
option( ENABLE_SDL "Build the SDL port" ON )
option( ENABLE_GTK "Build the GTK+ GUI" ON )
@ -75,23 +77,8 @@ SET(VBAMCORE_LIBS
${SFML_LIBRARY}
${OPENGL_LIBRARIES}
${ZLIB_LIBRARY}
${PNG_LIBRARY})
# Disable looking for GTK if not going to build the GTK frontend
# so that pkg-config is not required
IF( ENABLE_GTK )
FIND_PACKAGE ( PkgConfig REQUIRED )
FIND_PACKAGE ( Gettext REQUIRED )
# These dependencies require pkg-config to be found
PKG_CHECK_MODULES ( GTKMM REQUIRED gtkmm-2.4 )
PKG_CHECK_MODULES ( GDKMM REQUIRED gdkmm-2.4 )
PKG_CHECK_MODULES ( GLIBMM REQUIRED glibmm-2.4 )
PKG_CHECK_MODULES ( GIOMM REQUIRED giomm-2.4 )
PKG_CHECK_MODULES ( GTKGLMM REQUIRED gtkglextmm-x11-1.2 )
ENDIF( ENABLE_GTK )
${PNG_LIBRARY}
)
if(ENABLE_FFMPEG)
FIND_PACKAGE ( PkgConfig REQUIRED )
@ -194,36 +181,7 @@ SET( CMAKE_CXX_FLAGS_RELEASE "-O3")
SET( CMAKE_C_FLAGS_DEBUG "-g -Wall")
SET( CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
# Source files definition
SET(SRC_FEX
fex/7z_C/7zAlloc.c
fex/7z_C/7zBuf.c
fex/7z_C/7zCrc.c
fex/7z_C/7zCrcOpt.c
fex/7z_C/7zDec.c
fex/7z_C/7zIn.c
fex/7z_C/7zStream.c
fex/7z_C/Bcj2.c
fex/7z_C/Bra86.c
fex/7z_C/Bra.c
fex/7z_C/CpuArch.c
fex/7z_C/Lzma2Dec.c
fex/7z_C/LzmaDec.c
fex/7z_C/Ppmd7.c
fex/7z_C/Ppmd7Dec.c
fex/fex/Binary_Extractor.cpp
fex/fex/blargg_common.cpp
fex/fex/blargg_errors.cpp
fex/fex/Data_Reader.cpp
fex/fex/fex.cpp
fex/fex/File_Extractor.cpp
fex/fex/Gzip_Extractor.cpp
fex/fex/Gzip_Reader.cpp
fex/fex/Rar_Extractor.cpp
fex/fex/Zip7_Extractor.cpp
fex/fex/Zip_Extractor.cpp
fex/fex/Zlib_Inflater.cpp
)
add_subdirectory (fex)
SET(SRC_MAIN
src/Util.cpp
@ -326,31 +284,6 @@ else( ENABLE_ASM_SCALERS )
ADD_DEFINITIONS ( -DNO_ASM )
endif( ENABLE_ASM_SCALERS )
SET(SRC_GTK
src/gtk/configfile.cpp
src/gtk/main.cpp
src/gtk/system.cpp
src/gtk/windowcallbacks.cpp
src/gtk/filters.cpp
src/gtk/generalconfig.cpp
src/gtk/gameboyconfig.cpp
src/gtk/gameboyadvanceconfig.cpp
src/gtk/cheatlist.cpp
src/gtk/cheatedit.cpp
src/gtk/gameboyadvancecheatlist.cpp
src/gtk/gameboycheatlist.cpp
src/gtk/joypadconfig.cpp
src/gtk/directoriesconfig.cpp
src/gtk/displayconfig.cpp
src/gtk/soundconfig.cpp
src/gtk/screenarea.cpp
src/gtk/screenarea-cairo.cpp
src/gtk/screenarea-opengl.cpp
src/gtk/tools.cpp
src/gtk/window.cpp
src/sdl/inputSDL.cpp
)
if( ENABLE_DEBUGGER )
SET(SRC_DEBUGGER
src/gba/armdis.cpp
@ -366,34 +299,12 @@ INCLUDE_DIRECTORIES(
${SDL_INCLUDE_DIR}
)
IF( ENABLE_GTK )
INCLUDE_DIRECTORIES(
${GLIBMM_INCLUDE_DIRS}
${GIOMM_INCLUDE_DIRS}
${GTKMM_INCLUDE_DIRS}
${GDKMM_INCLUDE_DIRS}
${GTKGLMM_INCLUDE_DIRS}
)
LINK_DIRECTORIES(
${GLIBMM_LIBRARY_DIRS}
${GIOMM_LIBRARY_DIRS}
${GTKMM_LIBRARY_DIRS}
${GTKGLMM_LIBRARY_DIRS}
)
ENDIF( ENABLE_GTK )
IF( ENABLE_FFMPEG )
INCLUDE_DIRECTORIES(
${FFMPEG_INCLUDE_DIRS}
)
ENDIF( ENABLE_FFMPEG )
ADD_LIBRARY(
fex
${SRC_FEX}
)
ADD_LIBRARY (
vbamcore
${PROJECT_SRCS}
@ -426,44 +337,22 @@ IF( ENABLE_SDL )
${WIN32_LIBRARIES}
${LIRC_CLIENT_LIBRARY}
)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example
DESTINATION ${SYSCONFDIR}
RENAME vbam.cfg)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR})
IF( WIN32 )
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
ELSE( WIN32 )
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION bin)
ENDIF( WIN32 )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example
DESTINATION ${SYSCONFDIR}
RENAME vbam.cfg)
ENDIF( ENABLE_SDL )
IF( ENABLE_GTK )
ADD_EXECUTABLE (
gvbam
WIN32
MACOSX_BUNDLE
${SRC_GTK}
)
TARGET_LINK_LIBRARIES (
gvbam
${VBAMCORE_LIBS}
${GTKMM_LIBRARIES}
${GTKGLMM_LIBRARIES}
)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gvbam DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/gtk/gvbam.desktop DESTINATION share/applications)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/gtk/icons/ DESTINATION share/icons/hicolor PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/gtk/ui DESTINATION ${DATA_INSTALL_DIR} PATTERN ".svn" EXCLUDE)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR})
add_subdirectory (src/gtk)
ENDIF( ENABLE_GTK )
IF( ENABLE_WX )
# since this has generated source files, it's easier to just
# make from the subdir
# otherwise out-of-tree builds have trouble
add_subdirectory(src/wx)
ENDIF( ENABLE_WX )
if( ENABLE_GTK OR ENABLE_WX )
@ -472,3 +361,7 @@ if( ENABLE_GTK OR ENABLE_WX )
add_subdirectory(po)
endif( ENABLE_NLS )
endif( ENABLE_GTK OR ENABLE_WX )
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vba-over.ini DESTINATION ${DATA_INSTALL_DIR})
IF(NOT APPLE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/gtk/icons/ DESTINATION share/icons/hicolor PATTERN ".svn" EXCLUDE)
ENDIF(NOT APPLE)

42
fex/CMakeLists.txt Normal file
View File

@ -0,0 +1,42 @@
#Do not use this file directly. Always use the top level CMakeLists.txt file
#File extractors so the user doesn't have to extract the rom before playing it
# Source files definition
SET(SRC_FEX
7z_C/7zAlloc.c
7z_C/7zBuf.c
7z_C/7zCrc.c
7z_C/7zCrcOpt.c
7z_C/7zDec.c
7z_C/7zIn.c
7z_C/7zStream.c
7z_C/Bcj2.c
7z_C/Bra86.c
7z_C/Bra.c
7z_C/CpuArch.c
7z_C/Lzma2Dec.c
7z_C/LzmaDec.c
7z_C/Ppmd7.c
7z_C/Ppmd7Dec.c
fex/Binary_Extractor.cpp
fex/blargg_common.cpp
fex/blargg_errors.cpp
fex/Data_Reader.cpp
fex/fex.cpp
fex/File_Extractor.cpp
fex/Gzip_Extractor.cpp
fex/Gzip_Reader.cpp
fex/Rar_Extractor.cpp
fex/Zip7_Extractor.cpp
fex/Zip_Extractor.cpp
fex/Zlib_Inflater.cpp
)
INCLUDE_DIRECTORIES(
.
)
ADD_LIBRARY(
fex
${SRC_FEX}
)

86
src/gtk/CMakeLists.txt Normal file
View File

@ -0,0 +1,86 @@
#Do not use this file directly. Always use the top level CMakeLists.txt file
#GTK dependencies
FIND_PACKAGE ( PkgConfig REQUIRED )
FIND_PACKAGE ( Gettext REQUIRED )
# These dependencies require pkg-config to be found
PKG_CHECK_MODULES ( GTKMM REQUIRED gtkmm-2.4 )
PKG_CHECK_MODULES ( GDKMM REQUIRED gdkmm-2.4 )
PKG_CHECK_MODULES ( GLIBMM REQUIRED glibmm-2.4 )
PKG_CHECK_MODULES ( GIOMM REQUIRED giomm-2.4 )
PKG_CHECK_MODULES ( GTKGLMM REQUIRED gtkglextmm-x11-1.2 )
#Make sure the gtk ui elements are available for out of tree builds
#See window.cpp:1544 (the sGetUiFilePath function) for more details
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ui/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ui/)
SET(SRC_GTK
configfile.cpp
main.cpp
system.cpp
windowcallbacks.cpp
filters.cpp
generalconfig.cpp
gameboyconfig.cpp
gameboyadvanceconfig.cpp
cheatlist.cpp
cheatedit.cpp
gameboyadvancecheatlist.cpp
gameboycheatlist.cpp
joypadconfig.cpp
directoriesconfig.cpp
displayconfig.cpp
soundconfig.cpp
screenarea.cpp
screenarea-cairo.cpp
screenarea-opengl.cpp
tools.cpp
window.cpp
../sdl/inputSDL.cpp
)
INCLUDE_DIRECTORIES(
${GLIBMM_INCLUDE_DIRS}
${GIOMM_INCLUDE_DIRS}
${GTKMM_INCLUDE_DIRS}
${GDKMM_INCLUDE_DIRS}
${GTKGLMM_INCLUDE_DIRS}
)
LINK_DIRECTORIES(
${GLIBMM_LIBRARY_DIRS}
${GIOMM_LIBRARY_DIRS}
${GTKMM_LIBRARY_DIRS}
${GTKGLMM_LIBRARY_DIRS}
)
ADD_EXECUTABLE (
gvbam
WIN32
MACOSX_BUNDLE
${SRC_GTK}
)
TARGET_LINK_LIBRARIES (
gvbam
${VBAMCORE_LIBS}
${GTKMM_LIBRARIES}
${GTKGLMM_LIBRARIES}
)
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/gvbam DESTINATION bin)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ui DESTINATION ${DATA_INSTALL_DIR})
IF(NOT WIN32 AND NOT APPLE)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gvbam.desktop DESTINATION share/applications)
ENDIF(NOT WIN32 AND NOT APPLE)
if(APPLE)
#Probably don't need this
SET(CMAKE_EXECUTABLE_SUFFIX .app)
# this should set ROM file types correctly
SET_PROPERTY(TARGET wxvbam APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
endif(APPLE)
SET(WX_EXE_NAME gvbam${CMAKE_EXECUTABLE_SUFFIX})

View File

@ -1,3 +1,4 @@
#Do not use this file directly. Always use the top level CMakeLists.txt file
# This build is much easier if we just do it here.
# not yet implemented
@ -32,6 +33,7 @@ endif(ENABLE_OPENAL)
# adv is for wxAboutBox
# xml, html is for xrc
SET( wxWidgets_USE_LIBS xrc xml html adv gl net core base )
list(APPEND wxWidgets_CONFIG_OPTIONS --version=2.8)
FIND_PACKAGE ( wxWidgets REQUIRED )
EXECUTE_PROCESS(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --cxxflags)
INCLUDE( ${wxWidgets_USE_FILE} )
@ -65,44 +67,17 @@ include_directories(widgets)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# external deps
SET(ICO_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../win32/res/VBA.ico)
SET(ICO_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../gtk)
SET(WX_APP_ICON ${ICO_PARENT_DIR}/icons/32x32/apps/vbam.png)
#SET(WX_APP_ICON VBA_4_32x32x24.png)
SET(ICOX_FILES VBA_4_32x32x24.png)
#wxvbam.xrc now uses gvbam icon as well
#SET(ICOX_FILES ${ICOX_FILES} VBA_9_48x48x32.png)
# Extract icons using icoutils (http://www.nongnu.org/icoutils/)
# Used for main prog. icon and about dialog (in xrc file)
# or, just use the icons already extracted for gtk
ADD_CUSTOM_COMMAND(OUTPUT ${ICOX_FILES}
COMMAND icotool -x ${ICO_FILE}
DEPENDS ${ICO_FILE})
# Convert to xpm using ImageMagick (http://www.imagemagick.org)
# not executed on win32
IF( NOT WIN32 )
FIND_PACKAGE(ImageMagick REQUIRED convert)
ADD_CUSTOM_COMMAND(OUTPUT wxvbam.xpm
COMMAND ${ImageMagick_convert_EXECUTABLE} ${WX_APP_ICON} wxvbam.xpm
# following is done using #define in wxvbam.cpp
# so there is no dependency on sed
# COMMAND sed -i 's/wxvbam\\[/wxvbam_xpm[/;s/char \\*/const char */' wxvbam.xpm
DEPENDS ${WX_APP_ICON})
ENDIF( NOT WIN32 )
# Copy over needed icons
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/icons/vbam.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/icons/wxvbam.xpm DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# wxrc does not support xrs files in -c output (> 10x compression)
# so do it manually using slow but portable bin2c.cmake script
SET(WX_XRC_ICON icons/32x32/apps/vbam.png)
ADD_CUSTOM_COMMAND(OUTPUT wxvbam.xrs
# doing this in its own dir prevents name prefixes
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.xrc wxvbam.xrc
COMMAND ${CMAKE_COMMAND} -E copy ${ICO_PARENT_DIR}/${WX_XRC_ICON} ${WX_XRC_ICON}
COMMAND wxrc wxvbam.xrc -o wxvbam.xrs
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ICO_PARENT_DIR}/${XRC_ITEM}
DEPENDS wxvbam.xrc)
ADD_CUSTOM_COMMAND(OUTPUT builtin-xrc.h
COMMAND ${CMAKE_COMMAND} -DINFILE=wxvbam.xrs -DOUTFILE=builtin-xrc.h -DVARNAME=builtin_xrs -P ${CMAKE_CURRENT_SOURCE_DIR}/bin2c.cmake
@ -143,8 +118,6 @@ SET( SRC_WX
widgets/joyedit.cpp
widgets/sdljoy.cpp
widgets/wxmisc.cpp
# common, but not in lib, apparently
../common/SoundSDL.cpp
# probably ought to be in common
../sdl/text.cpp
# from external source with minor modifications
@ -156,6 +129,8 @@ SET( SRC_WX
builtin-over.h
cmdhandlers.h
cmd-evtable.h
#Icon File
wxvbam.xpm
)
IF(ENABLE_OPENAL)
@ -175,25 +150,8 @@ IF( WIN32 )
ENDIF(ENABLE_DEBUGGER)
ELSE( WIN32 )
SET(DIRECTX_LIBRARIES )
# generated file must be explicitly listed
SET( SRC_WX ${SRC_WX} wxvbam.xpm )
ENDIF( WIN32 )
IF(APPLE)
# icon must be generated manually
SET( SRC_WX ${SRC_WX} wxvbam.icns )
# png2icns is provided with libicns (http://icns.sourceforge.net/)
FIND_PROGRAM(PNG2ICNS png2icns)
# note: could add more icons, if available and proper size
SET(WX_APP_ICONS
${WX_APP_ICON}
${ICO_PARENT_DIR}/icons/16x16/apps/vbam.png)
ADD_CUSTOM_COMMAND(OUTPUT wxvbam.icns
COMMAND ${PNG2ICNS} wxvbam.icns ${WX_APP_ICONS})
SET(MACOSX_BUNDLE_ICON_FILE wxvbam.icns)
SET_SOURCE_FILES_PROPERTIES(wxvbam.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
ENDIF(APPLE)
link_directories( ${CMAKE_BINARY_DIR} )
ADD_EXECUTABLE (
@ -212,10 +170,9 @@ TARGET_LINK_LIBRARIES (
${CAIRO_LIBRARIES}
)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/wxvbam DESTINATION bin)
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/wxvbam${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
IF(NOT WIN32 AND NOT APPLE)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wxvbam.desktop DESTINATION share/applications)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../gtk/icons/ DESTINATION share/icons/hicolor PATTERN ".svn" EXCLUDE)
ENDIF(NOT WIN32 AND NOT APPLE)
# for consistency with others, copy exe to top-level dir
@ -225,14 +182,12 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${WX_EXE_NAME} ../../${WX_EXE_NAME})
else(WIN32)
if(APPLE)
SET(WX_EXE_NAME wxvbam.app)
SET(CMAKE_EXECUTABLE_SUFFIX .app)
# this should set ROM file types correctly
SET_PROPERTY(TARGET wxvbam APPEND PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/wxplist.in)
else(APPLE)
SET(WX_EXE_NAME wxvbam${CMAKE_EXECUTABLE_SUFFIX})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/icons/wxvbam.icns)
SET(MACOSX_BUNDLE_ICON_FILE wxvbam.icns)
SET_SOURCE_FILES_PROPERTIES(wxvbam.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif(APPLE)
ADD_CUSTOM_COMMAND(TARGET wxvbam POST_BUILD
# I'd rather make this link relative, but it's too hard
COMMAND rm -rf ../../${WX_EXE_NAME}
COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/${WX_EXE_NAME} ../../${WX_EXE_NAME})
endif(WIN32)
SET(WX_EXE_NAME wxvbam${CMAKE_EXECUTABLE_SUFFIX})