testqbsp: export .bsp's to quake dir

This commit is contained in:
Eric Wasylishen 2022-04-17 02:58:40 -06:00
parent 2c8e433afa
commit ea8af6d55c
3 changed files with 11 additions and 0 deletions

View File

@ -88,6 +88,9 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
find_package(TBB REQUIRED)
set(TEST_QUAKE_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake maps to this directory (useful for testing in game)")
set(TEST_QUAKE2_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake 2 maps to this directory (useful for testing in game)")
# just creates testmaps.hh with absolute path to the testmaps source directory.
# include it as #include <testmaps.hh>
configure_file(testmaps.hh.in testmaps.hh @ONLY)

View File

@ -52,6 +52,12 @@ static mbsp_t LoadTestmap(const std::filesystem::path &name)
ProcessFile();
if (strlen(test_quake_maps_dir) > 0) {
auto dest = fs::path(test_quake_maps_dir) / name;
dest.replace_extension(".bsp");
fs::copy(options.szBSPName, dest, fs::copy_options::overwrite_existing);
}
// re-open the .bsp and return it
options.szBSPName.replace_extension("bsp");

View File

@ -1 +1,3 @@
const char *testmaps_dir = "@CMAKE_SOURCE_DIR@/testmaps";
const char *test_quake_maps_dir = "@TEST_QUAKE_MAP_EXPORT_DIR@";
const char *test_quake2_maps_dir = "@TEST_QUAKE2_MAP_EXPORT_DIR@";