option(DOWNLOAD_GAMEPACKS "Download game packs" ON)
option(USE_WERROR "Build with -Werror -pedantic-errors" OFF)
option(FHS_INSTALL "Install according to Filesystem Hierarchy Standard" OFF)
+option(FHS_INSTALL_ABSOLUTE "Install using absolute paths (requires FHS_INSTALL)" OFF)
set(BUILD_BINARIES OFF CACHE INTERNAL "...")
if (BUILD_RADIANT OR BUILD_TOOLS)
endif ()
if (BUILD_BINARIES)
- if (WIN32 OR APPLE
+ if (WIN32
+ OR APPLE
OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux"
OR "${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD" )
set(BUNDLING_SUPPORTED ON)
endif ()
if (BUNDLE_LIBRARIES AND BUNDLING_SUPPORTED)
- set(FHS_INSTALL OFF CACHE PATH "Disabled because of BUNDLE_LIBRARIES" FORCE)
+ set(FHS_INSTALL OFF CACHE PATH "Disabled because of BUNDLE_LIBRARIES is enabled" FORCE)
+ endif ()
+
+ if (NOT FHS_INSTALL AND FHS_INSTALL_ABSOLUTE)
+ set(FHS_INSTALL_ABSOLUTE OFF CACHE PATH "Disabled because of FHS_INSTALL is disabled" FORCE)
endif ()
endif ()
add_definitions(-DRADIANT_BASENAME="${RADIANT_BASENAME}")
set(RADIANT_BIN_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
-set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE} CACHE INTERNAL "...")
+set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib CACHE INTERNAL "...")
set(RADIANT_ADDONS_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
set(RADIANT_SHARE_DIR ${FINAL_INSTALL_PREFIX}/share CACHE INTERNAL "...")
set(RADIANT_DATA_DIR ${FINAL_INSTALL_PREFIX} CACHE INTERNAL "...")
-if (FHS_INSTALL AND NOT BUNDLE_LIBRARIES)
+if (FHS_INSTALL)
+ add_definitions(-DRADIANT_FHS_INSTALL='ON')
+
set(RADIANT_BIN_DIR ${FINAL_INSTALL_PREFIX}/bin)
set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE})
set(RADIANT_ADDONS_DIR ${RADIANT_LIB_DIR}/${RADIANT_BASENAME})
set(RADIANT_SHARE_DIR ${FINAL_INSTALL_PREFIX}/share)
set(RADIANT_DATA_DIR ${RADIANT_SHARE_DIR}/${RADIANT_BASENAME})
+ set(RADIANT_LIB_DIR ${FINAL_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE})
+
+ if (FHS_INSTALL_ABSOLUTE)
+ add_definitions(-DRADIANT_ADDONS_DIR="${RADIANT_ADDONS_DIR}")
+ add_definitions(-DRADIANT_DATA_DIR="${RADIANT_DATA_DIR}")
+ else ()
+ add_definitions(-DRADIANT_LIB_ARCH="${CMAKE_LIBRARY_ARCHITECTURE}")
+ endif ()
endif ()
-add_definitions(-DRADIANT_ADDONS_DIR="${RADIANT_ADDONS_DIR}")
-add_definitions(-DRADIANT_DATA_DIR="${RADIANT_DATA_DIR}")
set(GAMEPACKS_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/download CACHE PATH "Where to store downloaded game packs")
}
{
+#if defined(RADIANT_FHS_INSTALL)
StringOutputStream buffer;
-#ifdef RADIANT_ADDONS_DIR
+ #if defined(RADIANT_ADDONS_DIR)
buffer << RADIANT_ADDONS_DIR << "/";
+ #else
+ buffer << app_path.c_str() << "../lib/";
+ buffer << RADIANT_LIB_ARCH << "/";
+ buffer << RADIANT_BASENAME << "/";
+ #endif
+ lib_path = buffer.c_str();
#else
- buffer << app_path.c_str() << "../lib/" << RADIANT_BASENAME << "/";
+ lib_path = app_path.c_str();
#endif
- if ( file_is_directory( buffer.c_str() ) ) {
- lib_path = buffer.c_str();
- }
- else {
- lib_path = app_path.c_str();
- }
}
{
+#if defined(RADIANT_FHS_INSTALL)
StringOutputStream buffer;
-#ifdef RADIANT_DATA_DIR
+ #if defined(RADIANT_DATA_DIR)
buffer << RADIANT_DATA_DIR << "/";
+ #else
+ buffer << app_path.c_str() << "../share/";
+ buffer << RADIANT_BASENAME << "/";
+ #endif
+ data_path = buffer.c_str();
#else
- buffer << app_path.c_str() << "../share/" << RADIANT_BASENAME << "/";
+ data_path = app_path.c_str();
#endif
- if ( file_is_directory( buffer.c_str() ) ) {
- data_path = buffer.c_str();
- }
- else {
- data_path = app_path.c_str();
- }
}
if ( !portable_app_setup() ) {