melonds-ds/CMakeLists.txt

113 lines
4.0 KiB
CMake
Raw Normal View History

2023-09-03 16:47:33 +00:00
cmake_minimum_required(VERSION 3.19)
2023-03-06 19:19:45 +00:00
2023-09-03 16:47:33 +00:00
cmake_policy(VERSION 3.19)
2024-01-08 13:03:41 +00:00
message(STATUS "Using CMake ${CMAKE_VERSION} from ${CMAKE_COMMAND}" )
2023-06-24 19:58:45 +00:00
if (CMAKE_MESSAGE_LOG_LEVEL)
message(STATUS "Message log level is set to ${CMAKE_MESSAGE_LOG_LEVEL}")
endif ()
2023-03-06 19:19:45 +00:00
# Parse the latest version from CHANGELOG.md, so we don't have to specify it in multiple places.
file(STRINGS "CHANGELOG.md" CHANGELOG REGEX "^## \\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].+")
list(TRANSFORM CHANGELOG REPLACE "^## \\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].+" "\\1")
list(SORT CHANGELOG COMPARE NATURAL ORDER DESCENDING)
list(GET CHANGELOG 0 VERSION)
2023-11-06 16:15:38 +00:00
message(STATUS "Project version is ${VERSION}")
project("melonDS DS"
VERSION "${VERSION}"
DESCRIPTION "A remake of the libretro melonDS core that prioritizes standalone parity, reliability, and usability. This core closely follows the feature set of standalone melonDS; it features OpenGL-accelerated upscaling, multiple screen layouts, and Wi-Fi emulation."
2023-03-06 19:19:45 +00:00
HOMEPAGE_URL "https://melonds.kuribo64.net"
LANGUAGES C CXX)
message(STATUS "Configuring a ${CMAKE_BUILD_TYPE} build.")
2023-08-06 16:03:22 +00:00
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
2023-06-24 01:07:45 +00:00
include(CheckSymbolExists)
2023-06-24 16:50:00 +00:00
include(CheckIncludeFile)
include(CheckIncludeFiles)
2023-08-06 19:30:17 +00:00
include(CheckTypeSize)
2023-03-06 19:19:45 +00:00
include(FetchContent)
2023-07-10 18:44:24 +00:00
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
2023-03-06 19:19:45 +00:00
2023-08-06 16:02:24 +00:00
find_package(Git REQUIRED)
2023-09-03 16:47:23 +00:00
include(GitInfo)
2024-01-12 18:05:01 +00:00
message(STATUS "GIT_REVISION: ${GIT_REVISION}")
message(STATUS "GIT_STATE: ${GIT_STATE}")
message(STATUS "GIT_BRANCH: ${GIT_BRANCH}")
option(TRACY_ENABLE "Build with Tracy support." OFF)
if (IOS)
message(STATUS "JIT is disabled by default in iOS builds.")
set(DEFAULT_ENABLE_JIT OFF)
else()
set(DEFAULT_ENABLE_JIT ON)
endif ()
option(ENABLE_JIT "Enable JIT support. Not supported on all platforms." ${DEFAULT_ENABLE_JIT})
if (ANDROID OR IOS OR APPLE)
message(STATUS "OpenGL is disabled by default on this platform.")
set(DEFAULT_ENABLE_OPENGL OFF)
else ()
set(DEFAULT_ENABLE_OPENGL ON)
endif ()
if (ANDROID)
set(DEFAULT_OPENGL_PROFILE OpenGLES2)
else ()
set(DEFAULT_OPENGL_PROFILE OpenGL)
endif ()
option(ENABLE_OPENGL "Enable OpenGL support. Not supported on all platforms; defaults to OFF in such case." ${DEFAULT_ENABLE_OPENGL})
set(ENABLE_OGLRENDERER ${ENABLE_OPENGL})
set(OPENGL_PROFILE ${DEFAULT_OPENGL_PROFILE} CACHE STRING "OpenGL profile to use if OpenGL is enabled. Valid values are 'OpenGL', 'OpenGLES2', 'OpenGLES3', 'OpenGLES31', and 'OpenGLES32'.")
set_property(CACHE OPENGL_PROFILE PROPERTY STRINGS OpenGL OpenGLES2 OpenGLES3)
if (ENABLE_OPENGL AND (NOT OPENGL_PROFILE STREQUAL "OpenGL"))
message(FATAL_ERROR "melonDS does not support OpenGL ES yet")
2024-01-30 03:03:03 +00:00
endif()
if (ANDROID)
if (NOT ANDROID_PLATFORM)
set(ANDROID_PLATFORM "android-24")
endif()
message(STATUS "Targeting Android platform ${ANDROID_PLATFORM}")
endif ()
include(cmake/utils.cmake)
2023-07-10 18:44:24 +00:00
include(cmake/FetchDependencies.cmake)
include(cmake/ConfigureFeatures.cmake)
include(cmake/ConfigureDependencies.cmake)
2023-03-06 22:45:53 +00:00
set(MELONDSDS_NAME "${CMAKE_PROJECT_NAME}")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(MELONDSDS_VERSION "${CMAKE_PROJECT_VERSION}")
else()
if (GIT_STATE)
set(MELONDSDS_VERSION "${GIT_STATE}-${CMAKE_BUILD_TYPE}-upstream-${MELONDS_REPOSITORY_TAG}")
else ()
set(MELONDSDS_VERSION "v${CMAKE_PROJECT_VERSION}-nogit-${CMAKE_BUILD_TYPE}-upstream-${MELONDS_REPOSITORY_TAG}")
endif()
endif()
message(STATUS "${MELONDSDS_NAME} version string: '${MELONDSDS_VERSION}'")
configure_file("${CMAKE_SOURCE_DIR}/melondsds_libretro.info.in" "${CMAKE_CURRENT_BINARY_DIR}/melondsds_libretro.info")
2023-11-01 13:29:52 +00:00
# Formerly off by default due to a bug that has since been fixed.
# This option may be removed in the future.
option(ENABLE_THREADED_RENDERER "Enable the threaded software renderer." ON)
2023-09-03 16:40:36 +00:00
option(BUILD_TESTING "Build test suite." OFF)
include(CTest)
add_subdirectory(src/libretro)
include(cmake/GenerateAttributions.cmake)
2023-11-02 14:02:35 +00:00
2023-09-03 16:40:36 +00:00
if (BUILD_TESTING)
message(STATUS "Enabling test suite.")
enable_testing()
add_subdirectory(test)
endif()
2024-01-30 03:03:03 +00:00
dump_cmake_variables()