Add speed-dreams-data as submodule #18
6 changed files with 43 additions and 34 deletions
|
@ -33,30 +33,43 @@ IF(APPLE)
|
|||
SET(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
ENDIF(APPLE)
|
||||
|
||||
option(SD_ASSUME_DATADIR "Assume default directory for speed-dreams-data if not found")
|
||||
option(SD_ASSUME_DATADIR "Assume default directory for speed-dreams-data")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(data_version 2.3.0)
|
||||
find_package(speed-dreams-data ${data_version})
|
||||
|
||||
if(NOT SD_DATADIR)
|
||||
if(SD_ASSUME_DATADIR)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(SD_DATADIR ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
set(SD_DATADIR_ABS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
message(STATUS "Data directory: ${SD_DATADIR_ABS} (assumed)")
|
||||
set(SD_HAS_DATADIR true)
|
||||
else()
|
||||
message(WARNING "Data directory not found or incompatible with version "
|
||||
"${data_version}. Speed Dreams should still "
|
||||
"be able to build, but it might not run successfully. "
|
||||
"If speed-dreams-data has been installed to a non-standard location, "
|
||||
"please add -DCMAKE_PREFIX_PATH=<data-dir> to the command line to "
|
||||
"find it.")
|
||||
endif()
|
||||
if(SD_ASSUME_DATADIR)
|
||||
set(SD_DATADIR ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
set(SD_DATADIR_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
set(SD_DATADIR_ABS ${SD_DATADIR_INSTALL_PREFIX})
|
||||
message(STATUS "Data directory: ${SD_DATADIR_ABS} (assumed)")
|
||||
elseif(EXISTS speed-dreams-data/CMakeLists.txt)
|
||||
add_subdirectory(speed-dreams-data)
|
||||
set(SD_DATADIR ${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
set(SD_DATADIR_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/games/speed-dreams-2)
|
||||
set(SD_DATADIR_ABS ${CMAKE_CURRENT_SOURCE_DIR}/speed-dreams-data/data)
|
||||
message(STATUS "Data directory: ${SD_DATADIR_ABS} (in-tree)")
|
||||
else()
|
||||
set(data_version 2.3.0)
|
||||
find_package(speed-dreams-data ${data_version} QUIET)
|
||||
|
||||
if(NOT SD_DATADIR)
|
||||
message(FATAL_ERROR
|
||||
"Data directory not found or incompatible with version "
|
||||
"${data_version}. Please perform one of the following actions:\n"
|
||||
"- Update the data git submodule to do an in-tree build with the "
|
||||
" command below, and then configure the project again:\n"
|
||||
"git submodule update --init --recursive\n"
|
||||
"- If speed-dreams-data has been installed to a non-standard "
|
||||
"location, configure the project with "
|
||||
"-DCMAKE_PREFIX_PATH=<data-dir>.\n"
|
||||
"- Configure the project with -DSD_ASSUME_DATADIR=1 to assume "
|
||||
"speed-dreams-data was installed into a standard location. "
|
||||
"Speed Dreams should then still be able to build, but it might "
|
||||
"not run successfully. This option is usually only recommended "
|
||||
"for CI/CD and packagers."
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Data directory: ${SD_DATADIR_ABS}")
|
||||
set(SD_HAS_DATADIR true)
|
||||
endif()
|
||||
|
||||
INCLUDE(cmake/macros.cmake)
|
||||
|
|
|
@ -174,15 +174,9 @@
|
|||
#endif
|
||||
|
||||
/* Run-time directories */
|
||||
#cmakedefine SD_HAS_DATADIR
|
||||
|
||||
#if defined(SD_HAS_DATADIR)
|
||||
# define SD_DATADIR "${SD_DATADIR}/"
|
||||
# define SD_DATADIR_ABS "${SD_DATADIR_ABS}/"
|
||||
#else
|
||||
# define SD_DATADIR ""
|
||||
# define SD_DATADIR_ABS ""
|
||||
#endif
|
||||
#define SD_DATADIR "${SD_DATADIR}/"
|
||||
#define SD_DATADIR_ABS "${SD_DATADIR_ABS}/"
|
||||
#define SD_DATADIR_INSTALL_PREFIX "${SD_DATADIR_INSTALL_PREFIX}/"
|
||||
|
||||
#define SD_LIBDIR "${SD_LIBDIR}/"
|
||||
#define SD_BINDIR "${SD_BINDIR}/"
|
||||
|
|
|
@ -27,7 +27,7 @@ computer-controlled driver implementations, flexible race configuration
|
|||
master server to compare your best lap times against other players."
|
||||
)
|
||||
|
||||
if(SD_HAS_DATADIR AND NOT SD_ASSUME_DATADIR)
|
||||
if(NOT SD_ASSUME_DATADIR)
|
||||
set(CPACK_PACKAGE_ICON "${SD_DATADIR_ABS}/data/img/header.bmp")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME ${PROJECT_NAME})
|
||||
set(CPACK_NSIS_MUI_FINISHPAGE_RUN ${PROJECT_NAME})
|
||||
set(CPACK_NSIS_DISPLAY_NAME "Speed Dreams ${CPACK_PACKAGE_VERSION} (engine and tools)")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "Speed Dreams ${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "${CMAKE_PROJECT_HOMEPAGE_URL}")
|
||||
set(CPACK_NSIS_HELP_LINK "https://forge.a-lec.org/speed-dreams/")
|
||||
set(CPACK_PACKAGE_EXECUTABLES
|
||||
|
@ -23,7 +23,7 @@ set(CPACK_NSIS_MENU_LINKS
|
|||
"https://forge.a-lec.org/speed-dreams/" "Project source repositories"
|
||||
"/doc/userman/how_to_drive.html" "User manual")
|
||||
|
||||
if(SD_HAS_DATADIR AND NOT SD_ASSUME_DATADIR)
|
||||
if(NOT SD_ASSUME_DATADIR)
|
||||
set(CPACK_NSIS_MUI_ICON "${SD_DATADIR_ABS}/data/icons/icon.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${SD_DATADIR_ABS}/data/icons/icon.ico")
|
||||
set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${SD_DATADIR_ABS}/data/img/header-vert.bmp")
|
||||
|
|
|
@ -449,6 +449,8 @@ bool GfApplication::parseOptions()
|
|||
strDataDir = GfSetDataDir(SD_DATADIR);
|
||||
if (strDataDir.empty() || !GfDirExists(strDataDir.c_str()))
|
||||
strDataDir = GfSetDataDir(SD_DATADIR_ABS);
|
||||
if (strDataDir.empty() || !GfDirExists(strDataDir.c_str()))
|
||||
strDataDir = GfSetDataDir(SD_DATADIR_INSTALL_PREFIX);
|
||||
|
||||
// Check if ALL the Speed-dreams dirs have a usable value, and exit if not.
|
||||
if (strLocalDir.empty() || strLibDir.empty() || strBinDir.empty() || strDataDir.empty())
|
||||
|
|
|
@ -9,7 +9,7 @@ IF(MSVC)
|
|||
SET(_SOURCES ${_SOURCES} main.rc resource.h ../../data/data/icons/icon.ico)
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(SD_HAS_DATADIR AND NOT SD_ASSUME_DATADIR)
|
||||
IF(NOT SD_ASSUME_DATADIR)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}.rc.in.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rc)
|
||||
SET(_SOURCES ${_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.rc)
|
||||
|
|
Loading…
Reference in a new issue