Introduce cmake (min 2.8.12) to StepMania.

tl-dr: view the Build directory to see.

This is intended to replace the project files that we presently maintain
so that only a single set is needed instead of multiples.

The following setups were used for testing:

* Windows 8 and Visual Studio 2013 Desktop Express
* Windows 7 and Visual Studio 2012
* Mac OS X Mavericks and Xcode
* Ubuntu and makefiles
* Fedora 21 and makefiles

All three operating systems can generate projects, compile, link, and
run. Windows and Mac OS X users will find their compiled binary in the
same location as before, but Linux users will be surprised: it goes
straight into the root directory, along with a symlinked GtkModules.so
as appropriate. There is no more need for a manual symlinking step.

Known issues:

* At this time, MinGW likely does not work. Extra time will be needed.
* The WITH_JPEG option may go away, and we'll just always require it.
* Some linux libraries can use the system equivalents, but that is not up yet.

For more information, check out the Build directory.
This commit is contained in:
Jason Felds
2015-03-21 20:15:15 -04:00
parent d85ac9af85
commit dc94728628
64 changed files with 3870 additions and 25 deletions
+41
View File
@@ -0,0 +1,41 @@
function(sm_append_simple_target_property target property str)
get_target_property(current_property ${target} ${property})
if (current_property)
list(APPEND current_property ${str})
set_target_properties(${target} PROPERTIES ${property} "${current_property}")
else()
set_target_properties(${target} PROPERTIES ${property} ${str})
endif()
endfunction()
function(sm_add_compile_definition target def)
sm_append_simple_target_property(${target} COMPILE_DEFINITIONS ${def})
endfunction()
function(sm_add_compile_flag target flag)
sm_append_simple_target_property(${target} COMPILE_FLAGS ${flag})
endfunction()
function(sm_add_link_flag target flag)
if (MSVC)
# Use a modified form of sm_append_simple_target_property.
get_target_property(current_property ${target} LINK_FLAGS)
if (current_property)
set_target_properties(${target} PROPERTIES LINK_FLAGS "${current_property} ${flag}")
else()
set_target_properties(${target} PROPERTIES LINK_FLAGS ${flag})
endif()
else()
sm_append_simple_target_property(${target} LINK_FLAGS ${flag})
endif()
endfunction()
function(disable_project_warnings projectName)
if (MSVC)
sm_add_compile_flag(${projectName} "/W0")
elseif(APPLE)
set_target_properties(${projectName} PROPERTIES XCODE_ATTRIBUTE_GCC_WARN_INHIBIT_ALL_WARNINGS "YES")
else()
set_target_properties(${projectName} PROPERTIES COMPILE_FLAGS "-w")
endif()
endfunction()
+42
View File
@@ -0,0 +1,42 @@
# From the CMake wiki, get the DirectX version needed.
# This assumes default directories.
# Once loaded, the following are defined:
# DIRECTX_FOUND
# DIRECTX_INCLUDE_DIR
# DIRECTX_LIBRARIES
if(NOT WIN32)
return()
endif()
set(DIRECTX_INCLUDE_SEARCH_PATHS
# TODO: Do not be limited to x86 in the future.
"C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include"
"C:/DXSDK/Include"
)
set(DIRECTX_LIBRARY_SEARCH_PATHS
# TODO: Do not be limited to x86 in the future.
"C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86"
"C:/DXSDK/Include/Lib/x86"
)
find_path(DIRECTX_INCLUDE_DIR
NAMES "DxErr.h"
PATHS ${DIRECTX_INCLUDE_SEARCH_PATHS}
DOC "Where can DxErr.h be found?"
)
find_library(DIRECTX_LIBRARIES
NAMES "DxErr.lib" "d3dx9.lib"
PATHS ${DIRECTX_LIBRARY_SEARCH_PATHS}
DOC "Where can the DX libraries be found?"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DIRECTX DEFAULT_MSG DIRECTX_INCLUDE_DIR DIRECTX_LIBRARIES)
if(DIRECTX_FOUND)
mark_as_advanced(DIRECTX_INCLUDE_DIR DIRECTX_LIBRARIES)
endif()
+61
View File
@@ -0,0 +1,61 @@
# This was borrowed from the gnuradio repository.
# - Try to find jack-2.6
# Once done this will define
#
# JACK_FOUND - system has jack
# JACK_INCLUDE_DIRS - the jack include directory
# JACK_LIBRARIES - Link these to use jack
# JACK_DEFINITIONS - Compiler switches required for using jack
#
# Copyright (c) 2008 Andreas Schneider <[email protected]>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
# in cache already
set(JACK_FOUND TRUE)
else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(jack _JACK_INCLUDEDIR _JACK_LIBDIR _JACK_LDFLAGS _JACK_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_JACK jack)
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_path(JACK_INCLUDE_DIR
NAMES
jack/jack.h
PATHS
${_JACK_INCLUDEDIR}
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(JACK_LIBRARY
NAMES
jack
PATHS
${_JACK_LIBDIR}
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JACK DEFAULT_MSG
JACK_INCLUDE_DIRS JACK_LIBRARIES)
# show the JACK_INCLUDE_DIRS and JACK_LIBRARIES variables only in the advanced view
mark_as_advanced(JACK_INCLUDE_DIRS JACK_LIBRARIES)
endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+9
View File
@@ -0,0 +1,9 @@
find_path(LIBMAD_INCLUDE_DIR mad.h)
find_library(LIBMAD_LIBRARY mad)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBMAD DEFAULT_MSG LIBMAD_LIBRARY LIBMAD_INCLUDE_DIR)
mark_as_advanced(LIBMAD_LIBRARY LIBMAD_INCLUDE_DIR)
+24
View File
@@ -0,0 +1,24 @@
# Copied from marsyas, which is also copied from fqterm.
# Further modifications are done.
IF(UNIX)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(OSS_HDR_NAME "linux/soundcard.h")
ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
SET(OSS_HDR_NAME "sys/soundcard.h")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
ENDIF(UNIX)
FIND_PATH(OSS_INCLUDE_DIR "${OSS_HDR_NAME}"
"/usr/include" "/usr/local/include"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSS DEFAULT_MSG OSS_INCLUDE_DIR)
MARK_AS_ADVANCED (
OSS_FOUND
OSS_INCLUDE_DIR
)
+17
View File
@@ -0,0 +1,17 @@
# Borrowed from code.openhub.net
# Base Io build system
# Written by Jeremy Tregunna <[email protected]>
#
# Find libogg.
FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h)
SET(OGG_NAMES ${OGG_NAMES} ogg libogg)
FIND_LIBRARY(OGG_LIBRARY NAMES ${OGG_NAMES} PATH)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGG DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR)
mark_as_advanced(OGG_LIBRARY OGG_INCLUDE_DIR)
+47
View File
@@ -0,0 +1,47 @@
# This comes from the PulseAudio QT project.
# Try to find the PulseAudio library
#
# Once done this will define:
#
# PULSEAUDIO_FOUND - system has the PulseAudio library
# PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory
# PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio
#
# Copyright (c) 2008, Matthias Kretz, <[email protected]>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# There was no COPYING-CMAKE-SCRIPTS file in the repo in question. --wolfman
if (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY)
# Already in cache, be silent
set(PULSEAUDIO_FIND_QUIETLY TRUE)
endif (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY)
if (NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PULSEAUDIO libpulse)
if(PULSEAUDIO_FOUND)
set(PULSEAUDIO_LIBRARY ${PULSEAUDIO_LIBRARIES} CACHE FILEPATH "Path to the PulseAudio library")
set(PULSEAUDIO_INCLUDE_DIR ${PULSEAUDIO_INCLUDEDIR} CACHE PATH "Path to the PulseAudio includes")
# PULSEAUDIO_DEFINITIONS - Compiler switches required for using PulseAudio
# set(PULSEAUDIO_DEFINITIONS ${PULSEAUDIO_CFLAGS})
endif(PULSEAUDIO_FOUND)
endif (NOT WIN32)
if (NOT PULSEAUDIO_INCLUDE_DIR)
FIND_PATH(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h)
endif (NOT PULSEAUDIO_INCLUDE_DIR)
if (NOT PULSEAUDIO_LIBRARY)
FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse)
endif (NOT PULSEAUDIO_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PULSEAUDIO DEFAULT_MSG
PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)
mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)
+17
View File
@@ -0,0 +1,17 @@
# Borrowed from code.openhub.net
# Base Io build system
# Written by Jeremy Tregunna <[email protected]>
#
# Find libvorbis.
FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h)
SET(VORBIS_NAMES ${VORBIS_NAMES} vorbis libvorbis)
FIND_LIBRARY(VORBIS_LIBRARY NAMES ${VORBIS_NAMES} PATH)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBIS DEFAULT_MSG VORBIS_LIBRARY VORBIS_INCLUDE_DIR)
mark_as_advanced(VORBIS_LIBRARY VORBIS_INCLUDE_DIR)
+14
View File
@@ -0,0 +1,14 @@
# Inspired by Jeremy Tregunna's cmake work <[email protected]>
#
# Find libvorbisfile.
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h)
SET(VORBISFILE_NAMES ${VORBISFILE_NAMES} vorbisfile libvorbisfile)
FIND_LIBRARY(VORBISFILE_LIBRARY NAMES ${VORBISFILE_NAMES} PATH)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBISFILE DEFAULT_MSG VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR)
mark_as_advanced(VORBISFILE_LIBRARY VORBISFILE_INCLUDE_DIR)
+44
View File
@@ -0,0 +1,44 @@
# This is borrowed from FreeRDP.
# - Find XRANDR
# Find the XRANDR libraries
#
# This module defines the following variables:
# XRANDR_FOUND - true if XRANDR_INCLUDE_DIR & XRANDR_LIBRARY are found
# XRANDR_LIBRARIES - Set when XRANDR_LIBRARY is found
# XRANDR_INCLUDE_DIRS - Set when XRANDR_INCLUDE_DIR is found
#
# XRANDR_INCLUDE_DIR - where to find Xrandr.h, etc.
# XRANDR_LIBRARY - the XRANDR library
#
#=============================================================================
# Copyright 2012 Alam Arias <[email protected]>
#
# Licensed 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.
#=============================================================================
find_path(XRANDR_INCLUDE_DIRS NAMES X11/extensions/Xrandr.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XRANDR include directory"
)
find_library(XRANDR_LIBRARIES NAMES Xrandr
PATHS /opt/X11/lib
DOC "The XRANDR library"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRANDR DEFAULT_MSG XRANDR_LIBRARIES XRANDR_INCLUDE_DIRS)
mark_as_advanced(XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES)
+13
View File
@@ -0,0 +1,13 @@
# Try to find the yasm assembly program.
include(FindPackageHandleStandardArgs)
find_program(YASM_EXECUTABLE yasm
HINTS $ENV{YASM_ROOT} ${YASM_ROOT}
PATH_SUFFIXES bin
)
find_package_handle_standard_args(yasm DEFAULT_MSG YASM_EXECUTABLE)
mark_as_advanced(YASM_EXECUTABLE)