[libzomg] Metadata_win32.cpp::getUserName_ansi(): Only check for NULLs if cbUsername...
[~korth/gens-gs-ii.git] / CMakeLists.txt
CommitLineData
3ce9d90d 1PROJECT(gens-gs-ii)
a358d617
DK
2
3# Version dependencies:
4# - BREAK(): CMake 2.6.0
8842c160 5# - NASM: CMake 2.8.4
a358d617
DK
6CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
7
67f8504c
DK
8# Set default build options.
9INCLUDE(cmake/options.cmake)
10
11list (APPEND CMAKE_MODULE_PATH
12 "${gens-gs-ii_SOURCE_DIR}/cmake/macros"
13 "${gens-gs-ii_SOURCE_DIR}/cmake/libs"
14 )
3ce9d90d 15
2c406a89
DK
16# Mac OS X: CMake doesn't include this by default.
17INCLUDE(CheckLibraryExists)
18
0fb7274d 19# Split Debug macro.
9a9e00c8
DK
20# Also sets the image version for Windows builds.
21INCLUDE(Win32ImageVersionLinkerFlags)
0fb7274d
DK
22MACRO(DO_SPLIT_DEBUG _TARGET)
23 # Split debug information.
24 INCLUDE(SetMSVCDebugPath)
25 SET_MSVC_DEBUG_PATH(${_TARGET})
26 IF(SPLIT_DEBUG)
27 INCLUDE(SplitDebugInformation)
28 SPLIT_DEBUG_INFORMATION(${_TARGET})
29 ENDIF(SPLIT_DEBUG)
9a9e00c8
DK
30 # Set image version.
31 # Subprojects can override ${VERSION_MAJOR} and ${VERSION_MINOR}.
32 # FIXME: If minor version is e.g. "3", Windows interprets it as "03",
33 # so "1.3" will actually be "1.03".
34 WIN32_IMAGE_VERSION_LINKER_FLAGS(${VERSION_MAJOR} ${VERSION_MINOR})
0fb7274d
DK
35ENDMACRO(DO_SPLIT_DEBUG)
36
a049c866
DK
37# Testing functions.
38INCLUDE(cmake/gtest.cmake)
dbe3193a 39
67f8504c
DK
40# Program information.
41SET(DESCRIPTION "Gens/GS II")
42SET(AUTHOR "David Korth")
43SET(VERSION_MAJOR 0)
44SET(VERSION_MINOR 0)
45SET(VERSION_PATCH 0)
46SET(VERSION_DEVEL 1)
47IF(VERSION_PATCH)
9567d710 48 SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
67f8504c
DK
49ELSE(VERSION_PATCH)
50 SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
51ENDIF(VERSION_PATCH)
52IF(VERSION_DEVEL)
53 SET(VERSION_STRING "${VERSION_STRING}+")
54ENDIF(VERSION_DEVEL)
55SET(VERSION_STRING_WIN32 "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_DEVEL}")
56
3ce9d90d 57# Git version information.
67f8504c
DK
58FIND_PROGRAM(POSIX_SH sh)
59IF(POSIX_SH)
60 # sh is available.
61 # Run the git version script.
62 IF(WIN32)
63 SET(ENV{SHELLOPTS} igncr)
64 ENDIF(WIN32)
65 ADD_CUSTOM_TARGET(git_version ALL
66 ${POSIX_SH} ${gens-gs-ii_SOURCE_DIR}/git_version.sh
67 -s "${gens-gs-ii_SOURCE_DIR}"
68 -o "${gens-gs-ii_BINARY_DIR}/git_version.h"
69 VERBATIM
70 )
71ELSE(POSIX_SH)
72 # sh isn't available.
73 # Create a blank git_version.h.
74 FILE(WRITE "${gens-gs-ii_BINARY_DIR}/git_version.h"
75 "/* dummy file; POSIX sh is not available */\n")
76ENDIF(POSIX_SH)
3ce9d90d 77
adf0fc4b
DK
78# If no build type is set, default to "debug".
79IF(CMAKE_BUILD_TYPE MATCHES ^$)
80 SET(CMAKE_BUILD_TYPE "debug")
19610fcf
DK
81ENDIF()
82
5216e645
DK
83# Don't bother with verbose makefiles for now.
84# TODO: Make it an option?
85#IF (CMAKE_BUILD_TYPE MATCHES ^debug$)
67f8504c 86 #SET(CMAKE_VERBOSE_MAKEFILE ON)
5216e645 87#ENDIF()
adf0fc4b 88
b0b74050 89# Check for platform-specific functionality.
2eec9582 90INCLUDE(cmake/platform.cmake)
fa84ce58 91
0fa75f21
DK
92IF(CMAKE_CROSSCOMPILING)
93 # Cross-compiling requires a native build due to generated
94 # executables being used in the build process.
95 # Reference: http://www.cmake.org/Wiki/CMake_Cross_Compiling
96 SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND"
97 CACHE PATH "Point this to the root directory of a native build.")
98 IF(NOT IMPORT_EXECUTABLES)
99 MESSAGE(FATAL_ERROR "IMPORT_EXECUTABLES is not set.\nPoint it to the root directory of a native build.")
100 ENDIF(NOT IMPORT_EXECUTABLES)
101 IF(NOT EXISTS "${IMPORT_EXECUTABLES}/")
102 MESSAGE(FATAL_ERROR "IMPORT_EXECUTABLES is not set to a valid directory.\nPoint it to the root directory of a native build.")
103 ENDIF(NOT EXISTS "${IMPORT_EXECUTABLES}/")
104ENDIF(CMAKE_CROSSCOMPILING)
105
b0b74050 106# Check for required libraries.
67f8504c 107INCLUDE(CheckZLIB)
571fc8b3 108INCLUDE(CheckPNG)
67f8504c 109INCLUDE(CheckLZMA)
ddd03936 110INCLUDE(CheckOpenGL)
120fe1c4 111INCLUDE(CheckPopt)
cb411f1e 112
3b00979d 113# Project subdirectories.
b0b74050 114ADD_SUBDIRECTORY(extlib)
3b00979d 115ADD_SUBDIRECTORY(src)
7e7413cc
DK
116
117# Documentation.
118IF(BUILD_DOC)
119 ADD_SUBDIRECTORY(doc)
120ENDIF(BUILD_DOC)