diff --git a/CMakeLists.txt b/CMakeLists.txt index e7bced80ec43916098aa324fc4bd893f53e79a02..170feb45c89bb087d0adf67e985cd17d1d251d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ cmake_dependent_option( ) option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON) option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF) +set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.") # Enable CCache # (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options) diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 1f94d14462ca26929f3623ffecbae0af04974e6c..42243c9c1069115fba37b82bd3e0d54b94ee4d8c 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -1,76 +1,53 @@ ## Assets Target Configuration ## -# For prepending the current source path, later -FUNCTION(PREPEND var prefix) - SET(listVar "") - FOREACH(f ${ARGN}) - LIST(APPEND listVar "${prefix}/${f}") - ENDFOREACH(f) - SET(${var} "${listVar}" PARENT_SCOPE) -ENDFUNCTION(PREPEND) +if(${CMAKE_SYSTEM} MATCHES Linux) + # Asset installation isn't part of the Linux target + return() +endif() + +if("${SRB2_CONFIG_ASSET_DIRECTORY}" STREQUAL "") + message(WARNING "SRB2_CONFIG_ASSET_DIRECTORY is not set, so installation will not contain data files.") + return() +endif() -set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" - CACHE STRING "Path to directory that contains all asset files for the installer.") +get_filename_component(SRB2_ASSET_DIRECTORY_ABSOLUTE "${SRB2_CONFIG_ASSET_DIRECTORY}" ABSOLUTE) -set(SRB2_ASSET_INSTALL ON - CACHE BOOL "Insert asset files into the install directory or package.") +set(SRB2_ASSETS_DOCS + "README.txt" + "HISTORY.txt" + "README-SDL.txt" + "LICENSE.txt" + "LICENSE-3RD-PARTY.txt" +) +list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "/") +list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}") #################### # POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list! #################### -set(SRB2_ASSET_HASHED -"main.kart;\ -gfx.pk3;\ -textures.pk3;\ -chars.pk3;\ -maps.pk3;\ -followers.pk3;\ -patch.pk3" - CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" +set(SRB2_ASSETS_GAME + "main.kart" + "gfx.pk3" + "textures.pk3" + "chars.pk3" + "maps.pk3" + "followers.pk3" + "patch.pk3" ) +list(TRANSFORM SRB2_ASSETS_GAME PREPEND "/") +list(TRANSFORM SRB2_ASSETS_GAME PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}") -set(SRB2_ASSET_DOCS -"README.txt;\ -HISTORY.txt;\ -LICENSE.txt;\ -LICENSE-3RD-PARTY.txt;\ -README-SDL.txt" - CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!" -) - -PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS}) - -foreach(SRB2_ASSET ${SRB2_ASSET_HASHED}) - file(MD5 ${SRB2_ASSET_DIRECTORY}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH") - set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE) -endforeach() +set(SRB2_ASSETS ${SRB2_ASSET_DOCS} ${SRB2_ASSETS_GAME}) # Installation if(${CMAKE_SYSTEM} MATCHES Darwin) get_target_property(outname SRB2SDL2 OUTPUT_NAME) - if(${SRB2_ASSET_INSTALL}) - install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" - DESTINATION "${outname}.app/Contents/Resources" - ) - endif() - # Always install the doc files, even in non-asset packages. - install(FILES ${SRB2_ASSET_DOCS} - DESTINATION . - OPTIONAL - ) + install(FILES ${SRB2_ASSETS} DESTINATION "${outname}.app/Contents/Resources") + install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION "${outname}.app/Contents/Resources") + install(FILES ${SRB2_ASSETS_DOCS} DESTINATION .) else() - if(${SRB2_ASSET_INSTALL}) - install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" - DESTINATION . - ) - # Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install them in their own call. - else() - # Always install the doc files, even in non-asset packages. - install(FILES ${SRB2_ASSET_DOCS} - DESTINATION . - OPTIONAL - ) - endif() + install(FILES ${SRB2_ASSETS} DESTINATION .) + install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION .) endif() diff --git a/src/config.h.in b/src/config.h.in index c27628ffd00657609d861e143727247df9804c32..d7b67cdce73946931d3d56423bdad29458a36326 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -11,15 +11,6 @@ #ifdef CMAKECONFIG -#define ASSET_HASH_MAIN_KART "${SRB2_ASSET_main.kart_HASH}" -#define ASSET_HASH_GFX_PK3 "${SRB2_ASSET_gfx.pk3_HASH}" -#define ASSET_HASH_TEXTURES_PK3 "${SRB2_ASSET_textures.pk3_HASH}" -#define ASSET_HASH_CHARS_PK3 "${SRB2_ASSET_chars.pk3_HASH}" -#define ASSET_HASH_MAPS_PK3 "${SRB2_ASSET_maps.pk3_HASH}" -#ifdef USE_PATCH_FILE -#define ASSET_HASH_PATCH_PK3 "${SRB2_ASSET_patch.pk3_HASH}" -#endif - #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" #define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" // This is done with configure_file instead of defines in order to avoid @@ -29,9 +20,7 @@ #define COMPVERSION_UNCOMMITTED #endif -#define CMAKE_ASSETS_DIR "${CMAKE_SOURCE_DIR}/assets" - -#else +#endif /* Manually defined asset hashes for non-CMake builds * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets @@ -48,4 +37,3 @@ #endif #endif -#endif \ No newline at end of file diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index db4296f79e6f4e7ae00fa9f8e624e61348fda09f..707d20427fd7cc0ebd22f37d54f33ff202ccee0d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2273,18 +2273,6 @@ static const char *locateWad(void) } #endif - -#ifdef CMAKECONFIG -#ifndef NDEBUG - I_OutputMsg(","CMAKE_ASSETS_DIR); - strcpy(returnWadPath, CMAKE_ASSETS_DIR); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } -#endif -#endif - #ifdef __APPLE__ OSX_GetResourcesPath(returnWadPath); I_OutputMsg(",%s", returnWadPath);