Started on common and core packages.

This commit is contained in:
Gary Talent 2016-03-26 15:49:05 -05:00
parent 2434a43cec
commit 807d0397a1
39 changed files with 1849 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/gba
build/sdl
build/sdl_debug

27
CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 2.8.8)
project(wombat)
set(WOMBAT_BUILD_TYPE "Native" CACHE STRING "The type of build to produce(Native/GBA)")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
include(address_sanitizer)
include(GBA)
add_definitions(
-std=c++14
-Wall
-Wsign-compare
-nostdlib
-fno-exceptions
-fno-rtti
#-g
#-fcolor-diagnostics
-Werror
#--analyze
#-Os # GCC size optimization flag
)
enable_testing()
add_subdirectory(src)

29
Makefile Normal file
View File

@ -0,0 +1,29 @@
make:
make -j -C build
preinstall:
make -j -C build ARGS="preinstall"
install:
make -j -C build ARGS="install"
clean:
make -j -C build ARGS="clean"
test:
make -j -C build ARGS="test"
run: make
./build/current/src/wombat/wombat -debug
debug: make
gdb ./build/current/src/wombat/wombat
sdl:
./scripts/setup_build
rm -f build/current
ln -s sdl build/current
sdl_debug:
./scripts/setup_build_debug
rm -f build/current
ln -s sdl_debug build/current
gba:
./scripts/setup_build_gba
rm -f build/current
ln -s sdl_gba build/current

16
build/Makefile Normal file
View File

@ -0,0 +1,16 @@
all: gba_build sdl_build sdl_debug_build
gba_build:
@if [ -d gba ]; then \
make -C gba ${ARGS}; \
fi
sdl_build:
@if [ -d sdl ]; then \
make -C sdl ${ARGS}; \
fi
sdl_debug_build:
@if [ -d sdl_debug ]; then \
make -C sdl_debug ${ARGS}; \
fi

View File

