2008-06-06 18:56:41 +00:00
|
|
|
cmake_minimum_required( VERSION 2.4.6 )
|
|
|
|
if( COMMAND cmake_policy )
|
|
|
|
cmake_policy( SET CMP0003 NEW )
|
2008-06-08 20:46:25 +00:00
|
|
|
cmake_policy( SET CMP0005 OLD )
|
2008-06-06 18:56:41 +00:00
|
|
|
endif( COMMAND cmake_policy )
|
|
|
|
SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts )
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
# Include the definition of the ASM compiler. It will look for nasm
|
|
|
|
# This is probably not needed if CMake 2.6 or above is used
|
|
|
|
INCLUDE(CMakeScripts/CMakeDetermineASMCompiler.cmake)
|
|
|
|
INCLUDE(CMakeScripts/CMakeASMInformation.cmake)
|
|
|
|
|
|
|
|
# The project's name is VBA-M it uses assembly, C and C++ code
|
|
|
|
PROJECT(VBA-M ASM C CXX)
|
|
|
|
|
|
|
|
# Both the SDL and the GTK+ frontends are built by default
|
|
|
|
# To disable building the SDL frontend add -DNO_SDL=1 on the commandline
|
|
|
|
# To disable building the GTK+ frontend add -DNO_GTK=1 on the commandline
|
2008-06-16 20:18:49 +00:00
|
|
|
# To disable building the debugger, add -DNO_DEBUGGER=1.
|
|
|
|
# The SDL frontend can't be built without debugger support
|
2008-06-06 18:56:41 +00:00
|
|
|
# To use ASM scalers, add -DUSE_ASM_SCALERS=1
|
2008-06-06 10:17:20 +00:00
|
|
|
# To use the ASM core, add -DUSE_ASM_CORE=1
|
|
|
|
# Set the version number with -DVERSION=X.X.X-uber
|
|
|
|
|
|
|
|
# Version number
|
|
|
|
IF( NOT VERSION )
|
|
|
|
SET( VERSION "1.8.0-SVN" )
|
|
|
|
ENDIF( NOT VERSION )
|
|
|
|
|
2008-09-26 17:23:12 +00:00
|
|
|
# Fill in SDLMAIN_LIBRARY on OS X manually to avoid using SDLMain.m
|
2008-10-20 13:40:29 +00:00
|
|
|
# OS X users will have to compile and install SDL from source.
|
2008-09-26 17:23:12 +00:00
|
|
|
if( APPLE )
|
|
|
|
SET(SDLMAIN_LIBRARY "-lSDLmain")
|
|
|
|
endif( APPLE )
|
|
|
|
|
2008-06-06 10:17:20 +00:00
|
|
|
# Look for some dependencies using builtin CMake scripts
|
|
|
|
FIND_PACKAGE ( ZLIB REQUIRED )
|
|
|
|
FIND_PACKAGE ( PNG REQUIRED )
|
|
|
|
FIND_PACKAGE ( OpenGL REQUIRED )
|
2008-06-06 16:42:31 +00:00
|
|
|
FIND_PACKAGE ( SDL REQUIRED )
|
|
|
|
|
|
|
|
# Disable looking for GTK if not going to build the GTK frontend
|
|
|
|
# so that pkg-config is not required
|
|
|
|
IF(NOT NO_GTK)
|
|
|
|
FIND_PACKAGE ( PkgConfig REQUIRED )
|
|
|
|
|
|
|
|
# These dependencies require pkg-config to be found
|
|
|
|
PKG_CHECK_MODULES ( GTKMM gtkmm-2.4 )
|
|
|
|
PKG_CHECK_MODULES ( GLIBMM glibmm-2.4 )
|
2008-11-04 14:48:25 +00:00
|
|
|
PKG_CHECK_MODULES ( GIOMM giomm-2.4 )
|
2008-06-06 16:42:31 +00:00
|
|
|
PKG_CHECK_MODULES ( GLADEMM libglademm-2.4 )
|
|
|
|
PKG_CHECK_MODULES ( GTKGLMM gtkglextmm-x11-1.2 )
|
|
|
|
ENDIF(NOT NO_GTK)
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
# Check that the dependencies are met to build the SDL frontend
|
|
|
|
IF( NOT NO_SDL )
|
|
|
|
IF( SDL_FOUND )
|
|
|
|
SET( CAN_BUILD_VBAM 1 )
|
|
|
|
ENDIF( SDL_FOUND )
|
|
|
|
ENDIF( NOT NO_SDL )
|
2008-07-10 23:41:29 +00:00
|
|
|
IF( WITH_LIRC )
|
|
|
|
SET( WITHLIRC 1 )
|
2008-08-03 21:02:37 +00:00
|
|
|
ELSE( WITH_LIRC )
|
|
|
|
SET( WITHLIRC 0 )
|
2008-07-10 23:41:29 +00:00
|
|
|
ENDIF( WITH_LIRC )
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
# Check that the dependencies are met to build the GTK frontend
|
|
|
|
IF( NOT NO_GTK )
|
2009-03-19 10:41:38 +00:00
|
|
|
IF( GLIBMM_FOUND AND GTKMM_FOUND AND GLADEMM_FOUND AND SDL_FOUND )
|
2008-06-06 10:17:20 +00:00
|
|
|
SET( CAN_BUILD_GVBAM 1 )
|
2009-03-19 10:41:38 +00:00
|
|
|
ENDIF( GLIBMM_FOUND AND GTKMM_FOUND AND GLADEMM_FOUND AND SDL_FOUND )
|
2008-06-06 10:17:20 +00:00
|
|
|
ENDIF( NOT NO_GTK )
|
|
|
|
|
|
|
|
# Set the default install dir
|
|
|
|
IF( NOT DATA_INSTALL_DIR )
|
|
|
|
SET( DATA_INSTALL_DIR "share/vbam" )
|
|
|
|
ENDIF( NOT DATA_INSTALL_DIR )
|
|
|
|
|
|
|
|
SET( PKGDATADIR ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR} )
|
|
|
|
|
|
|
|
# Set the configuration file location
|
|
|
|
IF( NOT SYSCONFDIR )
|
|
|
|
SET( SYSCONFDIR "/etc" )
|
|
|
|
ENDIF( NOT SYSCONFDIR )
|
|
|
|
|
|
|
|
# C defines
|
2008-07-10 23:41:29 +00:00
|
|
|
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONFDIR='"${SYSCONFDIR}"' -DWITH_LIRC='${WITHLIRC}')
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
ADD_DEFINITIONS (-DVERSION='"${VERSION}"' -DPKGDATADIR='"${PKGDATADIR}"' -DPACKAGE='')
|
|
|
|
|
2008-06-16 20:18:49 +00:00
|
|
|
# The debugger is enabled by default
|
|
|
|
# The SDL port can't be built without debugging support
|
|
|
|
IF( NO_DEBUGGER )
|
|
|
|
IF( CAN_BUILD_VBAM )
|
|
|
|
MESSAGE(STATUS "The SDL port can't be built without debugging support")
|
|
|
|
SET( CAN_BUILD_VBAM 0 )
|
|
|
|
ENDIF( CAN_BUILD_VBAM )
|
2008-10-16 13:56:49 +00:00
|
|
|
|
2008-06-16 20:18:49 +00:00
|
|
|
ADD_DEFINITIONS (-DNO_DEBUGGER)
|
|
|
|
ELSE( NO_DEBUGGER )
|
|
|
|
ADD_DEFINITIONS (-DBKPT_SUPPORT)
|
|
|
|
ENDIF( NO_DEBUGGER )
|
|
|
|
|
2008-06-06 10:17:20 +00:00
|
|
|
# The ASM core is disabled by default because we don't know on which platform we are
|
|
|
|
IF( NOT USE_ASM_CORE )
|
|
|
|
ADD_DEFINITIONS (-DC_CORE)
|
|
|
|
ENDIF( NOT USE_ASM_CORE )
|
|
|
|
|
|
|
|
# Compiler flags
|
|
|
|
IF ( WIN32 )
|
2009-01-04 09:03:26 +00:00
|
|
|
SET( CMAKE_ASM_FLAGS "-Isrc/filters/hq/asm/ -O1 -w-orphan-labels")
|
2008-06-06 10:17:20 +00:00
|
|
|
ELSE ( WIN32 )
|
2009-01-04 09:03:26 +00:00
|
|
|
SET( CMAKE_ASM_FLAGS "-Isrc/filters/hq/asm/ -O1 -DELF -w-orphan-labels")
|
2008-06-06 10:17:20 +00:00
|
|
|
ENDIF ( WIN32 )
|
2008-09-03 07:39:13 +00:00
|
|
|
SET( CMAKE_C_FLAGS "-O3 -Wall")
|
|
|
|
SET( CMAKE_CXX_FLAGS "-O3 -Wall")
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
# Source files definition
|
|
|
|
SET(SRC_MAIN
|
|
|
|
src/Util.cpp
|
2009-01-01 14:21:18 +00:00
|
|
|
src/common/Patch.cpp
|
|
|
|
src/common/memgzio.c
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2009-01-01 15:20:03 +00:00
|
|
|
SET(SRC_GBA
|
|
|
|
src/gba/agbprint.cpp
|
2009-01-01 16:11:02 +00:00
|
|
|
src/gba/bios.cpp
|
|
|
|
src/gba/Cheats.cpp
|
|
|
|
src/gba/EEprom.cpp
|
|
|
|
src/gba/Flash.cpp
|
2009-01-01 15:20:03 +00:00
|
|
|
src/gba/GBA.cpp
|
|
|
|
src/gba/GBAGfx.cpp
|
|
|
|
src/gba/GBA-thumb.cpp
|
|
|
|
src/gba/GBA-arm.cpp
|
2009-01-01 16:11:02 +00:00
|
|
|
src/gba/Globals.cpp
|
|
|
|
src/gba/Mode0.cpp
|
|
|
|
src/gba/Mode1.cpp
|
|
|
|
src/gba/Mode2.cpp
|
|
|
|
src/gba/Mode3.cpp
|
|
|
|
src/gba/Mode4.cpp
|
|
|
|
src/gba/Mode5.cpp
|
|
|
|
src/gba/RTC.cpp
|
|
|
|
src/gba/Sound.cpp
|
|
|
|
src/gba/Sram.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2009-01-01 14:52:03 +00:00
|
|
|
SET(SRC_GB
|
|
|
|
src/gb/GB.cpp
|
|
|
|
src/gb/gbCheats.cpp
|
|
|
|
src/gb/gbDis.cpp
|
|
|
|
src/gb/gbGfx.cpp
|
|
|
|
src/gb/gbGlobals.cpp
|
|
|
|
src/gb/gbMemory.cpp
|
|
|
|
src/gb/gbPrinter.cpp
|
|
|
|
src/gb/gbSGB.cpp
|
|
|
|
src/gb/gbSound.cpp
|
2009-01-01 14:43:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(SRC_APU
|
|
|
|
src/apu/Blip_Buffer.cpp
|
|
|
|
src/apu/Effects_Buffer.cpp
|
|
|
|
src/apu/Gb_Apu.cpp
|
|
|
|
src/apu/Gb_Apu_State.cpp
|
|
|
|
src/apu/Gb_Oscs.cpp
|
|
|
|
src/apu/Multi_Buffer.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(SRC_SDL
|
|
|
|
src/sdl/debugger.cpp
|
|
|
|
src/sdl/SDL.cpp
|
|
|
|
src/sdl/dummy.cpp
|
|
|
|
src/sdl/filters.cpp
|
|
|
|
src/sdl/text.cpp
|
2008-08-30 17:50:51 +00:00
|
|
|
src/sdl/inputSDL.cpp
|
2008-12-26 12:19:33 +00:00
|
|
|
src/common/SoundSDL.cpp
|
2008-08-29 10:23:51 +00:00
|
|
|
src/sdl/expr.cpp
|
|
|
|
src/sdl/exprNode.cpp
|
|
|
|
src/sdl/expr-lex.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(SRC_FEX_MINI
|
2009-01-01 14:21:18 +00:00
|
|
|
src/common/fex_mini.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2009-01-01 13:02:35 +00:00
|
|
|
SET(SRC_FILTERS
|
|
|
|
src/filters/2xSaI.cpp
|
|
|
|
src/filters/admame.cpp
|
|
|
|
src/filters/bilinear.cpp
|
|
|
|
src/filters/hq2x.cpp
|
|
|
|
src/filters/interframe.cpp
|
|
|
|
src/filters/pixel.cpp
|
|
|
|
src/filters/scanline.cpp
|
|
|
|
)
|
|
|
|
|
2008-06-06 10:17:20 +00:00
|
|
|
SET(SRC_HQ_C
|
2009-01-01 13:02:35 +00:00
|
|
|
src/filters/hq/c/hq_implementation.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(SRC_HQ_ASM
|
2009-01-01 13:02:35 +00:00
|
|
|
src/filters/hq/asm/hq3x_16.asm
|
|
|
|
src/filters/hq/asm/hq3x_32.asm
|
|
|
|
src/filters/hq/asm/hq4x_16.asm
|
|
|
|
src/filters/hq/asm/hq4x_32.asm
|
|
|
|
src/filters/hq/asm/hq3x32.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
SET(SRC_GTK
|
|
|
|
src/gtk/configfile.cpp
|
|
|
|
src/gtk/main.cpp
|
|
|
|
src/gtk/system.cpp
|
|
|
|
src/gtk/windowcallbacks.cpp
|
|
|
|
src/gtk/filters.cpp
|
2009-01-06 21:20:18 +00:00
|
|
|
src/gtk/gameboyconfig.cpp
|
2009-01-24 10:09:10 +00:00
|
|
|
src/gtk/gameboyadvanceconfig.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
src/gtk/joypadconfig.cpp
|
2008-09-26 18:25:23 +00:00
|
|
|
src/gtk/directoriesconfig.cpp
|
2008-10-27 19:48:33 +00:00
|
|
|
src/gtk/displayconfig.cpp
|
2008-12-23 13:51:48 +00:00
|
|
|
src/gtk/soundconfig.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
src/gtk/screenarea.cpp
|
|
|
|
src/gtk/screenarea-cairo.cpp
|
|
|
|
src/gtk/screenarea-opengl.cpp
|
|
|
|
src/gtk/tools.cpp
|
|
|
|
src/gtk/window.cpp
|
2008-09-01 19:14:37 +00:00
|
|
|
src/sdl/inputSDL.cpp
|
2008-12-26 12:19:33 +00:00
|
|
|
src/common/SoundSDL.cpp
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2008-06-16 20:18:49 +00:00
|
|
|
IF( NOT NO_DEBUGGER )
|
|
|
|
SET(SRC_DEBUGGER
|
2009-01-01 16:11:02 +00:00
|
|
|
src/gba/armdis.cpp
|
|
|
|
src/gba/elf.cpp
|
|
|
|
src/gba/remote.cpp
|
2008-06-16 20:18:49 +00:00
|
|
|
)
|
|
|
|
ENDIF( NOT NO_DEBUGGER )
|
|
|
|
|
2008-06-06 18:56:41 +00:00
|
|
|
IF(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS)
|
2008-06-06 10:17:20 +00:00
|
|
|
SET(SRC_HQ ${SRC_HQ_ASM})
|
2008-06-06 18:56:41 +00:00
|
|
|
ELSE(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS)
|
2008-06-06 10:17:20 +00:00
|
|
|
SET(SRC_HQ ${SRC_HQ_C})
|
2008-06-06 18:56:41 +00:00
|
|
|
ENDIF(CMAKE_ASM_COMPILER_LOADED AND USE_ASM_SCALERS)
|
2008-06-06 10:17:20 +00:00
|
|
|
|
2008-08-03 21:02:37 +00:00
|
|
|
INCLUDE_DIRECTORIES(
|
2008-06-06 16:42:31 +00:00
|
|
|
${ZLIB_INCLUDE_DIR}
|
2008-10-20 16:30:07 +00:00
|
|
|
${PNG_INCLUDE_DIR}
|
2008-08-29 19:45:17 +00:00
|
|
|
${SDL_INCLUDE_DIR}
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2008-08-03 21:02:37 +00:00
|
|
|
IF( CAN_BUILD_GVBAM )
|
|
|
|
INCLUDE_DIRECTORIES(
|
2008-11-04 14:48:25 +00:00
|
|
|
${GLIBMM_INCLUDE_DIRS}
|
|
|
|
${GIOMM_INCLUDE_DIRS}
|
2008-08-03 21:02:37 +00:00
|
|
|
${GTKMM_INCLUDE_DIRS}
|
2008-08-27 11:47:52 +00:00
|
|
|
${GTKGLMM_INCLUDE_DIRS}
|
2008-08-03 21:02:37 +00:00
|
|
|
${GLADEMM_INCLUDE_DIRS}
|
|
|
|
)
|
2008-08-27 15:01:38 +00:00
|
|
|
|
|
|
|
LINK_DIRECTORIES(
|
2008-11-04 14:48:25 +00:00
|
|
|
${GLIBMM_LIBRARY_DIRS}
|
|
|
|
${GIOMM_LIBRARY_DIRS}
|
2008-08-27 15:01:38 +00:00
|
|
|
${GTKMM_LIBRARY_DIRS}
|
|
|
|
${GTKGLMM_LIBRARY_DIRS}
|
|
|
|
${GLADEMM_LIBRARY_DIRS}
|
|
|
|
)
|
2008-08-03 21:02:37 +00:00
|
|
|
ENDIF( CAN_BUILD_GVBAM )
|
|
|
|
|
2008-06-06 10:17:20 +00:00
|
|
|
ADD_LIBRARY (
|
|
|
|
vbamcore
|
|
|
|
${PROJECT_SRCS}
|
|
|
|
${SRC_MAIN}
|
2009-01-01 15:20:03 +00:00
|
|
|
${SRC_GBA}
|
2009-01-01 14:52:03 +00:00
|
|
|
${SRC_GB}
|
2009-01-01 14:43:18 +00:00
|
|
|
${SRC_APU}
|
2008-06-06 10:17:20 +00:00
|
|
|
${SRC_FEX_MINI}
|
2009-01-01 13:02:35 +00:00
|
|
|
${SRC_FILTERS}
|
2008-06-16 20:18:49 +00:00
|
|
|
${SRC_DEBUGGER}
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
IF( CAN_BUILD_VBAM )
|
|
|
|
ADD_EXECUTABLE (
|
|
|
|
vbam
|
|
|
|
WIN32
|
|
|
|
${SRC_SDL}
|
|
|
|
${SRC_HQ}
|
|
|
|
)
|
|
|
|
|
2008-06-06 16:42:31 +00:00
|
|
|
IF( WIN32 )
|
|
|
|
SET( WIN32_LIBRARIES wsock32 )
|
|
|
|
ENDIF( WIN32 )
|
|
|
|
|
2008-08-03 21:02:37 +00:00
|
|
|
IF( WITH_LIRC )
|
|
|
|
SET( LIRC_CLIENT_LIBRARY lirc_client )
|
|
|
|
ENDIF( WITH_LIRC )
|
|
|
|
|
2008-06-06 10:17:20 +00:00
|
|
|
TARGET_LINK_LIBRARIES (
|
|
|
|
vbam
|
|
|
|
vbamcore
|
2008-06-06 16:42:31 +00:00
|
|
|
${SDL_LIBRARY}
|
2008-06-06 10:17:20 +00:00
|
|
|
${ZLIB_LIBRARY}
|
|
|
|
${PNG_LIBRARY}
|
|
|
|
${OPENGL_LIBRARY}
|
2008-06-06 16:42:31 +00:00
|
|
|
${WIN32_LIBRARIES}
|
2008-08-03 21:02:37 +00:00
|
|
|
${LIRC_CLIENT_LIBRARY}
|
2008-06-06 10:17:20 +00:00
|
|
|
)
|
|
|
|
|
2008-09-13 16:49:34 +00:00
|
|
|
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vbam DESTINATION bin)
|
2008-09-02 06:16:34 +00:00
|
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/sdl/vbam.cfg-example
|
2008-06-06 10:17:20 +00:00
|
|
|
DESTINATION ${SYSCONFDIR}
|
2008-09-02 06:16:34 +00:00
|
|
|
RENAME vbam.cfg)
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
ENDIF( CAN_BUILD_VBAM )
|
|
|
|
|
|
|
|
IF( CAN_BUILD_GVBAM )
|
|
|
|
ADD_EXECUTABLE (
|
|
|
|
gvbam
|
|
|
|
WIN32
|
|
|
|
MACOSX_BUNDLE
|
|
|
|
${SRC_GTK}
|
|
|
|
)
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES (
|
|
|
|
gvbam
|
|
|
|
vbamcore
|
|
|
|
${ZLIB_LIBRARY}
|
|
|
|
${PNG_LIBRARY}
|
|
|
|
${GLADEMM_LIBRARIES}
|
2008-08-29 19:45:17 +00:00
|
|
|
${SDL_LIBRARY}
|
2008-06-06 10:17:20 +00:00
|
|
|
${GTKGLMM_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2008-09-13 16:49:34 +00:00
|
|
|
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gvbam DESTINATION bin)
|
2008-06-06 10:17:20 +00:00
|
|
|
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)
|
2008-10-28 09:45:35 +00:00
|
|
|
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/gtk/ui DESTINATION ${DATA_INSTALL_DIR} PATTERN ".svn" EXCLUDE)
|
2008-06-06 10:17:20 +00:00
|
|
|
|
|
|
|
ENDIF( CAN_BUILD_GVBAM )
|