Play-/CMakeLists.txt
2019-08-30 13:25:03 -04:00

65 lines
1.8 KiB
CMake

cmake_minimum_required(VERSION 3.5)
# macOS deployment target needs to be set before 'project' to work
if(APPLE AND NOT TARGET_IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
endif()
project(Play)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/deps/Dependencies/cmake-modules
${CMAKE_MODULE_PATH}
)
include(Header)
set(BUILD_PLAY ON CACHE BOOL "Build Play! Emulator")
set(BUILD_PSFPLAYER OFF CACHE BOOL "Build PsfPlayer")
set(BUILD_TESTS ON CACHE BOOL "Build Tests")
set(USE_AOT_CACHE OFF CACHE BOOL "Use AOT block cache")
set(BUILD_AOT_CACHE OFF CACHE BOOL "Build AOT block cache (for PsfPlayer only)")
set(PROJECT_NAME "Play!")
set(PROJECT_Version 0.30)
execute_process(COMMAND git rev-parse --short HEAD RESULT_VARIABLE SHORT_HASH_RESULT OUTPUT_VARIABLE SHORT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
if(SHORT_HASH_RESULT EQUAL 0)
message("Building for hash ${SHORT_HASH}.")
set(PROJECT_Version "${PROJECT_Version}-${SHORT_HASH}")
else()
message("Warning: Failed to obtain Git short hash.")
endif()
add_definitions(-DPLAY_VERSION="${PROJECT_Version}")
set(PROJECT_LIBS)
include(PrecompiledHeader)
if(BUILD_PLAY)
if(TARGET_PLATFORM_UNIX OR TARGET_PLATFORM_MACOS OR TARGET_PLATFORM_WIN32 OR USE_QT)
add_subdirectory(Source/ui_qt/)
endif(TARGET_PLATFORM_UNIX OR TARGET_PLATFORM_MACOS OR TARGET_PLATFORM_WIN32 OR USE_QT)
if(NOT USE_QT)
if(TARGET_PLATFORM_IOS)
add_subdirectory(Source/ui_ios/)
endif(TARGET_PLATFORM_IOS)
if(TARGET_PLATFORM_ANDROID)
add_subdirectory(Source/ui_android/)
endif(TARGET_PLATFORM_ANDROID)
endif()
endif(BUILD_PLAY)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tools/AutoTest/)
add_subdirectory(tools/McServTest/)
add_subdirectory(tools/VuTest/)
endif()
if(BUILD_PSFPLAYER)
add_subdirectory(tools/PsfPlayer)
endif(BUILD_PSFPLAYER)