@ -0,0 +1,115 @@
# - Try to find Allegro
# Configs for lookup
# ALLEGRO_PATH_SUFFIX - suffix for include path, allegro or alllegro5
#
# Once done this will define
#
# ALLEGRO_FOUND - system has Allegro
# ALLEGRO_INCLUDE_DIRS - the Allegro include directory
# ALLEGRO_LIBRARIES - Link these to use Allegro
# ALLEGRO_DEFINITIONS - Compiler switches required for using Allegro
#
# Copyright (c) 2008 Olof Naessen <olof.naessen@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)
# in cache already
set(ALLEGRO_FOUND TRUE)
else (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)
if (NOT DEFINED ALLEGRO_PATH_SUFFIX)
set(ALLEGRO_PATH_SUFFIX allegro)
endif()
find_path(ALLEGRO_INCLUDE_DIR
NAMES
allegro.h
allegro_image.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
/usr/include/allegro5
/usr/local/include/allegro5
/opt/local/include/allegro5
/sw/include/allegro5
PATH_SUFFIXES
"${ALLEGRO_PATH_SUFFIX}"
)
find_library(ALLEGRO_LIBRARY
NAMES
allegro
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
find_library(ALLEGRO_AUDIO_LIBRARY
NAMES
allegro_audio
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
find_library(ALLEGRO_FONT_LIBRARY
NAMES
allegro_font
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
find_library(ALLEGRO_TTF_LIBRARY
NAMES
allegro_ttf
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
find_library(ALLEGRO_IMAGE_LIBRARY
NAMES
allegro_image
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY} ${ALLEGRO_IMAGE_LIBRARY})
set(ALLEGRO_INCLUDE_DIRS ${ALLEGRO_INCLUDE_DIR})
if (ALLEGRO_INCLUDE_DIRS AND ALLEGRO_LIBRARIES)
set(ALLEGRO_FOUND TRUE)
endif (ALLEGRO_INCLUDE_DIRS AND ALLEGRO_LIBRARIES)
if (NOT ALLEGRO_FOUND)
if (Allegro_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Allegro")
endif (Allegro_FIND_REQUIRED)
endif (NOT ALLEGRO_FOUND)
# show the ALLEGRO_INCLUDE_DIRS and ALLEGRO_LIBRARIES variables only in the advanced view
mark_as_advanced(ALLEGRO_INCLUDE_DIRS ALLEGRO_LIBRARIES)
endif (ALLEGRO_LIBRARIES AND ALLEGRO_INCLUDE_DIRS)

View File

@ -0,0 +1,49 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# - Try to find Jansson
# Once done this will define
# JANSSON_FOUND - System has Jansson
# JANSSON_INCLUDE_DIRS - The Jansson include directories
# JANSSON_LIBRARIES - The libraries needed to use Jansson
# JANSSON_DEFINITIONS - Compiler switches required for using Jansson
find_path(JANSSON_INCLUDE_DIR jansson.h
PATHS
/usr/include
/usr/local/include
)
find_library(JANSSON_LIBRARY
NAMES
jansson
PATHS
/usr/lib
/usr/local/lib
)
set(JANSSON_LIBRARIES ${JANSSON_LIBRARY})
set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Jansson DEFAULT_MSG
JANSSON_LIBRARY JANSSON_INCLUDE_DIR)
mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY)

178
cmake/Modules/FindSDL.cmake Normal file
View File

@ -0,0 +1,178 @@
# - Locate SDL library
# This module defines
# SDL_LIBRARY, the name of the library to link against
# SDL_FOUND, if false, do not try to link to SDL
# SDL_INCLUDE_DIR, where to find SDL.h
# SDL_VERSION_STRING, human-readable string containing the version of SDL
#
# This module responds to the the flag:
# SDL_BUILDING_LIBRARY
# If this is defined, then no SDL_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL_LIBRARY variable.
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration
# and no SDL_LIBRARY, it means CMake did not find your SDL library
# (SDL.dll, libsdl.so, SDL.framework, etc).
# Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again.
# Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL_LIBRARY
# variable, but when these values are unset, SDL_LIBRARY does not get created.
#
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL guidelines.
# Added a search for SDLmain which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention
# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL/ (see FreeBSD).
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
PATH_SUFFIXES include/SDL2 include/SDL include
)
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
find_library(SDL_LIBRARY_TEMP
NAMES SDL2
HINTS
ENV SDLDIR
PATH_SUFFIXES lib
)
if(NOT SDL_BUILDING_LIBRARY)
if(NOT ${SDL_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
find_library(SDLMAIN_LIBRARY
NAMES SDL2main
HINTS
ENV SDLDIR
PATH_SUFFIXES lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
endif()
endif()
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads)
endif()
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
if(MINGW)
set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
endif()
if(SDL_LIBRARY_TEMP)
# For SDLmain
if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY)
list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX)
if(_SDL_MAIN_INDEX EQUAL -1)
set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP})
endif()
unset(_SDL_MAIN_INDEX)
endif()
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
if(APPLE)
set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa")
endif()
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
if(NOT APPLE)
set(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
# For MinGW library
if(MINGW)
set(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
endif()
# Set the final string here so the GUI reflects the final state.
set(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "")
endif()
if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}")
set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH})
unset(SDL_VERSION_MAJOR_LINE)
unset(SDL_VERSION_MINOR_LINE)
unset(SDL_VERSION_PATCH_LINE)
unset(SDL_VERSION_MAJOR)
unset(SDL_VERSION_MINOR)
unset(SDL_VERSION_PATCH)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
VERSION_VAR SDL_VERSION_STRING)

View File

@ -0,0 +1,88 @@
# - Locate SDL_image library
# This module defines:
# SDL_IMAGE_LIBRARIES, the name of the library to link against
# SDL_IMAGE_INCLUDE_DIRS, where to find the headers
# SDL_IMAGE_FOUND, if false, do not try to link against
# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image
#
# For backward compatiblity the following variables are also set:
# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES)
# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS)
# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR)
set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
PATH_SUFFIXES include/SDL2 include
)
if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_IMAGE_LIBRARY
NAMES SDL2_image
HINTS
ENV SDLIMAGEDIR
ENV SDLDIR
PATH_SUFFIXES lib
)
if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}")
set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH})
unset(SDL_IMAGE_VERSION_MAJOR_LINE)
unset(SDL_IMAGE_VERSION_MINOR_LINE)
unset(SDL_IMAGE_VERSION_PATCH_LINE)
unset(SDL_IMAGE_VERSION_MAJOR)
unset(SDL_IMAGE_VERSION_MINOR)
unset(SDL_IMAGE_VERSION_PATCH)
endif()
set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY})
set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image
REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS
VERSION_VAR SDL_IMAGE_VERSION_STRING)
# for backward compatiblity
set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES})
set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS})
set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND})
mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR)

View File

