2016-03-26 15:49:05 -05:00
|
|
|
cmake_minimum_required(VERSION 2.8.8)
|
|
|
|
|
2017-05-12 16:28:59 -05:00
|
|
|
project(nostalgia)
|
2016-03-26 15:49:05 -05:00
|
|
|
|
2017-10-12 00:34:40 -05:00
|
|
|
set(NOSTALGIA_BUILD_TYPE "Native" CACHE STRING "The type of build to produce(Native/GBA)")
|
|
|
|
set(NOSTALGIA_IDE_BUILD "ON" CACHE STRING "Build for IDE's to run")
|
2018-02-06 19:20:07 -06:00
|
|
|
set(NOSTALGIA_QT_PATH "" CACHE STRING "Path to Qt Libraries")
|
|
|
|
|
|
|
|
set(CMAKE_PREFIX_PATH ${NOSTALGIA_QT_PATH})
|
2016-03-26 15:49:05 -05:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
|
|
|
include(address_sanitizer)
|
2016-12-23 17:29:19 -06:00
|
|
|
|
2017-10-12 00:34:40 -05:00
|
|
|
if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
|
2016-12-23 17:29:19 -06:00
|
|
|
include(GBA)
|
2017-05-03 23:20:53 -05:00
|
|
|
add_definitions(
|
|
|
|
-nostdlib
|
|
|
|
-fno-exceptions
|
|
|
|
-fno-rtti
|
2017-11-09 21:43:59 -06:00
|
|
|
-fno-strict-aliasing
|
|
|
|
-mthumb-interwork
|
|
|
|
-mthumb
|
2018-02-13 19:20:20 -06:00
|
|
|
-std=c++17
|
2017-05-03 23:20:53 -05:00
|
|
|
)
|
2018-02-13 19:20:20 -06:00
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2016-12-23 17:29:19 -06:00
|
|
|
endif()
|
2016-03-26 15:49:05 -05:00
|
|
|
|
2018-02-13 19:20:20 -06:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2016-03-26 15:49:05 -05:00
|
|
|
add_definitions(
|
2018-02-06 19:20:07 -06:00
|
|
|
#-fdiagnostics-color # forces colored output when using ninja
|
2016-03-26 15:49:05 -05:00
|
|
|
-Wall
|
|
|
|
-Wsign-compare
|
|
|
|
)
|
|
|
|
|
2018-02-08 00:14:36 -06:00
|
|
|
|
2017-10-12 00:34:40 -05:00
|
|
|
if(NOSTALGIA_IDE_BUILD STREQUAL "ON")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
endif()
|
2017-10-17 19:16:22 -05:00
|
|
|
|
2017-10-20 22:14:33 -05:00
|
|
|
if(APPLE)
|
|
|
|
set(CMAKE_MACOSX_RPATH OFF)
|
|
|
|
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia")
|
|
|
|
set(NOSTALGIA_DIST_BIN Nostalgia.app/Contents/MacOS)
|
|
|
|
set(NOSTALGIA_DIST_LIB Nostalgia.app/Contents/Library)
|
|
|
|
set(NOSTALGIA_DIST_PLUGIN Nostalgia.app/Contents/Plugins)
|
|
|
|
set(NOSTALGIA_DIST_RESOURCES Nostalgia.app/Contents/Resources)
|
|
|
|
set(NOSTALGIA_DIST_MAC_APP_CONTENTS Nostalgia.app/Contents)
|
2017-10-17 19:16:22 -05:00
|
|
|
else()
|
|
|
|
set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib/nostalgia")
|
2018-02-06 19:20:07 -06:00
|
|
|
if(NOT ${NOSTALGIA_QT_PATH} STREQUAL "")
|
|
|
|
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${NOSTALGIA_QT_PATH}/lib")
|
|
|
|
endif()
|
2017-10-17 19:16:22 -05:00
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
2017-10-20 22:14:33 -05:00
|
|
|
set(NOSTALGIA_DIST_BIN bin)
|
|
|
|
set(NOSTALGIA_DIST_LIB lib)
|
|
|
|
set(NOSTALGIA_DIST_PLUGIN lib)
|
|
|
|
set(NOSTALGIA_DIST_RESOURCES share)
|
2017-10-17 19:16:22 -05:00
|
|
|
endif()
|
2017-06-30 18:00:10 -05:00
|
|
|
|
2017-11-09 21:43:59 -06:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
2016-12-24 13:06:44 -06:00
|
|
|
add_definitions(
|
|
|
|
-Werror
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-03-26 15:49:05 -05:00
|
|
|
enable_testing()
|
|
|
|
|
2017-05-06 12:10:40 -05:00
|
|
|
add_subdirectory(deps/ox)
|
|
|
|
include_directories(deps/ox/src)
|
|
|
|
|
2016-03-26 15:49:05 -05:00
|
|
|
add_subdirectory(src)
|