@ -0,0 +1,88 @@
# - Locate SDL_mixer library
# This module defines:
# SDL_MIXER_LIBRARIES, the name of the library to link against
# SDL_MIXER_INCLUDE_DIRS, where to find the headers
# SDL_MIXER_FOUND, if false, do not try to link against
# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer
#
# For backward compatiblity the following variables are also set:
# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES)
# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS)
# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR)
set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
)
if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_MIXER_LIBRARY
NAMES SDL_mixer
HINTS
ENV SDLMIXERDIR
ENV SDLDIR
PATH_SUFFIXES lib
)
if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MAJOR "${SDL_MIXER_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MINOR "${SDL_MIXER_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_PATCH "${SDL_MIXER_VERSION_PATCH_LINE}")
set(SDL_MIXER_VERSION_STRING ${SDL_MIXER_VERSION_MAJOR}.${SDL_MIXER_VERSION_MINOR}.${SDL_MIXER_VERSION_PATCH})
unset(SDL_MIXER_VERSION_MAJOR_LINE)
unset(SDL_MIXER_VERSION_MINOR_LINE)
unset(SDL_MIXER_VERSION_PATCH_LINE)
unset(SDL_MIXER_VERSION_MAJOR)
unset(SDL_MIXER_VERSION_MINOR)
unset(SDL_MIXER_VERSION_PATCH)
endif()
set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY})
set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer
REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS
VERSION_VAR SDL_MIXER_VERSION_STRING)
# for backward compatiblity
set(SDLMIXER_LIBRARY ${SDL_MIXER_LIBRARIES})
set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS})
set(SDLMIXER_FOUND ${SDL_MIXER_FOUND})
mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR)

View File

@ -0,0 +1,88 @@
# - Locate SDL_net library
# This module defines:
# SDL_NET_LIBRARIES, the name of the library to link against
# SDL_NET_INCLUDE_DIRS, where to find the headers
# SDL_NET_FOUND, if false, do not try to link against
# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net
#
# For backward compatiblity the following variables are also set:
# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES)
# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS)
# SDLNET_FOUND (same value as SDL_NET_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR)
set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS
ENV SDLNETDIR
ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
)
if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_NET_LIBRARY
NAMES SDL_net
HINTS
ENV SDLNETDIR
ENV SDLDIR
PATH_SUFFIXES lib
)
if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MAJOR "${SDL_NET_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MINOR "${SDL_NET_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_PATCH "${SDL_NET_VERSION_PATCH_LINE}")
set(SDL_NET_VERSION_STRING ${SDL_NET_VERSION_MAJOR}.${SDL_NET_VERSION_MINOR}.${SDL_NET_VERSION_PATCH})
unset(SDL_NET_VERSION_MAJOR_LINE)
unset(SDL_NET_VERSION_MINOR_LINE)
unset(SDL_NET_VERSION_PATCH_LINE)
unset(SDL_NET_VERSION_MAJOR)
unset(SDL_NET_VERSION_MINOR)
unset(SDL_NET_VERSION_PATCH)
endif()
set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY})
set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net
REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS
VERSION_VAR SDL_NET_VERSION_STRING)
# for backward compatiblity
set(SDLNET_LIBRARY ${SDL_NET_LIBRARIES})
set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS})
set(SDLNET_FOUND ${SDL_NET_FOUND})
mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR)

View File

@ -0,0 +1,384 @@
# - Locates the SDL_sound library
#
# This module depends on SDL being found and
# must be called AFTER FindSDL.cmake is called.
#
# This module defines
# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h
# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound
# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need
# to link against. This is a read-only variable and is marked INTERNAL.
# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own
# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES.
# This is available mostly for cases this module failed to anticipate for
# and you must add additional flags. This is marked as ADVANCED.
# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound
#
# This module also defines (but you shouldn't need to use directly)
# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link
# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one.
# And might define the following as needed
# MIKMOD_LIBRARY
# MODPLUG_LIBRARY
# OGG_LIBRARY
# VORBIS_LIBRARY
# SMPEG_LIBRARY
# FLAC_LIBRARY
# SPEEX_LIBRARY
#
# Typically, you should not use these variables directly, and you should use
# SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries
# (if needed) to successfully compile on your system.
#
# Created by Eric Wing.
# This module is a bit more complicated than the other FindSDL* family modules.
# The reason is that SDL_sound can be compiled in a large variety of different ways
# which are independent of platform. SDL_sound may dynamically link against other 3rd
# party libraries to get additional codec support, such as Ogg Vorbis, SMPEG, ModPlug,
# MikMod, FLAC, Speex, and potentially others.
# Under some circumstances which I don't fully understand,
# there seems to be a requirement
# that dependent libraries of libraries you use must also be explicitly
# linked against in order to successfully compile. SDL_sound does not currently
# have any system in place to know how it was compiled.
# So this CMake module does the hard work in trying to discover which 3rd party
# libraries are required for building (if any).
# This module uses a brute force approach to create a test program that uses SDL_sound,
# and then tries to build it. If the build fails, it parses the error output for
# known symbol names to figure out which libraries are needed.
#
# Responds to the $SDLDIR and $SDLSOUNDDIR environmental variable that would
# correspond to the ./configure --prefix=$SDLDIR used in building SDL.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL_LIBRARY to override this selectionor set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
mark_as_advanced(SDL_SOUND_EXTRAS)
# Find SDL_sound.h
find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
)
find_library(SDL_SOUND_LIBRARY
NAMES SDL_sound
HINTS
ENV SDLSOUNDDIR
ENV SDLDIR
PATH_SUFFIXES lib
)
if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)
# CMake is giving me problems using TRY_COMPILE with the CMAKE_FLAGS
# for the :STRING syntax if I have multiple values contained in a
# single variable. This is a problem for the SDL_LIBRARY variable
# because it does just that. When I feed this variable to the command,
# only the first value gets the appropriate modifier (e.g. -I) and
# the rest get dropped.
# To get multiple single variables to work, I must separate them with a "\;"
# I could go back and modify the FindSDL.cmake module, but that's kind of painful.
# The solution would be to try something like:
# set(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}")
# Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt
# with a temporary test project and invoke that with TRY_COMPILE.
# See message thread "Figuring out dependencies for a library in order to build"
# 2005-07-16
# try_compile(
# MY_RESULT
# ${CMAKE_BINARY_DIR}
# ${PROJECT_SOURCE_DIR}/DetermineSoundLibs.c
# CMAKE_FLAGS
# -DINCLUDE_DIRECTORIES:STRING=${SDL_INCLUDE_DIR}\;${SDL_SOUND_INCLUDE_DIR}
# -DLINK_LIBRARIES:STRING=${SDL_SOUND_LIBRARY}\;${SDL_LIBRARY}
# OUTPUT_VARIABLE MY_OUTPUT
# )
# To minimize external dependencies, create a sdlsound test program
# which will be used to figure out if additional link dependencies are
# required for the link phase.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/DetermineSoundLibs.c
"#include \"SDL_sound.h\"
#include \"SDL.h\"
int main(int argc, char* argv[])
{
Sound_AudioInfo desired;
Sound_Sample* sample;
SDL_Init(0);
Sound_Init();
/* This doesn't actually have to work, but Init() is a no-op
* for some of the decoders, so this should force more symbols
* to be pulled in.
*/
sample = Sound_NewSampleFromFile(argv[1], &desired, 4096);
Sound_Quit();
SDL_Quit();
return 0;
}"
)
# Calling
# target_link_libraries(DetermineSoundLibs "${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
# causes problems when SDL_LIBRARY looks like
# /Library/Frameworks/SDL.framework;-framework Cocoa
# The ;-framework Cocoa seems to be confusing CMake once the OS X
# framework support was added. I was told that breaking up the list
# would fix the problem.
set(TMP_TRY_LIBS)
foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY})
set(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"")
endforeach()
# message("TMP_TRY_LIBS ${TMP_TRY_LIBS}")
# Write the CMakeLists.txt and test project
# Weird, this is still sketchy. If I don't quote the variables
# in the TARGET_LINK_LIBRARIES, I seem to loose everything
# in the SDL_LIBRARY string after the "-framework".
# But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work.
file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt
"cmake_minimum_required(VERSION 2.8)
project(DetermineSoundLibs)
include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
add_executable(DetermineSoundLibs DetermineSoundLibs.c)
target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})"
)
try_compile(
MY_RESULT
${PROJECT_BINARY_DIR}/CMakeTmp
${PROJECT_BINARY_DIR}/CMakeTmp
DetermineSoundLibs
OUTPUT_VARIABLE MY_OUTPUT
)
# message("${MY_RESULT}")
# message(${MY_OUTPUT})
if(NOT MY_RESULT)
# I expect that MPGLIB, VOC, WAV, AIFF, and SHN are compiled in statically.
# I think Timidity is also compiled in statically.
# I've never had to explcitly link against Quicktime, so I'll skip that for now.
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARY})
# Find MikMod
if("${MY_OUTPUT}" MATCHES "MikMod_")
find_library(MIKMOD_LIBRARY
NAMES libmikmod-coreaudio mikmod
PATHS
ENV MIKMODDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(MIKMOD_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MIKMOD_LIBRARY})
endif(MIKMOD_LIBRARY)
endif("${MY_OUTPUT}" MATCHES "MikMod_")
# Find ModPlug
if("${MY_OUTPUT}" MATCHES "MODPLUG_")
find_library(MODPLUG_LIBRARY
NAMES modplug
PATHS
ENV MODPLUGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(MODPLUG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${MODPLUG_LIBRARY})
endif()
endif()
# Find Ogg and Vorbis
if("${MY_OUTPUT}" MATCHES "ov_")
find_library(VORBIS_LIBRARY
NAMES vorbis Vorbis VORBIS
PATHS
ENV VORBISDIR
ENV OGGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(VORBIS_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${VORBIS_LIBRARY})
endif()
find_library(OGG_LIBRARY
NAMES ogg Ogg OGG
PATHS
ENV OGGDIR
ENV VORBISDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(OGG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
endif()
endif()
# Find SMPEG
if("${MY_OUTPUT}" MATCHES "SMPEG_")
find_library(SMPEG_LIBRARY
NAMES smpeg SMPEG Smpeg SMpeg
PATHS
ENV SMPEGDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(SMPEG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SMPEG_LIBRARY})
endif()
endif()
# Find FLAC
if("${MY_OUTPUT}" MATCHES "FLAC_")
find_library(FLAC_LIBRARY
NAMES flac FLAC
PATHS
ENV FLACDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(FLAC_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${FLAC_LIBRARY})
endif()
endif()
# Hmmm...Speex seems to depend on Ogg. This might be a problem if
# the TRY_COMPILE attempt gets blocked at SPEEX before it can pull
# in the Ogg symbols. I'm not sure if I should duplicate the ogg stuff
# above for here or if two ogg entries will screw up things.
if("${MY_OUTPUT}" MATCHES "speex_")
find_library(SPEEX_LIBRARY
NAMES speex SPEEX
PATHS
ENV SPEEXDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES
lib
)
if(SPEEX_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${SPEEX_LIBRARY})
endif()
# Find OGG (needed for Speex)
# We might have already found Ogg for Vorbis, so skip it if so.
if(NOT OGG_LIBRARY)
find_library(OGG_LIBRARY
NAMES ogg Ogg OGG
PATHS
ENV OGGDIR
ENV VORBISDIR
ENV SPEEXDIR
ENV SDLSOUNDDIR
ENV SDLDIR
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib
)
if(OGG_LIBRARY)
set(SDL_SOUND_LIBRARIES_TMP ${SDL_SOUND_LIBRARIES_TMP} ${OGG_LIBRARY})
endif()
endif()
endif()
else()
set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARY}" CACHE INTERNAL "SDL_sound and dependent libraries")
endif()
set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries")
endif()
if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$")
file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}")
set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH})
unset(SDL_SOUND_VERSION_MAJOR_LINE)
unset(SDL_SOUND_VERSION_MINOR_LINE)
unset(SDL_SOUND_VERSION_PATCH_LINE)
unset(SDL_SOUND_VERSION_MAJOR)
unset(SDL_SOUND_VERSION_MINOR)
unset(SDL_SOUND_VERSION_PATCH)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR
VERSION_VAR SDL_SOUND_VERSION_STRING)

View File

@ -0,0 +1,88 @@
# - Locate SDL_ttf library
# This module defines:
# SDL_TTF_LIBRARIES, the name of the library to link against
# SDL_TTF_INCLUDE_DIRS, where to find the headers
# SDL_TTF_FOUND, if false, do not try to link against
# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf
#
# For backward compatiblity the following variables are also set:
# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES)
# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS)
# SDLTTF_FOUND (same value as SDL_TTF_FOUND)
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module, but with modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR)
set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
endif()
find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATH_SUFFIXES include/SDL2 include
)
if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry
initialized from old variable name")
endif()
find_library(SDL_TTF_LIBRARY
NAMES SDL2_ttf
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATH_SUFFIXES lib
)
if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}")
set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH})
unset(SDL_TTF_VERSION_MAJOR_LINE)
unset(SDL_TTF_VERSION_MINOR_LINE)
unset(SDL_TTF_VERSION_PATCH_LINE)
unset(SDL_TTF_VERSION_MAJOR)
unset(SDL_TTF_VERSION_MINOR)
unset(SDL_TTF_VERSION_PATCH)
endif()
set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY})
set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf
REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS
VERSION_VAR SDL_TTF_VERSION_STRING)
# for backward compatiblity
set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES})
set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS})
set(SDLTTF_FOUND ${SDL_TTF_FOUND})
mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR)

55
cmake/Modules/GBA.cmake Normal file
View File

@ -0,0 +1,55 @@
set(CMAKE_SYSTEM_NAME "Generic")
set(DEVKITARM $ENV{DEVKITARM})
set(DEVKITPRO $ENV{DEVKITPRO})
if(NOT DEVKITPRO)
message(FATAL_ERROR "DEVKITPRO environment variable not set")
endif()
if(NOT DEVKITARM)
message(FATAL_ERROR "DEVKITARM environment variable not set")
endif()
set(CMAKE_C_COMPILER ${DEVKITARM}/bin/arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER ${DEVKITARM}/bin/arm-none-eabi-g++)
set(CMAKE_OBJCOPY ${DEVKITARM}/bin/arm-none-eabi-objcopy)
set(CMAKE_FIND_ROOT_PATH ${DEVKITARM})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_LIBRARY_PREFIXES lib)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
set(LINKER_FLAGS "-specs=gba.specs")
add_definitions (
-DARM7
)
function(BuildStaticLib LIBNAME SRCFILES)
add_library(${LIBNAME} OBJECT ${SRCFILES})
set(OBJS ${OBJS} $<TARGET_OBJECTS:${LIBNAME}>)
endfunction()
include(FindPackageHandleStandardArgs)
macro(OBJCOPY_FILE EXE_NAME)
set(FO ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.bin)
set(FI ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME})
message(STATUS ${FO})
add_custom_command(
OUTPUT "${FO}"
COMMAND ${CMAKE_OBJCOPY}
ARGS -O binary ${FI} ${FO}
DEPENDS ${FI}
)
get_filename_component(TGT "${EXE_NAME}" NAME)
add_custom_target("TargetObjCopy_${TGT}" ALL DEPENDS ${FO} VERBATIM)
get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
set_directory_properties(
PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${FO}"
)
set_source_files_properties("${FO}" PROPERTIES GENERATED TRUE)
endmacro(OBJCOPY_FILE)

View File

@ -0,0 +1,4 @@
function(BuildStaticLib libName srcFiles)
endfunction()

View File

@ -0,0 +1,52 @@
# This file belongs Nick Overdijk, and is from https://github.com/NickNick/wubwubcmake
# The MIT License (MIT)
#
# Copyright (c) 2013 Nick Overdijk
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.option(USE_ASAN "Enable Address Sanitizer, if your compiler supports it" ON)
option(USE_ASAN "Enable Address Sanitizer, if your compiler supports it" OFF)
if(USE_ASAN)
include(CheckCXXSourceCompiles)
# If the compiler understands -fsanitize=address, add it to the flags (gcc since 4.8 & clang since version 3.2)
set(CMAKE_REQUIRED_FLAGS_BAK "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fsanitize=address")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" FLAG_FSANA_SUPPORTED)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_BAK}")
if(FLAG_FSANA_SUPPORTED)
set(asan_flag "-fsanitize=address")
else(FLAG_FSANA_SUPPORTED)
# Alternatively, try if it understands -faddress-sanitizer (clang until version 3.2)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -faddress-sanitizer")
CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" FLAG_FASAN_SUPPORTED)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_BAK}")
if(FLAG_FASAN_SUPPORTED)
set(asan_flag "-faddress-sanitizer")
endif(FLAG_FASAN_SUPPORTED)
endif(FLAG_FSANA_SUPPORTED)
if(FLAG_FSANA_SUPPORTED OR FLAG_FASAN_SUPPORTED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${asan_flag}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${asan_flag}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${asan_flag}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${asan_flag}")
endif()
endif(USE_ASAN)

19
main.cpp Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
int main() {
*(unsigned int*)0x04000000 = 0x0403;
((unsigned short*)0x06000000)[120+80*240] = 0x001F;
((unsigned short*)0x06000000)[136+80*240] = 0x03E0;
((unsigned short*)0x06000000)[120+96*240] = 0x7C00;
while(1);
return 0;
}

1
scripts/check Executable file
View File

@ -0,0 +1 @@
clang-check `find . | grep "\.cpp" | grep -v CMakeFiles | grep -v editormodels\.cpp`

8
scripts/cibuild Executable file
View File

@ -0,0 +1,8 @@
BRANCH=$1
./scripts/setup_build
make -j4 -C build/sdl clean wombat
rm -rf wombat wombat-*-*.tar.gz
mkdir wombat
git rev-parse HEAD > wombat/revision.txt
cp -pr wombat_path build/sdl/src/wombat/wombat wombat
tar -cvzf wombat-${BRANCH}-`date "+%y%m%d%H%M"`.tar.gz wombat

16
scripts/newcpp Executable file
View File

@ -0,0 +1,16 @@
#! /usr/bin/env python
import sys
if len(sys.argv) < 3:
sys.exit(1)
pkg = sys.argv[1]
name = sys.argv[2]
ifdef = "WOMBAT_%s_%s_HPP" % (pkg.upper(), name.upper())
namespace = "namespace wombat {\nnamespace %s {\n\n}\n}" % pkg
hpp = "#ifndef %s\n#define %s\n\n%s\n\n#endif" % (ifdef, ifdef, namespace)
cpp = "#include \"%s.hpp\"\n\n%s" % (name, namespace)
open("src/%s/%s.hpp" % (pkg, name), "w").write(hpp)
open("src/%s/%s.cpp" % (pkg, name), "w").write(cpp)

8
scripts/setup_build Executable file
View File

@ -0,0 +1,8 @@
#! /usr/bin/env bash
project=`pwd`/
buildDir="build/sdl"
mkdir -p $buildDir
pushd $buildDir
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release $project
popd

8
scripts/setup_build_debug Executable file
View File

@ -0,0 +1,8 @@
#! /usr/bin/env bash
project=`pwd`
buildDir="build/sdl_debug"
mkdir -p $buildDir
pushd $buildDir
cmake -DUSE_ASAN=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug $project
popd

8
scripts/setup_build_gba Executable file
View File

@ -0,0 +1,8 @@
#! /usr/bin/env bash
project=`pwd`
buildDir="build/gba"
mkdir -p $buildDir
pushd $buildDir
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DWOMBAT_BUILD_TYPE=GBA $project
popd

35
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 2.8.8)
#setup libraries
if(WOMBAT_BUILD_TYPE STREQUAL "Native")
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
set(LIBS ${LIBS} ${SDL_LIBRARY})
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(LIBS ${LIBS} ${OPENGL_LIBRARY})
find_package(SDL_IMAGE REQUIRED)
include_directories(${SDL_IMAGE_INCLUDE_DIR})
set(LIBS ${LIBS} ${SDL_IMAGE_LIBRARY})
find_package(SDL_ttf REQUIRED)
include_directories(${SDL_TTF_INCLUDE_DIR})
set(LIBS ${LIBS} ${SDL_TTF_LIBRARY})
elseif(WOMBAT_BUILD_TYPE STREQUAL "GBA")
endif()
#project packages
include_directories(".")
add_subdirectory(core)
set(OBJS ${OBJS} $<TARGET_OBJECTS:NostalgiaCommon>)
add_subdirectory(common)
set(OBJS ${OBJS} $<TARGET_OBJECTS:NostalgiaCommon>)
add_subdirectory(player)

2
src/Makefile Normal file
View File

@ -0,0 +1,2 @@
make:
make -j -C ../ ${ARGS}

19
src/common/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8.8)
add_library(
NostalgiaCommon OBJECT
bounds.cpp
memops.cpp
point.cpp
)
#install(TARGETS NostalgiaCommon DESTINATION lib)
install(
FILES
bounds.hpp
common.hpp
memops.hpp
point.hpp
DESTINATION
include/wombat/common
)

41
src/common/bounds.cpp Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "bounds.hpp"
namespace wombat {
namespace common {
Bounds::Bounds() {
}
bool Bounds::intersects(Bounds o) const {
return o.x2() >= X && x2() >= o.X && o.y2() >= Y && y2() >= o.Y;
}
bool Bounds::contains(int x, int y) const {
return x >= X && y >= Y && x <= x2() && y <= y2();
}
int Bounds::x2() const {
return X + Width;
}
int Bounds::y2() const {
return Y + Height;
}
Point Bounds::pt1() {
return Point(X, Y);
}
Point Bounds::pt2() {
return Point(x2(), y2());
}
}
}

44
src/common/bounds.hpp Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef WOMBAT_COMMON_BOUNDS_HPP
#define WOMBAT_COMMON_BOUNDS_HPP
#include "point.hpp"
namespace wombat {
namespace common {
class Bounds {
public:
int X = 0;
int Y = 0;
int Width = 0;
int Height = 0;
/**
* Constructor
*/
Bounds();
bool intersects(Bounds other) const;
bool contains(int x, int y) const;
int x2() const;
int y2() const;
Point pt1();
Point pt2();
};
}
}
#endif

15
src/common/common.hpp Normal file
View File

@ -0,0 +1,15 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef WOMBAT_COMMON_COMMON_HPP
#define WOMBAT_COMMON_COMMON_HPP
#include "bounds.hpp"
#include "flyweight.hpp"
#include "point.hpp"
#endif

29
src/common/memops.cpp Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "memops.hpp"
namespace nostalgia {
namespace common {
void memcpy(void *src, void *dest, int size) {
char *srcBuf = (char*) src;
char *dstBuf = (char*) dest;
for (int i = 0; i < size; i++) {
dstBuf[i] = (char) srcBuf[i];
}
}
void memset(void *ptr, char val, int size) {
char *buf = (char*) ptr;
for (int i = 0; i < size; i++) {
buf[i] = val;
}
}
}
}

21
src/common/memops.hpp Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef MEMPHIS_MEMOPS_HPP
#define MEMPHIS_MEMOPS_HPP
namespace nostalgia {
namespace common {
void memcpy(void *src, void *dest, int size);
void memset(void *ptr, char val, int size);
}
}
#endif

125
src/common/point.cpp Normal file
View File

@ -0,0 +1,125 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "point.hpp"
namespace wombat {
namespace common {
Point::Point() {
}
Point::Point(int x, int y) {
X = x;
Y = y;
}
Point Point::operator+(common::Point p) const {
p.X += X;
p.Y += Y;
return p;
}
Point Point::operator-(common::Point p) const {
auto out = *this;
out.X -= p.X;
out.Y -= p.Y;
return out;
}
Point Point::operator*(common::Point p) const {
p.X *= X;
p.Y *= Y;
return p;
}
Point Point::operator/(common::Point p) const {
auto out = *this;
out.X /= p.X;
out.Y /= p.Y;
return out;
}
Point Point::operator+=(common::Point p) {
X += p.X;
Y += p.Y;
return *this;
}
Point Point::operator-=(common::Point p) {
X -= p.X;
Y -= p.Y;
return *this;
}
Point Point::operator*=(common::Point p) {
X *= p.X;
Y *= p.Y;
return *this;
}
Point Point::operator/=(common::Point p) {
X /= p.X;
Y /= p.Y;
return *this;
}
Point Point::operator+(int i) const {
auto out = *this;
out.X += i;
out.Y += i;
return out;
}
Point Point::operator-(int i) const {
auto out = *this;
out.X -= i;
out.Y -= i;
return out;
}
Point Point::operator*(int i) const {
auto out = *this;
out.X *= i;
out.Y *= i;
return out;
}
Point Point::operator/(int i) const {
auto out = *this;
out.X /= i;
out.Y /= i;
return out;
}
Point Point::operator+=(int i) {
X += i;
Y += i;
return *this;
}
Point Point::operator-=(int i) {
X -= i;
Y -= i;
return *this;
}
Point Point::operator*=(int i) {
X *= i;
Y *= i;
return *this;
}
Point Point::operator/=(int i) {
X /= i;
Y /= i;
return *this;
}
}
}

62
src/common/point.hpp Normal file
View File

@ -0,0 +1,62 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef WOMBAT_COMMON_POINT_HPP
#define WOMBAT_COMMON_POINT_HPP
namespace wombat {
namespace common {
class Point {
public:
int X = 0;
int Y = 0;
Point();
Point(int x, int y);
Point operator+(common::Point p) const;
Point operator-(common::Point p) const;
Point operator*(common::Point p) const;
Point operator/(common::Point p) const;
Point operator+=(common::Point p);
Point operator-=(common::Point p);
Point operator*=(common::Point p);
Point operator/=(common::Point p);
Point operator+(int i) const;
Point operator-(int i) const;
Point operator*(int i) const;
Point operator/(int i) const;
Point operator+=(int i);
Point operator-=(int i);
Point operator*=(int i);
Point operator/=(int i);
};
}
}
#endif

19
src/core/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8.8)
if(WOMBAT_BUILD_TYPE STREQUAL "GBA")
set(
CPP
gba/core.cpp
gba/gfx.cpp
)
include_directories("gba")
elseif(WOMBAT_BUILD_TYPE STREQUAL "Native")
endif()
add_library(NostalgiaCore OBJECT ${CPP})
install(
FILES
DESTINATION
include/nostalgia/core
)

19
src/core/gba/core.cpp Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "../types.hpp"
#include "registers.hpp"
namespace nostalgia {
namespace core {
int init() {
return 0;
}
}
}

8
src/core/gba/gfx.cpp Normal file
View File

@ -0,0 +1,8 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "registers.hpp"

View File

@ -0,0 +1,13 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef NOSTALGIA_CORE_GBA_REGISTERS_HPP
#define NOSTALGIA_CORE_GBA_REGISTERS_HPP
#define REG_DISPCNT *((volatile unsigned int*) 0x04000000)
#endif

35
src/core/types.hpp Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef NOSTALGIA_CORE_TYPES_HPP
#define NOSTALGIA_CORE_TYPES_HPP
#include <cstdint>
namespace nostalgia {
namespace core {
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef unsigned uint_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#ifdef _LP64
typedef uint64_t size_t;
#elif _LP32
typedef uint32_t size_t;
#endif
}
}
#endif

19
src/player/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8.8)
project(nostalgia)
set(WOMBAT_BUILD_TYPE "Native" CACHE STRING "The type of build to produce(Native/GBA)")
add_executable(
nostalgia
main.cpp
${OBJS}
)
#target_link_libraries(wombat ${LIBS})
set_target_properties(nostalgia
PROPERTIES
LINK_FLAGS ${LINKER_FLAGS}
COMPILER_FLAGS "-mthumb -mthumb-interwork"
)
objcopy_file(nostalgia)

11
src/player/main.cpp Normal file
View File

@ -0,0 +1,11 @@
/*
* Copyright 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
int main() {
return 0;
}