Browse Source

Gave each source folder its own CMakeLists and removed the data plugin

- Every folder of src and test lists its sources in its own CMakeLists. The installer uses the same lists as the library.
- On Linux the sources were picked up automatically, because the hand written list was inside the MinGW block. The explicit lists are used on every system now.
- Removed PlugIns, an Ogre plugin that was not built and could not be.
Iñigo Valentin 1 ngày trước cách đây
mục cha
commit
df0c064791
68 tập tin đã thay đổi với 509 bổ sung và 857 xóa
  1. 1 1
      .github/copilot-instructions.md
  2. 2 2
      .github/instructions/tests.instructions.md
  3. 1 1
      .github/prompts/new-data-format.prompt.md
  4. 1 1
      .github/prompts/test.prompt.md
  5. 0 3
      PlugIns/CMakeLists.txt
  6. 0 56
      PlugIns/Data/CMakeLists.txt
  7. 0 96
      PlugIns/Data/include/VGearsDataPlugin.h
  8. 0 4
      PlugIns/Data/misc/VGearsData.def
  9. 0 52
      PlugIns/Data/src/VGearsDataPlugin.cpp
  10. 0 37
      PlugIns/Data/src/VGearsDataPluginDll.cpp
  11. 0 143
      PlugIns/Data/test/tex_file_info.cpp
  12. 0 170
      PlugIns/Data/test/tex_file_test.cpp
  13. 0 1
      data/plugins.cfg
  14. 0 1
      data/plugins_d.cfg
  15. 28 177
      src/CMakeLists.txt
  16. 6 0
      src/app/CMakeLists.txt
  17. 17 0
      src/common/CMakeLists.txt
  18. 17 0
      src/engine/CMakeLists.txt
  19. 4 0
      src/engine/audio/CMakeLists.txt
  20. 8 0
      src/engine/config/CMakeLists.txt
  21. 11 0
      src/engine/entity/CMakeLists.txt
  22. 13 0
      src/engine/graphics/CMakeLists.txt
  23. 4 0
      src/engine/input/CMakeLists.txt
  24. 20 0
      src/engine/particles/CMakeLists.txt
  25. 5 0
      src/engine/particles/emitters/CMakeLists.txt
  26. 5 0
      src/engine/particles/renderer/CMakeLists.txt
  27. 5 0
      src/engine/save/CMakeLists.txt
  28. 4 0
      src/engine/script/CMakeLists.txt
  29. 12 0
      src/engine/ui/CMakeLists.txt
  30. 20 0
      src/engine/xml/CMakeLists.txt
  31. 13 0
      src/formats/CMakeLists.txt
  32. 27 0
      src/formats/field/CMakeLists.txt
  33. 6 0
      src/formats/lgp/CMakeLists.txt
  34. 20 0
      src/formats/model/CMakeLists.txt
  35. 5 0
      src/formats/texture/CMakeLists.txt
  36. 8 0
      src/formats/worldmap/CMakeLists.txt
  37. 5 87
      src/installer/CMakeLists.txt
  38. 5 0
      src/installer/cli/CMakeLists.txt
  39. 16 0
      src/installer/decompiler/CMakeLists.txt
  40. 10 0
      src/installer/decompiler/field/CMakeLists.txt
  41. 17 0
      src/installer/decompiler/field/instruction/CMakeLists.txt
  42. 11 0
      src/installer/decompiler/instruction/CMakeLists.txt
  43. 8 0
      src/installer/decompiler/world/CMakeLists.txt
  44. 13 0
      src/installer/decompiler/world/instruction/CMakeLists.txt
  45. 13 0
      src/installer/extractors/CMakeLists.txt
  46. 10 0
      src/installer/formats/CMakeLists.txt
  47. 4 0
      src/installer/gui/CMakeLists.txt
  48. 11 0
      src/installer/steps/CMakeLists.txt
  49. 9 0
      src/installer/support/CMakeLists.txt
  50. 3 0
      src/modules/CMakeLists.txt
  51. 8 0
      src/modules/battle/CMakeLists.txt
  52. 6 0
      src/modules/worldmap/CMakeLists.txt
  53. 27 25
      test/CMakeLists.txt
  54. 5 0
      test/common/CMakeLists.txt
  55. 4 0
      test/engine/CMakeLists.txt
  56. 5 0
      test/engine/entity/CMakeLists.txt
  57. 6 0
      test/engine/graphics/CMakeLists.txt
  58. 4 0
      test/engine/ui/CMakeLists.txt
  59. 3 0
      test/formats/CMakeLists.txt
  60. 4 0
      test/formats/model/CMakeLists.txt
  61. 4 0
      test/formats/worldmap/CMakeLists.txt
  62. 4 0
      test/installer/CMakeLists.txt
  63. 3 0
      test/installer/decompiler/CMakeLists.txt
  64. 5 0
      test/installer/decompiler/field/CMakeLists.txt
  65. 5 0
      test/installer/decompiler/world/CMakeLists.txt
  66. 4 0
      test/installer/decompiler/world/instruction/CMakeLists.txt
  67. 9 0
      test/installer/extractors/CMakeLists.txt
  68. 5 0
      test/installer/steps/CMakeLists.txt

+ 1 - 1
.github/copilot-instructions.md

@@ -19,7 +19,7 @@ V-Gears is a free, cross-platform reimplementation of the Final Fantasy VII engi
 - `src/installer/` — Qt data installer (`v-gears-installer`): `gui/`, `cli/`, `steps/` (the installation process), `extractors/` (game data conversion), `formats/`, `support/`, `tables/` (data tables) and `decompiler/` (converts field and world scripts into Lua).
 - `src/installer/` — Qt data installer (`v-gears-installer`): `gui/`, `cli/`, `steps/` (the installation process), `extractors/` (game data conversion), `formats/`, `support/`, `tables/` (data tables) and `decompiler/` (converts field and world scripts into Lua).
 - `src/third_party/sol/` — vendored sol2 single header. Do not restyle, modernize, or refactor it.
 - `src/third_party/sol/` — vendored sol2 single header. Do not restyle, modernize, or refactor it.
 - LuaJIT is a system dependency.
 - LuaJIT is a system dependency.
-- `test/` — Boost.Test suite mirroring `src/` paths; sources are listed manually in `test/CMakeLists.txt`.
+- `test/` — Boost.Test suite mirroring `src/` paths; each folder of `src/` and `test/` lists its sources by hand in its `CMakeLists.txt`.
 - `data/` — the files shipped with the game, copied to the installation directory: the Ogre plugins/resources cfgs, `engine/` (scripts, screens in `ui/`, fonts, texts, shaders, metadata) and `defaults/`. Not game data: the installer writes that to `game/` in the installation directory.
 - `data/` — the files shipped with the game, copied to the installation directory: the Ogre plugins/resources cfgs, `engine/` (scripts, screens in `ui/`, fonts, texts, shaders, metadata) and `defaults/`. Not game data: the installer writes that to `game/` in the installation directory.
 - `doc/` — all guides. The original binary formats are documented in the header comments of the parsers and in [the FF7 wiki at wiki.ffrtt.ru](https://wiki.ffrtt.ru/index.php/FF7).
 - `doc/` — all guides. The original binary formats are documented in the header comments of the parsers and in [the FF7 wiki at wiki.ffrtt.ru](https://wiki.ffrtt.ru/index.php/FF7).
 - `_OLD/` — legacy q-gears code kept for reference. Do not modify or reuse without asking.
 - `_OLD/` — legacy q-gears code kept for reference. Do not modify or reuse without asking.

+ 2 - 2
.github/instructions/tests.instructions.md

@@ -1,5 +1,5 @@
 ---
 ---
-description: "Use when writing, adding, or fixing tests in the test/ directory. Covers Boost.Test conventions, registering test sources in test/CMakeLists.txt, and running the v-gears-tests suite."
+description: "Use when writing, adding, or fixing tests in the test/ directory. Covers Boost.Test conventions, registering test sources in the CMakeLists.txt of their folder, and running the v-gears-tests suite."
 applyTo: "test/**"
 applyTo: "test/**"
 ---
 ---
 
 
@@ -7,7 +7,7 @@ applyTo: "test/**"
 
 
 - Tests use Boost.Test with dynamic linking (`BOOST_TEST_DYN_LINK`); the suite builds as the `v-gears-tests` target and is registered with CTest.
 - Tests use Boost.Test with dynamic linking (`BOOST_TEST_DYN_LINK`); the suite builds as the `v-gears-tests` target and is registered with CTest.
 - Test files mirror the path of the code under test (`test/formats/model/AFile.cpp` tests `src/formats/model/AFile.cpp`). Follow this existing convention for placement.
 - Test files mirror the path of the code under test (`test/formats/model/AFile.cpp` tests `src/formats/model/AFile.cpp`). Follow this existing convention for placement.
-- Every new test source file must be added manually to `SOURCE_FILES` in [test/CMakeLists.txt](../../test/CMakeLists.txt) — there is no globbing.
+- Every new test source file must be added manually to the `CMakeLists.txt` of its folder, with `vgears_tests()` (or `vgears_installer_tests()` for the tests of the installer logic) — there is no globbing. A new folder also needs an `add_subdirectory()` in its parent.
 - RTTI (`dynamic_cast`, `typeid`) is allowed in tests even though production code avoids it.
 - RTTI (`dynamic_cast`, `typeid`) is allowed in tests even though production code avoids it.
 - Never use original game data in tests. Construct binary fixtures in-code (byte buffers, temp files) instead.
 - Never use original game data in tests. Construct binary fixtures in-code (byte buffers, temp files) instead.
 
 

+ 1 - 1
.github/prompts/new-data-format.prompt.md

@@ -14,6 +14,6 @@ Scaffold a new FF7 binary format parser for the format named by the user:
    - `XFileSerializer` — binary read/write, deriving from the same serializer base as its neighbors.
    - `XFileSerializer` — binary read/write, deriving from the same serializer base as its neighbors.
    - `XFileManager` — Ogre `ResourceManager` singleton integration, matching the existing pattern.
    - `XFileManager` — Ogre `ResourceManager` singleton integration, matching the existing pattern.
 3. Follow `doc/STYLE.md` strictly: C++14, `PascalCase` types, `snake_case` variables with trailing underscore for members, `#pragma once`, correct include order.
 3. Follow `doc/STYLE.md` strictly: C++14, `PascalCase` types, `snake_case` variables with trailing underscore for members, `#pragma once`, correct include order.
-4. Register the new sources in the appropriate `src/CMakeLists.txt` source list (no globbing — add them explicitly, in the same grouped style as neighboring entries).
+4. Register the new sources in the `CMakeLists.txt` of their folder, with `vgears_sources()` (no globbing — add them explicitly). A new folder also needs an `add_subdirectory()` in its parent.
 5. Do not add or reference original game data; document the binary layout in the header comments instead.
 5. Do not add or reference original game data; document the binary layout in the header comments instead.
 6. Build the affected target to verify it compiles.
 6. Build the affected target to verify it compiles.

+ 1 - 1
.github/prompts/test.prompt.md

@@ -11,6 +11,6 @@ Build and run the V-Gears test suite:
 2. Run the suite: `ctest --test-dir build --output-on-failure`.
 2. Run the suite: `ctest --test-dir build --output-on-failure`.
 3. For each failure, read the failing test and the code under test, fix the root cause, and rerun.
 3. For each failure, read the failing test and the code under test, fix the root cause, and rerun.
    - Tests use Boost.Test with dynamic linking.
    - Tests use Boost.Test with dynamic linking.
-   - New test sources must be registered manually in `test/CMakeLists.txt`.
+   - New test sources must be registered manually in the `CMakeLists.txt` of their folder (`vgears_tests()`).
    - Never use original game data in tests — build fixtures in code.
    - Never use original game data in tests — build fixtures in code.
 4. Report pass/fail counts and summarize what was fixed.
 4. Report pass/fail counts and summarize what was fixed.

+ 0 - 3
PlugIns/CMakeLists.txt

@@ -1,3 +0,0 @@
-set(PLUGIN_PREFIX Plugin_)
-
-add_subdirectory(Data)

+ 0 - 56
PlugIns/Data/CMakeLists.txt

@@ -1,56 +0,0 @@
-set(V-Gears_SOURCE_DIR ../../src)
-
-# Define header and source files for the library.
-set(HEADER_FILES
-    ${V-Gears_SOURCE_DIR}/common/Prerequisites.h
-    ${V-Gears_SOURCE_DIR}/common/ManualObject.h
-    ${V-Gears_SOURCE_DIR}/common/StringUtil.h
-    ${V-Gears_SOURCE_DIR}/common/TypeDefine.h
-    include/VGearsDataPlugin.h
-)
-set(SOURCE_FILES
-    ${V-Gears_SOURCE_DIR}/common/ManualObject.cpp
-    ${V-Gears_SOURCE_DIR}/common/StringUtil.cpp
-    ${V-Gears_SOURCE_DIR}/common/TypeDefine.cpp
-    src/VGearsDataPlugin.cpp
-    src/VGearsDataPluginDll.cpp
-)
-
-include_directories(
-    ${OIS_INCLUDE_DIRS}
-    ${OGRE_INCLUDE_DIRS}
-    ${OGRE_SAMPLES_INCLUDEPATH}
-    ${V-Gears_SOURCE_DIR}
-    ${CMAKE_CURRENT_SOURCE_DIR}/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../../lib
-)
-
-# Defines.
-#add_definitions(-DBOOST_ALL_DYN_LINK)
-
-add_library(DataPlugin MODULE
-    ${HEADER_FILES}
-    ${SOURCE_FILES}
-)
-SET_PROPERTY(TARGET DataPlugin PROPERTY FOLDER "v-gears")
-
-set_target_properties(DataPlugin PROPERTIES
-    PREFIX ${PLUGIN_PREFIX}
-    OUTPUT_NAME Data
-)
-
-set(LIBRARIES
-    ${OGRE_LIBRARIES}
-    v-gears-data
-)
-
-target_link_libraries(DataPlugin ${LIBRARIES})
-
-if(NOT VGEARS_STATIC)
-    set_target_properties(DataPlugin PROPERTIES COMPILE_DEFINITIONS VGEARS_DATAPLUGIN_EXPORTS)
-    if(WIN32 OR APPLE)
-        install(TARGETS DataPlugin LIBRARY DESTINATION .)
-    else()
-        install(TARGETS DataPlugin LIBRARY DESTINATION ./lib/v-gears/plugins/ )
-    endif()
-endif()

+ 0 - 96
PlugIns/Data/include/VGearsDataPlugin.h

@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#pragma once
-
-#include <Ogre/OgrePlugin.h>
-
-#include "formats/field/BackgroundFileManager.h"
-#include "formats/field/PaletteFileManager.h"
-#include "formats/model/PFileManager.h"
-#include "formats/model/HRCFileManager.h"
-#include "formats/model/RSDFileManager.h"
-#include "formats/texture/TexCodec.h"
-
-namespace VGears {
-
-    /**
-     * Plugin instance for various FFVII Data Formats
-     */
-    class DataPlugin : public Ogre::Plugin{
-
-        public:
-
-            DataPlugin();
-
-            /**
-             * Retrieves the name fo the plugin.
-             */
-            const Ogre::String& getName() const;
-
-            /**
-             * Perform the plugin initial installation sequence.
-             */
-            void install();
-
-            /**
-             * Perform any tasks the plugin needs on system initialization.
-             */
-            void initialise();
-
-            /**
-             * Perform any tasks the plugin needs on system shut down.
-             */
-            void shutdown();
-
-            /**
-             * Perform the final plugin uninstallation sequence.
-             */
-            void uninstall();
-
-            /**
-             * The plugin name.
-             */
-            static const Ogre::String ms_plugin_name;
-
-        private:
-
-            /**
-             * The .P file manager.
-             */
-            PFileManager *p_manager_;
-
-            /**
-             * The HRC file manager.
-             */
-            HRCFileManager *hrc_manager_;
-
-            /**
-             * The RSD file manager.
-             */
-            RSDFileManager *rsd_manager_;
-
-            /**
-             * The palette file manager.
-             */
-            PaletteFileManager *palette_manager_;
-
-            /**
-             * The background file manager.
-             */
-            BackgroundFileManager *background_manager_;
-
-    };
-}

+ 0 - 4
PlugIns/Data/misc/VGearsData.def

@@ -1,4 +0,0 @@
-LIBRARY Plugin_Data
-EXPORTS	
-	dllStartPlugin
-	dllStopPlugin

+ 0 - 52
PlugIns/Data/src/VGearsDataPlugin.cpp

@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include "VGearsDataPlugin.h"
-#include "formats/texture/TexCodec.h"
-
-using Ogre::String;
-
-namespace VGears {
-
-    const String DataPlugin::ms_plugin_name(
-      "Plugin for Various FFVII File Formats"
-    );
-
-    DataPlugin::DataPlugin(){}
-
-    const String& DataPlugin::getName() const{return ms_plugin_name;}
-
-    void DataPlugin::install(){TexCodec::install();}
-
-    void DataPlugin::initialise(){
-        TexCodec::initialise();
-        p_manager_           = new PFileManager();
-        hrc_manager_         = new HRCFileManager();
-        rsd_manager_         = new RSDFileManager();
-        //palette_manager_     = new PaletteFileManager();
-        //background_manager_  = new BackgroundFileManager();
-    }
-
-    void DataPlugin::shutdown(){
-        TexCodec::shutdown();
-        delete p_manager_;
-        delete hrc_manager_;
-        delete rsd_manager_;
-        //delete palette_manager_;
-        //delete background_manager_;
-    }
-
-    void DataPlugin::uninstall(){TexCodec::uninstall();}
-}

+ 0 - 37
PlugIns/Data/src/VGearsDataPluginDll.cpp

@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <Ogre/OgreRoot.h>
-#include "VGearsDataPlugin.h"
-
-#ifndef VGEARS_STATIC_LIB
-
-namespace VGears{
-
-    DataPlugin* data_plugin(NULL);
-
-    extern "C" void _VGearsExport dllStartPlugin( void ){
-        data_plugin = new DataPlugin();
-        // Register.
-        Ogre::Root::getSingleton().installPlugin(data_plugin);
-    }
-    extern "C" void _VGearsExport dllStopPlugin( void ){
-        Ogre::Root::getSingleton().uninstallPlugin(data_plugin);
-        delete data_plugin;
-        data_plugin = NULL;
-    }
-}
-
-#endif

+ 0 - 143
PlugIns/Data/test/tex_file_info.cpp

@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <algorithm>
-#include <cstdio>
-#include <boost/algorithm/string/predicate.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
-#include <boost/program_options.hpp>
-#include <Ogre/OgreDataStream.h>
-#include "formats/texture/TexFile.h"
-
-using std::back_inserter;
-using std::copy;
-using std::cout;
-using std::ifstream;
-using std::endl;
-using std::vector;
-using std::string;
-
-namespace bfs = boost::filesystem;
-namespace bpo = boost::program_options;
-
-void pintFileInfo(const bfs::path &tex_path){
-    cout << endl << "TX Image File Info"
-      << endl << " filename: " << tex_path.filename().string();
-    bfs::ifstream *ifs(OGRE_NEW_T(bfs::ifstream, Ogre::MEMCATEGORY_GENERAL)(tex_path, bfs::ifstream::binary));
-    Ogre::FileStreamDataStream *stream(OGRE_NEW Ogre::FileStreamDataStream(ifs));
-    Ogre::DataStreamPtr input(stream);
-    VGears::TexFile tex;
-    tex.readHeader(input);
-    cout << endl << " size: "
-      << tex.m_header.image_data.width
-      << "x" << tex.m_header.image_data.height
-      << "x" << tex.m_header.image_data.bit_depth
-      << endl << " pitch: " << tex.m_header.image_data.pitch
-      << endl << " color_key_flag: " << tex.m_header.color_key_flag
-      << endl << "Palette:"
-      << endl << " type              : " << tex.m_header.palette_type
-      << endl << " count             : " << tex.m_header.palette_count
-      << endl << " index_bits        : "
-      << tex.m_header.palette_data.index_bits
-      << endl << " flag              : " << tex.m_header.palette_data.flag
-      << endl << " total_color_count : "
-      << tex.m_header.palette_total_color_count
-      << endl << " total_color_count : "
-      << tex.m_header.palette_data.total_color_count
-      << endl << " colors_per_palette: "
-      << tex.m_header.palette_data.colors_per_palette
-      << endl << " unknown_CC        : " << tex.m_header.unknown_0xCC;
-    if (tex.m_header.palette_data.flag){
-        cout << endl
-          << " mask_red   : " << tex.m_header.pixel_format.bit_mask.red
-          << endl << " mask_green : "
-          << tex.m_header.pixel_format.bit_mask.green
-          << endl << " mask_blue  : " << tex.m_header.pixel_format.bit_mask.blue
-          << endl << " mask_alpha : "
-          << tex.m_header.pixel_format.bit_mask.alpha;
-    }
-    cout << endl;
-}
-
-int main(int ac, char *av[]){
-    const char* PO_HELP("help");
-    const char* PO_INPUT_PATHS("input-paths");
-    const string TEX_EXT(".tex");
-
-    typedef vector<bfs::path> t_InputPaths;
-
-    try {
-        bpo::options_description generic("Generic options");
-        generic.add_options()
-            (PO_HELP, "produce help message")
-            ;
-
-        // Hidden options, will be allowed both on command line and
-        // in config file, but will not be shown to the user.
-        bpo::options_description hidden("Hidden options");
-        hidden.add_options()
-            (PO_INPUT_PATHS, bpo::value< t_InputPaths >()->required(), "input paths to files or directories")
-            ;
-
-        bpo::positional_options_description p;
-        p.add(PO_INPUT_PATHS, -1);
-
-        bpo::options_description cmdline_options;
-        cmdline_options.add(generic).add(hidden);
-        bpo::variables_map vm;
-        bpo::store(bpo::command_line_parser(ac, av).options(cmdline_options).positional(p).run(), vm);
-
-        if (vm.count(PO_HELP)){
-            bfs::path self(av[0]);
-            cout << "Usage: " << self.stem().string() << " [options] file|path...\n";
-            cout << generic << "\n";
-            return 0;
-        }
-
-        bpo::notify(vm);
-
-        if (vm.count(PO_INPUT_PATHS)){
-            t_InputPaths input(vm[ PO_INPUT_PATHS ].as< t_InputPaths >());
-            t_InputPaths paths;
-
-            for (t_InputPaths::const_iterator it(input.begin()); it != input.end(); ++it){
-                if(bfs::exists(*it)){
-                    if(bfs::is_directory(*it)){
-                        copy(bfs::recursive_directory_iterator(*it), bfs::recursive_directory_iterator(), back_inserter(paths));
-                    }
-                    else{
-                        paths.push_back(*it);
-                    }
-                }
-            }
-
-            for (t_InputPaths::const_iterator it(paths.begin()); it != paths.end(); ++it){
-                if(bfs::is_regular_file(*it)){
-                    string ext(it->extension().string());
-                    if(boost::iequals(ext, TEX_EXT)){
-                        pintFileInfo(*it);
-                    }
-                }
-            }
-        }
-
-    }
-    catch(const bfs::filesystem_error& e){
-        cout << e.what() << endl;
-        return 1;
-    }
-    return 0;
-}

+ 0 - 170
PlugIns/Data/test/tex_file_test.cpp

@@ -1,170 +0,0 @@
-/*
------------------------------------------------------------------------------
-The MIT License (MIT)
-
-Copyright (c) 2013-07-31 Tobias Peters <tobias.peters@kreativeffekt.at>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#include <fstream>
-
-#include <Ogre/OgreDataStream.h>
-
-#include "formats/texture/TexFile.h"
-
-#define BOOST_TEST_MODULE VGearsTexFile
-#include <boost/test/unit_test.hpp>
-
-BOOST_AUTO_TEST_CASE( header_size )
-{
-    BOOST_CHECK_EQUAL( 0x18, sizeof( VGears::TexFile::BitData     ) );
-    BOOST_CHECK_EQUAL( 0x10, sizeof( VGears::TexFile::ImageData   ) );
-    BOOST_CHECK_EQUAL( 0x14, sizeof( VGears::TexFile::PaletteData ) );
-    BOOST_CHECK_EQUAL( 0x10, sizeof( VGears::TexFile::RGBAData    ) );
-    BOOST_CHECK_EQUAL( 0x58, sizeof( VGears::TexFile::PixelFormat ) );
-    BOOST_CHECK_EQUAL( 0xEC, sizeof( VGears::TexFile::Header      ) );
-
-    VGears::TexFile::Header header;
-    BOOST_CHECK_EQUAL( sizeof( VGears::TexFile::Header ), sizeof( header ) );
-}
-
-BOOST_AUTO_TEST_CASE( bit_data_offset )
-{
-    BOOST_CHECK_EQUAL( 0x00, offsetof( VGears::TexFile::BitData, color_min ) );
-    BOOST_CHECK_EQUAL( 0x04, offsetof( VGears::TexFile::BitData, color_max ) );
-    BOOST_CHECK_EQUAL( 0x08, offsetof( VGears::TexFile::BitData, alpha_min ) );
-    BOOST_CHECK_EQUAL( 0x0C, offsetof( VGears::TexFile::BitData, alpha_max ) );
-    BOOST_CHECK_EQUAL( 0x10, offsetof( VGears::TexFile::BitData, pixel_min ) );
-    BOOST_CHECK_EQUAL( 0x14, offsetof( VGears::TexFile::BitData, pixel_max ) );
-}
-
-BOOST_AUTO_TEST_CASE( palette_data_offset )
-{
-    BOOST_CHECK_EQUAL( 0x00, offsetof( VGears::TexFile::PaletteData, flag        ) );
-    BOOST_CHECK_EQUAL( 0x04, offsetof( VGears::TexFile::PaletteData, index_bits  ) );
-    BOOST_CHECK_EQUAL( 0x08, offsetof( VGears::TexFile::PaletteData, index_8bit  ) );
-    BOOST_CHECK_EQUAL( 0x0C, offsetof( VGears::TexFile::PaletteData, total_color_count ) );
-    BOOST_CHECK_EQUAL( 0x10, offsetof( VGears::TexFile::PaletteData, colors_per_palette ) );
-}
-
-BOOST_AUTO_TEST_CASE( image_data_offset )
-{
-    BOOST_CHECK_EQUAL( 0x0, offsetof( VGears::TexFile::ImageData, bit_depth  ) );
-    BOOST_CHECK_EQUAL( 0x4, offsetof( VGears::TexFile::ImageData, width  ) );
-    BOOST_CHECK_EQUAL( 0x8, offsetof( VGears::TexFile::ImageData, height ) );
-    BOOST_CHECK_EQUAL( 0xC, offsetof( VGears::TexFile::ImageData, pitch  ) );
-}
-
-BOOST_AUTO_TEST_CASE( rgba_data_offset )
-{
-    BOOST_CHECK_EQUAL( 0x0, offsetof( VGears::TexFile::RGBAData, red   ) );
-    BOOST_CHECK_EQUAL( 0x4, offsetof( VGears::TexFile::RGBAData, green ) );
-    BOOST_CHECK_EQUAL( 0x8, offsetof( VGears::TexFile::RGBAData, blue  ) );
-    BOOST_CHECK_EQUAL( 0xC, offsetof( VGears::TexFile::RGBAData, alpha ) );
-}
-
-BOOST_AUTO_TEST_CASE( pixel_format_offset )
-{
-    BOOST_CHECK_EQUAL( 0x00, offsetof( VGears::TexFile::PixelFormat, bits_per_pixel   ) );
-    BOOST_CHECK_EQUAL( 0x04, offsetof( VGears::TexFile::PixelFormat, bytes_per_pixel  ) );
-    BOOST_CHECK_EQUAL( 0x08, offsetof( VGears::TexFile::PixelFormat, bit_count        ) );
-    BOOST_CHECK_EQUAL( 0x18, offsetof( VGears::TexFile::PixelFormat, bit_mask         ) );
-    BOOST_CHECK_EQUAL( 0x28, offsetof( VGears::TexFile::PixelFormat, bit_shift        ) );
-    BOOST_CHECK_EQUAL( 0x38, offsetof( VGears::TexFile::PixelFormat, bit_count_unused ) );
-    BOOST_CHECK_EQUAL( 0x48, offsetof( VGears::TexFile::PixelFormat, shades           ) );
-}
-
-BOOST_AUTO_TEST_CASE( header_offset )
-{
-    BOOST_CHECK_EQUAL( 0x00, offsetof( VGears::TexFile::Header, version              ) );
-    BOOST_CHECK_EQUAL( 0x08, offsetof( VGears::TexFile::Header, color_key_flag       ) );
-    BOOST_CHECK_EQUAL( 0x14, offsetof( VGears::TexFile::Header, bit_data             ) );
-    BOOST_CHECK_EQUAL( 0x30, offsetof( VGears::TexFile::Header, palette_count        ) );
-    BOOST_CHECK_EQUAL( 0x34, offsetof( VGears::TexFile::Header, palette_total_color_count  ) );
-    BOOST_CHECK_EQUAL( 0x38, offsetof( VGears::TexFile::Header, image_data           ) );
-    BOOST_CHECK_EQUAL( 0x4C, offsetof( VGears::TexFile::Header, palette_data         ) );
-    BOOST_CHECK_EQUAL( 0x64, offsetof( VGears::TexFile::Header, pixel_format         ) );
-    BOOST_CHECK_EQUAL( 0xBC, offsetof( VGears::TexFile::Header, color_key_array_flag ) );
-    BOOST_CHECK_EQUAL( 0xC4, offsetof( VGears::TexFile::Header, reference_alpha      ) );
-    BOOST_CHECK_EQUAL( 0xCC, offsetof( VGears::TexFile::Header, unknown_0xCC         ) );
-}
-
-BOOST_AUTO_TEST_CASE( color_offset )
-{
-    BOOST_CHECK_EQUAL( 0x0, offsetof( VGears::TexFile::Color, all        ) );
-    BOOST_CHECK_EQUAL( 0x0, offsetof( VGears::TexFile::Color, comp       ) );
-    BOOST_CHECK_EQUAL( 0x3, offsetof( VGears::TexFile::Color, comp.alpha ) );
-    BOOST_CHECK_EQUAL( 0x2, offsetof( VGears::TexFile::Color, comp.red   ) );
-    BOOST_CHECK_EQUAL( 0x1, offsetof( VGears::TexFile::Color, comp.green ) );
-    BOOST_CHECK_EQUAL( 0x0, offsetof( VGears::TexFile::Color, comp.blue  ) );
-}
-
-BOOST_AUTO_TEST_CASE( read_file )
-{
-    const char* file_name( "../../../../output/data_orig/menu/menu_gm/barre.tex" );
-    std::ifstream *ifs(  OGRE_NEW_T( std::ifstream, Ogre::MEMCATEGORY_GENERAL )( file_name, std::ifstream::binary ) );
-    BOOST_REQUIRE( ifs->is_open() );
-    Ogre::FileStreamDataStream *stream( OGRE_NEW Ogre::FileStreamDataStream( ifs ) );
-    Ogre::DataStreamPtr input( stream );
-
-    BOOST_REQUIRE( input->isReadable() );
-
-    VGears::TexFile tex;
-    tex.read( input );
-
-    BOOST_CHECK_EQUAL( 0x80, tex.m_header.image_data.width );
-    BOOST_CHECK_EQUAL( 0x80, tex.m_header.image_data.height );
-    BOOST_CHECK_EQUAL(    8, tex.m_header.image_data.bit_depth );
-
-    BOOST_CHECK_EQUAL(     1, tex.m_header.palette_count );
-    BOOST_CHECK_EQUAL(     1, tex.m_header.palette_data.flag );
-    BOOST_CHECK_EQUAL( 0x100, tex.m_header.palette_data.total_color_count );
-    BOOST_CHECK_EQUAL( 0x80 * 0x80, tex.m_image_data.size() );
-
-    for( size_t i(0); i < 39; ++i )
-    {
-        BOOST_TEST_MESSAGE( "checking color i: " << i );
-        BOOST_CHECK_EQUAL( 0xFFFFFFFF, tex.m_image_data[i].all );
-    }
-    BOOST_CHECK_EQUAL( 0xFFF6FFF6, tex.m_image_data[39].all );
-    BOOST_CHECK_EQUAL( 0xF6, tex.m_image_data[39].comp.red );
-    BOOST_CHECK_EQUAL( 0xFF, tex.m_image_data[39].comp.green );
-    BOOST_CHECK_EQUAL( 0xF6, tex.m_image_data[39].comp.blue );
-    BOOST_CHECK_EQUAL( 0xFF, tex.m_image_data[39].comp.alpha );
-
-    BOOST_CHECK_EQUAL( 0x7B, tex.m_image_data[40].comp.red );
-    BOOST_CHECK_EQUAL( 0xA4, tex.m_image_data[40].comp.green );
-    BOOST_CHECK_EQUAL( 0xA4, tex.m_image_data[40].comp.blue );
-    BOOST_CHECK_EQUAL( 0xFF, tex.m_image_data[40].comp.alpha );
-
-
-	Ogre::MemoryDataStreamPtr pixel_data( tex.getPixelData() );
-    BOOST_CHECK_EQUAL( tex.m_image_data.size() * 4, pixel_data->size() );
-
-	Ogre::SharedPtr<Ogre::ImageCodec::ImageData> img_data( tex.getImageData() );
-    BOOST_CHECK_EQUAL( img_data->width , tex.m_header.image_data.width );
-    BOOST_CHECK_EQUAL( img_data->height, tex.m_header.image_data.height );
-    BOOST_CHECK_EQUAL( Ogre::PF_A8R8G8B8, img_data->format );
-    BOOST_CHECK_EQUAL( 1, img_data->depth );
-    BOOST_CHECK_EQUAL( 0, img_data->flags );
-    BOOST_CHECK_EQUAL( 0, img_data->num_mipmaps );
-    BOOST_CHECK_EQUAL( pixel_data->size(), img_data->size );
-}

+ 0 - 1
data/plugins.cfg

@@ -17,5 +17,4 @@
 # Plugin=Plugin_PCZSceneManager
 # Plugin=Plugin_PCZSceneManager
 # Plugin=Plugin_OctreeZone
 # Plugin=Plugin_OctreeZone
 # Plugin=Plugin_OctreeSceneManager
 # Plugin=Plugin_OctreeSceneManager
-# Plugin=Plugin_Data
 Plugin=Codec_STBI
 Plugin=Codec_STBI

+ 0 - 1
data/plugins_d.cfg

@@ -18,5 +18,4 @@ Plugin=RenderSystem_GL
 # Plugin=Plugin_PCZSceneManager
 # Plugin=Plugin_PCZSceneManager
 # Plugin=Plugin_OctreeZone
 # Plugin=Plugin_OctreeZone
 # Plugin=Plugin_OctreeSceneManager
 # Plugin=Plugin_OctreeSceneManager
-#Plugin=Plugin_Data_d
 Plugin=Codec_STBI
 Plugin=Codec_STBI

+ 28 - 177
src/CMakeLists.txt

@@ -582,164 +582,6 @@ if(NOT OGRE_LIBRARIES MATCHES ".*OgreBites.*")
 endif()
 endif()
 
 
 
 
-# Source files for libvgears and v-gears.
-set(VGEARS_SOURCE_FILES
-    app/main.cpp
-    common/FF7Character.cpp
-    common/FF7Common.cpp
-    engine/GameState.cpp
-    common/File.cpp
-    common/FileSystem.cpp
-    formats/FF7NameLookup.cpp
-    common/LzsFile.cpp
-    common/TypeDefine.cpp
-    common/DataDirectory.cpp
-    common/InstallStamp.cpp
-    common/OgrePlugins.cpp
-    app/Application.cpp
-    common/ManualObject.cpp
-    common/Resource.cpp
-    common/StringUtil.cpp
-    engine/audio/AudioManager.cpp
-    engine/graphics/Background2DAnimation.cpp
-    engine/graphics/Background2D.cpp
-    engine/graphics/BackgroundPalette.cpp
-    engine/graphics/ScreenFade.cpp
-    engine/graphics/MovieCameraFrame.cpp
-    engine/graphics/MoviePlayer.cpp
-    engine/graphics/MovieState.cpp
-    engine/graphics/ScreenFadeState.cpp
-    modules/battle/BattleBinds.cpp
-    modules/battle/BattleManager.cpp
-    engine/graphics/CameraManager.cpp
-    engine/config/ConfigCmd.cpp
-    engine/config/ConfigCmdHandler.cpp
-    engine/config/ConfigFile.cpp
-    engine/config/ConfigVar.cpp
-    engine/config/ConfigVarHandler.cpp
-    engine/ui/Console.cpp
-    engine/graphics/DebugDraw.cpp
-    engine/ui/DialogsManager.cpp
-    modules/battle/Enemy.cpp
-    engine/entity/EntityCollision.cpp
-    engine/entity/Entity.cpp
-    engine/entity/EntityDirection.cpp
-    engine/entity/EntityManager.cpp
-    engine/entity/EntityModel.cpp
-    engine/entity/EntityPoint.cpp
-    engine/entity/EntityTrigger.cpp
-    app/GameFrameListener.cpp
-    engine/input/InputManager.cpp
-    engine/Manager.cpp
-    engine/particles/Particle.cpp
-    engine/particles/ParticleEmitter.cpp
-    engine/particles/ParticleEmitterDictionary.cpp
-    engine/particles/ParticleEmitterTranslator.cpp
-    engine/particles/ParticleRenderer.cpp
-    engine/particles/ParticleRendererTranslator.cpp
-    engine/particles/ParticleSystem.cpp
-    engine/particles/ParticleSystemFactory.cpp
-    engine/particles/ParticleSystemManager.cpp
-    engine/particles/ParticleSystemTranslator.cpp
-    engine/particles/ParticleSystemTranslatorManager.cpp
-    engine/particles/ParticleTechnique.cpp
-    engine/particles/ParticleTechniqueTranslator.cpp
-    engine/particles/ParticleVisual.cpp
-    engine/particles/emitters/PointEmitter.cpp
-    engine/particles/emitters/PointEmitterFactory.cpp
-    engine/particles/renderer/ParticleEntityRenderer.cpp
-    engine/particles/renderer/ParticleEntityRendererDictionary.cpp
-    engine/save/Savemap.cpp
-    engine/save/SavemapHandler.cpp
-    engine/script/ScriptManager.cpp
-    engine/ui/TextHandler.cpp
-    engine/Timer.cpp
-    engine/ui/UiAnimation.cpp
-    engine/ui/UiFont.cpp
-    engine/ui/UiManager.cpp
-    engine/ui/UiSprite.cpp
-    engine/ui/UiTextArea.cpp
-    engine/ui/UiWidget.cpp
-    common/Utilities.cpp
-    engine/entity/Walkmesh.cpp
-    modules/worldmap/WorldMapManager.cpp
-    engine/xml/XmlAttackFile.cpp
-    engine/xml/XmlBackground2DFile.cpp
-    engine/xml/XmlBattleCharactersFile.cpp
-    engine/xml/XmlBattleScenesFile.cpp
-    modules/battle/XmlEnemyFile.cpp
-    common/XmlFile.cpp
-    engine/xml/XmlFontFile.cpp
-    engine/xml/XmlFontsFile.cpp
-    modules/battle/XmlFormationFile.cpp
-    engine/xml/XmlMapFile.cpp
-    engine/xml/XmlMapsFile.cpp
-    engine/xml/XmlMusicsFile.cpp
-    engine/xml/XmlPrototypesFile.cpp
-    engine/xml/XmlScreenFile.cpp
-    engine/xml/XmlScreensFile.cpp
-    engine/xml/XmlScriptsFile.cpp
-    engine/xml/XmlSoundsFile.cpp
-    engine/xml/XmlTextFile.cpp
-    engine/xml/XmlTextsFile.cpp
-    engine/xml/XmlWalkmeshFile.cpp
-    formats/model/AFile.cpp
-    formats/model/AFileManager.cpp
-    formats/model/AFileSerializer.cpp
-    formats/field/BackgroundFile.cpp
-    formats/field/BackgroundFileManager.cpp
-    formats/field/BackgroundFileSerializer.cpp
-    formats/field/CameraMatrixFile.cpp
-    formats/field/CameraMatrixFileManager.cpp
-    formats/field/CameraMatrixFileSerializer.cpp
-    formats/field/FLevelBackground2DLoader.cpp
-    formats/field/FLevelFile.cpp
-    formats/field/FLevelFileSerializer.cpp
-    formats/field/FLevelTextureLoader.cpp
-    formats/model/HRCFile.cpp
-    formats/model/HRCFileManager.cpp
-    formats/model/HRCFileSerializer.cpp
-    formats/model/HRCMeshLoader.cpp
-    formats/model/HRCSkeletonLoader.cpp
-    formats/lgp/LGPArchive.cpp
-    formats/lgp/LGPArchiveFactory.cpp
-    formats/lgp/LGPArchiveSerializer.cpp
-    formats/LZSDataStream.cpp
-    formats/field/LZSFLevelFile.cpp
-    formats/field/LZSFLevelFileManager.cpp
-    formats/field/MapListFile.cpp
-    formats/field/PaletteFile.cpp
-    formats/field/PaletteFileManager.cpp
-    formats/field/PaletteFileSerializer.cpp
-    formats/model/PFile.cpp
-    formats/model/PFileManager.cpp
-    formats/model/PFileSerializer.cpp
-    formats/model/RSDFile.cpp
-    formats/model/RSDFileManager.cpp
-    formats/model/RSDFileSerializer.cpp
-    formats/Serializer.cpp
-    formats/texture/TexCodec.cpp
-    formats/texture/TexFile.cpp
-    formats/field/TriggersFile.cpp
-    formats/XMLSerializer.cpp
-    formats/model/FF7ModelListFile.cpp
-    formats/model/FF7ModelListFileManager.cpp
-    formats/model/FF7ModelListFileSerializer.cpp
-    formats/worldmap/WorldmapFile.cpp
-    formats/worldmap/WorldmapFileManager.cpp
-    formats/worldmap/WorldmapFileSerializer.cpp
-    formats/worldmap/TxzFile.cpp
-    formats/worldmap/TxzFileSerializer.cpp
-    formats/field/Background2DFile.cpp
-    formats/field/Background2DFileManager.cpp
-    formats/field/Background2DFileXMLSerializer.cpp
-    formats/field/WalkmeshFile.cpp
-    formats/field/WalkmeshFileManager.cpp
-    formats/field/WalkmeshFileXMLSerializer.cpp
-    formats/field/FF7WalkmeshFileSerializer.cpp
-    modules/worldmap/WorldmapBinds.cpp
-    modules/worldmap/WorldmapModule.cpp
-)
 endif()
 endif()
 
 
 # Compiler options.
 # Compiler options.
@@ -771,12 +613,34 @@ endif()
 # Prefer target-level compile definitions and options below (kept conservative).
 # Prefer target-level compile definitions and options below (kept conservative).
 
 
 
 
-# Generate libvgears.
-if(NOT VGEARS_SOURCE_FILES)
-    file(GLOB_RECURSE VGEARS_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
-    list(LENGTH VGEARS_SOURCE_FILES _vgears_auto_count)
-    message(STATUS "Auto-collected VGEARS_SOURCE_FILES count: ${_vgears_auto_count}")
-endif()
+# Source files. Each folder lists its own in its CMakeLists.txt, with this function. They are collected in a global
+# property, as paths relative to this directory.
+function(vgears_sources)
+    foreach(_source IN LISTS ARGN)
+        file(RELATIVE_PATH _path "${PROJECT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/${_source}")
+        set_property(GLOBAL APPEND PROPERTY VGEARS_SOURCES "${_path}")
+    endforeach()
+endfunction()
+
+add_subdirectory(app)
+add_subdirectory(common)
+add_subdirectory(engine)
+add_subdirectory(formats)
+add_subdirectory(modules)
+# The folders of the installer. Its target is defined later, in installer/CMakeLists.txt.
+add_subdirectory(installer/cli)
+add_subdirectory(installer/decompiler)
+add_subdirectory(installer/extractors)
+add_subdirectory(installer/formats)
+add_subdirectory(installer/gui)
+add_subdirectory(installer/steps)
+add_subdirectory(installer/support)
+vgears_sources(installer/main.cpp)
+
+# libvgears has every source, and the game all of them but the ones of the installer. The list is sorted, so the link
+# order doesn't depend on the order of the folders.
+get_property(VGEARS_SOURCE_FILES GLOBAL PROPERTY VGEARS_SOURCES)
+list(SORT VGEARS_SOURCE_FILES)
 
 
 # If installer is disabled, remove installer sources from the collected list
 # If installer is disabled, remove installer sources from the collected list
 if(NOT BUILD_INSTALLER)
 if(NOT BUILD_INSTALLER)
@@ -824,19 +688,6 @@ if(QT_UIC_EXECUTABLE AND EXISTS "${_ui_src}")
     set(_GENERATED_UI_TARGET generate_ui_files)
     set(_GENERATED_UI_TARGET generate_ui_files)
 endif()
 endif()
 
 
-# Exclude unit tests under installer/decompiler/test from the main
-# library to avoid pulling test-only dependencies (gtest/gmock).
-set(_test_removed_count 0)
-foreach(_f IN LISTS VGEARS_SOURCE_FILES)
-    if(_f MATCHES "installer/decompiler/test/")
-        list(REMOVE_ITEM VGEARS_SOURCE_FILES ${_f})
-        math(EXPR _test_removed_count "${_test_removed_count} + 1")
-    endif()
-endforeach()
-if(_test_removed_count GREATER 0)
-    message(STATUS "Removed ${_test_removed_count} decompiler test source(s) from libvgears")
-endif()
-
 # Directory with the system's Ogre plugins (RenderSystem_GL, Codec_STBI...). V-Gears looks for the plugins listed in
 # Directory with the system's Ogre plugins (RenderSystem_GL, Codec_STBI...). V-Gears looks for the plugins listed in
 # plugins.cfg there after the data directory and the directory of the executable (see common/OgrePlugins.h).
 # plugins.cfg there after the data directory and the directory of the executable (see common/OgrePlugins.h).
 # Packagers can set it, for example -DVGEARS_OGRE_PLUGIN_DIR=/usr/lib/x86_64-linux-gnu/OGRE.
 # Packagers can set it, for example -DVGEARS_OGRE_PLUGIN_DIR=/usr/lib/x86_64-linux-gnu/OGRE.

+ 6 - 0
src/app/CMakeLists.txt

@@ -0,0 +1,6 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Application.cpp
+    GameFrameListener.cpp
+    main.cpp
+)

+ 17 - 0
src/common/CMakeLists.txt

@@ -0,0 +1,17 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    DataDirectory.cpp
+    FF7Character.cpp
+    FF7Common.cpp
+    File.cpp
+    FileSystem.cpp
+    InstallStamp.cpp
+    LzsFile.cpp
+    ManualObject.cpp
+    OgrePlugins.cpp
+    Resource.cpp
+    StringUtil.cpp
+    TypeDefine.cpp
+    Utilities.cpp
+    XmlFile.cpp
+)

+ 17 - 0
src/engine/CMakeLists.txt

@@ -0,0 +1,17 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    GameState.cpp
+    Manager.cpp
+    Timer.cpp
+)
+
+add_subdirectory(audio)
+add_subdirectory(config)
+add_subdirectory(entity)
+add_subdirectory(graphics)
+add_subdirectory(input)
+add_subdirectory(particles)
+add_subdirectory(save)
+add_subdirectory(script)
+add_subdirectory(ui)
+add_subdirectory(xml)

+ 4 - 0
src/engine/audio/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    AudioManager.cpp
+)

+ 8 - 0
src/engine/config/CMakeLists.txt

@@ -0,0 +1,8 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    ConfigCmd.cpp
+    ConfigCmdHandler.cpp
+    ConfigFile.cpp
+    ConfigVar.cpp
+    ConfigVarHandler.cpp
+)

+ 11 - 0
src/engine/entity/CMakeLists.txt

@@ -0,0 +1,11 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Entity.cpp
+    EntityCollision.cpp
+    EntityDirection.cpp
+    EntityManager.cpp
+    EntityModel.cpp
+    EntityPoint.cpp
+    EntityTrigger.cpp
+    Walkmesh.cpp
+)

+ 13 - 0
src/engine/graphics/CMakeLists.txt

@@ -0,0 +1,13 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Background2D.cpp
+    Background2DAnimation.cpp
+    BackgroundPalette.cpp
+    CameraManager.cpp
+    DebugDraw.cpp
+    MovieCameraFrame.cpp
+    MoviePlayer.cpp
+    MovieState.cpp
+    ScreenFade.cpp
+    ScreenFadeState.cpp
+)

+ 4 - 0
src/engine/input/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    InputManager.cpp
+)

+ 20 - 0
src/engine/particles/CMakeLists.txt

@@ -0,0 +1,20 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Particle.cpp
+    ParticleEmitter.cpp
+    ParticleEmitterDictionary.cpp
+    ParticleEmitterTranslator.cpp
+    ParticleRenderer.cpp
+    ParticleRendererTranslator.cpp
+    ParticleSystem.cpp
+    ParticleSystemFactory.cpp
+    ParticleSystemManager.cpp
+    ParticleSystemTranslator.cpp
+    ParticleSystemTranslatorManager.cpp
+    ParticleTechnique.cpp
+    ParticleTechniqueTranslator.cpp
+    ParticleVisual.cpp
+)
+
+add_subdirectory(emitters)
+add_subdirectory(renderer)

+ 5 - 0
src/engine/particles/emitters/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    PointEmitter.cpp
+    PointEmitterFactory.cpp
+)

+ 5 - 0
src/engine/particles/renderer/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    ParticleEntityRenderer.cpp
+    ParticleEntityRendererDictionary.cpp
+)

+ 5 - 0
src/engine/save/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Savemap.cpp
+    SavemapHandler.cpp
+)

+ 4 - 0
src/engine/script/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    ScriptManager.cpp
+)

+ 12 - 0
src/engine/ui/CMakeLists.txt

@@ -0,0 +1,12 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Console.cpp
+    DialogsManager.cpp
+    TextHandler.cpp
+    UiAnimation.cpp
+    UiFont.cpp
+    UiManager.cpp
+    UiSprite.cpp
+    UiTextArea.cpp
+    UiWidget.cpp
+)

+ 20 - 0
src/engine/xml/CMakeLists.txt

@@ -0,0 +1,20 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    XmlAttackFile.cpp
+    XmlBackground2DFile.cpp
+    XmlBattleCharactersFile.cpp
+    XmlBattleScenesFile.cpp
+    XmlFontFile.cpp
+    XmlFontsFile.cpp
+    XmlMapFile.cpp
+    XmlMapsFile.cpp
+    XmlMusicsFile.cpp
+    XmlPrototypesFile.cpp
+    XmlScreenFile.cpp
+    XmlScreensFile.cpp
+    XmlScriptsFile.cpp
+    XmlSoundsFile.cpp
+    XmlTextFile.cpp
+    XmlTextsFile.cpp
+    XmlWalkmeshFile.cpp
+)

+ 13 - 0
src/formats/CMakeLists.txt

@@ -0,0 +1,13 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    FF7NameLookup.cpp
+    LZSDataStream.cpp
+    Serializer.cpp
+    XMLSerializer.cpp
+)
+
+add_subdirectory(field)
+add_subdirectory(lgp)
+add_subdirectory(model)
+add_subdirectory(texture)
+add_subdirectory(worldmap)

+ 27 - 0
src/formats/field/CMakeLists.txt

@@ -0,0 +1,27 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    Background2DFile.cpp
+    Background2DFileManager.cpp
+    Background2DFileXMLSerializer.cpp
+    BackgroundFile.cpp
+    BackgroundFileManager.cpp
+    BackgroundFileSerializer.cpp
+    CameraMatrixFile.cpp
+    CameraMatrixFileManager.cpp
+    CameraMatrixFileSerializer.cpp
+    FF7WalkmeshFileSerializer.cpp
+    FLevelBackground2DLoader.cpp
+    FLevelFile.cpp
+    FLevelFileSerializer.cpp
+    FLevelTextureLoader.cpp
+    LZSFLevelFile.cpp
+    LZSFLevelFileManager.cpp
+    MapListFile.cpp
+    PaletteFile.cpp
+    PaletteFileManager.cpp
+    PaletteFileSerializer.cpp
+    TriggersFile.cpp
+    WalkmeshFile.cpp
+    WalkmeshFileManager.cpp
+    WalkmeshFileXMLSerializer.cpp
+)

+ 6 - 0
src/formats/lgp/CMakeLists.txt

@@ -0,0 +1,6 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    LGPArchive.cpp
+    LGPArchiveFactory.cpp
+    LGPArchiveSerializer.cpp
+)

+ 20 - 0
src/formats/model/CMakeLists.txt

@@ -0,0 +1,20 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    AFile.cpp
+    AFileManager.cpp
+    AFileSerializer.cpp
+    FF7ModelListFile.cpp
+    FF7ModelListFileManager.cpp
+    FF7ModelListFileSerializer.cpp
+    HRCFile.cpp
+    HRCFileManager.cpp
+    HRCFileSerializer.cpp
+    HRCMeshLoader.cpp
+    HRCSkeletonLoader.cpp
+    PFile.cpp
+    PFileManager.cpp
+    PFileSerializer.cpp
+    RSDFile.cpp
+    RSDFileManager.cpp
+    RSDFileSerializer.cpp
+)

+ 5 - 0
src/formats/texture/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    TexCodec.cpp
+    TexFile.cpp
+)

+ 8 - 0
src/formats/worldmap/CMakeLists.txt

@@ -0,0 +1,8 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    TxzFile.cpp
+    TxzFileSerializer.cpp
+    WorldmapFile.cpp
+    WorldmapFileManager.cpp
+    WorldmapFileSerializer.cpp
+)

+ 5 - 87
src/installer/CMakeLists.txt

@@ -4,93 +4,11 @@ find_package(ZLIB REQUIRED)
 find_package(Qt5 COMPONENTS Widgets REQUIRED)
 find_package(Qt5 COMPONENTS Widgets REQUIRED)
 find_package(Qt5 COMPONENTS Core REQUIRED)
 find_package(Qt5 COMPONENTS Core REQUIRED)
 
 
-# Source files for the installer.
-set(INSTALLER_SOURCE_FILES
-    main.cpp
-    extractors/BattleDataInstaller.cpp
-    cli/CliInstaller.cpp
-    steps/DataInstaller.cpp
-    formats/DiskImage.cpp
-    extractors/FieldDataInstaller.cpp
-    extractors/FieldTextWriter.cpp
-    cli/InstallCommandLine.cpp
-    steps/InstallLayout.cpp
-    steps/InstallLog.cpp
-    steps/InstallOptions.cpp
-    steps/InstallSteps.cpp
-    steps/ExternalTools.cpp
-    steps/InstallVerifier.cpp
-    steps/VideoFiles.cpp
-    extractors/MovieCamera.cpp
-    extractors/KernelDataInstaller.cpp
-    gui/MainWindow.cpp
-    extractors/MediaDataInstaller.cpp
-    extractors/ModelsAndAnimationsDb.cpp
-    extractors/ScopedLgp.cpp
-    formats/TexFile.cpp
-    support/Utility.cpp
-    extractors/WindowFonts.cpp
-    extractors/WorldInstaller.cpp
-    formats/BinGZipFile.cpp
-    support/DrawSkeleton.cpp
-    support/Logger.cpp
-    support/OgreBase.cpp
-    support/OgreGenUtilities.cpp
-    support/Vram.cpp
-    formats/AbFile.cpp
-    formats/BattleSceneFile.cpp
-    formats/DaFile.cpp
-    formats/WorldMapWalkmesh.cpp
-    decompiler/CodeGenerator.cpp
-    decompiler/ControlFlow.cpp
-    decompiler/DecompilerException.cpp
-    decompiler/Disassembler.cpp
-    decompiler/Engine.cpp
-    decompiler/field/FieldCodeGenerator.cpp
-    decompiler/field/FieldDecompiler.cpp
-    decompiler/field/FieldDisassembler.cpp
-    decompiler/field/FieldEngine.cpp
-    decompiler/field/FieldScriptFormatter.cpp
-    decompiler/field/instruction/FieldBackgroundInstruction.cpp
-    decompiler/field/instruction/FieldCameraInstruction.cpp
-    decompiler/field/instruction/FieldCondJumpInstruction.cpp
-    decompiler/field/instruction/FieldControlFlowInstruction.cpp
-    decompiler/field/instruction/FieldMathInstruction.cpp
-    decompiler/field/instruction/FieldMediaInstruction.cpp
-    decompiler/field/instruction/FieldModelInstruction.cpp
-    decompiler/field/instruction/FieldModuleInstruction.cpp
-    decompiler/field/instruction/FieldNoOperationInstruction.cpp
-    decompiler/field/instruction/FieldPartyInstruction.cpp
-    decompiler/field/instruction/FieldUncategorizedInstruction.cpp
-    decompiler/field/instruction/FieldUncondJumpInstruction.cpp
-    decompiler/field/instruction/FieldWalkmeshInstruction.cpp
-    decompiler/field/instruction/FieldWindowInstruction.cpp
-    decompiler/Graph.cpp
-    decompiler/instruction/BinaryOpStackInstruction.cpp
-    decompiler/instruction/CondJumpInstruction.cpp
-    decompiler/instruction/Instruction.cpp
-    decompiler/instruction/KernelCallInstruction.cpp
-    decompiler/instruction/LoadInstruction.cpp
-    decompiler/instruction/StackInstruction.cpp
-    decompiler/instruction/StoreInstruction.cpp
-    decompiler/instruction/UncondJumpInstruction.cpp
-    decompiler/LuaLanguage.cpp
-    decompiler/ScriptFormatter.cpp
-    decompiler/Value.cpp
-    decompiler/world/instruction/WorldBinaryEqualStackInstruction.cpp
-    decompiler/world/instruction/WorldCondJumpInstruction.cpp
-    decompiler/world/instruction/WorldKernelCallInstruction.cpp
-    decompiler/world/instruction/WorldLoadBankInstruction.cpp
-    decompiler/world/instruction/WorldLoadInstruction.cpp
-    decompiler/world/instruction/WorldNoOutputInstruction.cpp
-    decompiler/world/instruction/WorldStackInstruction.cpp
-    decompiler/world/instruction/WorldStoreInstruction.cpp
-    decompiler/world/instruction/WorldSubStackInstruction.cpp
-    decompiler/world/instruction/WorldUncondJumpInstruction.cpp
-    decompiler/world/WorldCodeGenerator.cpp
-    decompiler/world/WorldDisassembler.cpp
-    decompiler/world/WorldEngine.cpp
-)
+# Source files for the installer: the ones its folders listed (see vgears_sources in src/CMakeLists.txt).
+get_property(INSTALLER_SOURCE_FILES GLOBAL PROPERTY VGEARS_SOURCES)
+list(FILTER INSTALLER_SOURCE_FILES INCLUDE REGEX "^installer/.*\\.cpp$")
+list(TRANSFORM INSTALLER_SOURCE_FILES REPLACE "^installer/" "")
+list(SORT INSTALLER_SOURCE_FILES)
 
 
 # Included directories for the installer.
 # Included directories for the installer.
 include_directories (
 include_directories (

+ 5 - 0
src/installer/cli/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    CliInstaller.cpp
+    InstallCommandLine.cpp
+)

+ 16 - 0
src/installer/decompiler/CMakeLists.txt

@@ -0,0 +1,16 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    CodeGenerator.cpp
+    ControlFlow.cpp
+    DecompilerException.cpp
+    Disassembler.cpp
+    Engine.cpp
+    Graph.cpp
+    LuaLanguage.cpp
+    ScriptFormatter.cpp
+    Value.cpp
+)
+
+add_subdirectory(field)
+add_subdirectory(instruction)
+add_subdirectory(world)

+ 10 - 0
src/installer/decompiler/field/CMakeLists.txt

@@ -0,0 +1,10 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    FieldCodeGenerator.cpp
+    FieldDecompiler.cpp
+    FieldDisassembler.cpp
+    FieldEngine.cpp
+    FieldScriptFormatter.cpp
+)
+
+add_subdirectory(instruction)

+ 17 - 0
src/installer/decompiler/field/instruction/CMakeLists.txt

@@ -0,0 +1,17 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    FieldBackgroundInstruction.cpp
+    FieldCameraInstruction.cpp
+    FieldCondJumpInstruction.cpp
+    FieldControlFlowInstruction.cpp
+    FieldMathInstruction.cpp
+    FieldMediaInstruction.cpp
+    FieldModelInstruction.cpp
+    FieldModuleInstruction.cpp
+    FieldNoOperationInstruction.cpp
+    FieldPartyInstruction.cpp
+    FieldUncategorizedInstruction.cpp
+    FieldUncondJumpInstruction.cpp
+    FieldWalkmeshInstruction.cpp
+    FieldWindowInstruction.cpp
+)

+ 11 - 0
src/installer/decompiler/instruction/CMakeLists.txt

@@ -0,0 +1,11 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    BinaryOpStackInstruction.cpp
+    CondJumpInstruction.cpp
+    Instruction.cpp
+    KernelCallInstruction.cpp
+    LoadInstruction.cpp
+    StackInstruction.cpp
+    StoreInstruction.cpp
+    UncondJumpInstruction.cpp
+)

+ 8 - 0
src/installer/decompiler/world/CMakeLists.txt

@@ -0,0 +1,8 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    WorldCodeGenerator.cpp
+    WorldDisassembler.cpp
+    WorldEngine.cpp
+)
+
+add_subdirectory(instruction)

+ 13 - 0
src/installer/decompiler/world/instruction/CMakeLists.txt

@@ -0,0 +1,13 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    WorldBinaryEqualStackInstruction.cpp
+    WorldCondJumpInstruction.cpp
+    WorldKernelCallInstruction.cpp
+    WorldLoadBankInstruction.cpp
+    WorldLoadInstruction.cpp
+    WorldNoOutputInstruction.cpp
+    WorldStackInstruction.cpp
+    WorldStoreInstruction.cpp
+    WorldSubStackInstruction.cpp
+    WorldUncondJumpInstruction.cpp
+)

+ 13 - 0
src/installer/extractors/CMakeLists.txt

@@ -0,0 +1,13 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    BattleDataInstaller.cpp
+    FieldDataInstaller.cpp
+    FieldTextWriter.cpp
+    KernelDataInstaller.cpp
+    MediaDataInstaller.cpp
+    ModelsAndAnimationsDb.cpp
+    MovieCamera.cpp
+    ScopedLgp.cpp
+    WindowFonts.cpp
+    WorldInstaller.cpp
+)

+ 10 - 0
src/installer/formats/CMakeLists.txt

@@ -0,0 +1,10 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    AbFile.cpp
+    BattleSceneFile.cpp
+    BinGZipFile.cpp
+    DaFile.cpp
+    DiskImage.cpp
+    TexFile.cpp
+    WorldMapWalkmesh.cpp
+)

+ 4 - 0
src/installer/gui/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    MainWindow.cpp
+)

+ 11 - 0
src/installer/steps/CMakeLists.txt

@@ -0,0 +1,11 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    DataInstaller.cpp
+    ExternalTools.cpp
+    InstallLayout.cpp
+    InstallLog.cpp
+    InstallOptions.cpp
+    InstallSteps.cpp
+    InstallVerifier.cpp
+    VideoFiles.cpp
+)

+ 9 - 0
src/installer/support/CMakeLists.txt

@@ -0,0 +1,9 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    DrawSkeleton.cpp
+    Logger.cpp
+    OgreBase.cpp
+    OgreGenUtilities.cpp
+    Utility.cpp
+    Vram.cpp
+)

+ 3 - 0
src/modules/CMakeLists.txt

@@ -0,0 +1,3 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+add_subdirectory(battle)
+add_subdirectory(worldmap)

+ 8 - 0
src/modules/battle/CMakeLists.txt

@@ -0,0 +1,8 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    BattleBinds.cpp
+    BattleManager.cpp
+    Enemy.cpp
+    XmlEnemyFile.cpp
+    XmlFormationFile.cpp
+)

+ 6 - 0
src/modules/worldmap/CMakeLists.txt

@@ -0,0 +1,6 @@
+# Sources of this folder (see vgears_sources in src/CMakeLists.txt).
+vgears_sources(
+    WorldMapManager.cpp
+    WorldmapBinds.cpp
+    WorldmapModule.cpp
+)

+ 27 - 25
test/CMakeLists.txt

@@ -27,29 +27,34 @@ include_directories(
 )
 )
 
 
 
 
-# Test source files.
-set(SOURCE_FILES
-    main.cpp
-    formats/model/AFile.cpp
-    formats/worldmap/MapFileSerializer.cpp
-    engine/graphics/MovieCameraFrame.cpp
-    engine/graphics/MovieState.cpp
-    engine/graphics/ScreenFadeState.cpp
-    engine/entity/EntityManager.cpp
-    engine/entity/EntityPoint.cpp
-    engine/ui/TextHandler.cpp
-    installer/extractors/FieldDataInstaller.cpp
-    installer/extractors/SfxDump.cpp
-    installer/extractors/WindowFonts.cpp
-    installer/decompiler/field/FieldCodeGenerator.cpp
-    installer/decompiler/field/FieldDecompiler.cpp
-    installer/decompiler/world/WorldDisassembler.cpp
-    installer/decompiler/world/instruction/WorldSubStackInstruction.cpp
-)
+# Test source files. Each folder lists its own in its CMakeLists.txt, with one of these functions: vgears_tests for
+# the main test program, and vgears_installer_tests for the one of the installer logic.
+function(vgears_collect_tests property)
+    foreach(_source IN LISTS ARGN)
+        file(RELATIVE_PATH _path "${PROJECT_SOURCE_DIR}/test" "${CMAKE_CURRENT_SOURCE_DIR}/${_source}")
+        set_property(GLOBAL APPEND PROPERTY ${property} "${_path}")
+    endforeach()
+endfunction()
+function(vgears_tests)
+    vgears_collect_tests(VGEARS_TESTS ${ARGN})
+endfunction()
+function(vgears_installer_tests)
+    vgears_collect_tests(VGEARS_INSTALLER_TESTS ${ARGN})
+endfunction()
+
+add_subdirectory(common)
+add_subdirectory(engine)
+add_subdirectory(formats)
+add_subdirectory(installer)
+
+get_property(TEST_SOURCE_FILES GLOBAL PROPERTY VGEARS_TESTS)
+list(SORT TEST_SOURCE_FILES)
+get_property(INSTALLER_TEST_SOURCE_FILES GLOBAL PROPERTY VGEARS_INSTALLER_TESTS)
+list(SORT INSTALLER_TEST_SOURCE_FILES)
 
 
 
 
 # Generate tests
 # Generate tests
-add_executable(v-gears-tests ${SOURCE_FILES})
+add_executable(v-gears-tests main.cpp ${TEST_SOURCE_FILES})
 SET_PROPERTY(TARGET v-gears-tests PROPERTY FOLDER "build/v-gears-test")
 SET_PROPERTY(TARGET v-gears-tests PROPERTY FOLDER "build/v-gears-test")
 
 
 # Qt imported targets are directory-scoped: the ones created in src/ are not
 # Qt imported targets are directory-scoped: the ones created in src/ are not
@@ -82,14 +87,11 @@ add_test(NAME v-gears-tests COMMAND v-gears-tests)
 # Tests of the installer logic that doesn't need the rest of the engine (layout, option rules, verifier, log), and of
 # Tests of the installer logic that doesn't need the rest of the engine (layout, option rules, verifier, log), and of
 # the data directory lookup shared by the game and the installer.
 # the data directory lookup shared by the game and the installer.
 add_executable(v-gears-installer-tests
 add_executable(v-gears-installer-tests
-    common/DataDirectory.cpp
-    common/OgrePlugins.cpp
+    ${INSTALLER_TEST_SOURCE_FILES}
+    # The code under test, which is built again here so these tests don't need the whole engine.
     ${CMAKE_SOURCE_DIR}/src/common/DataDirectory.cpp
     ${CMAKE_SOURCE_DIR}/src/common/DataDirectory.cpp
     ${CMAKE_SOURCE_DIR}/src/common/InstallStamp.cpp
     ${CMAKE_SOURCE_DIR}/src/common/InstallStamp.cpp
     ${CMAKE_SOURCE_DIR}/src/common/OgrePlugins.cpp
     ${CMAKE_SOURCE_DIR}/src/common/OgrePlugins.cpp
-    installer/steps/InstallLogic.cpp
-    installer/steps/ExternalTools.cpp
-    installer/extractors/MovieCamera.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/extractors/MovieCamera.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/extractors/MovieCamera.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/steps/ExternalTools.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/steps/ExternalTools.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/cli/InstallCommandLine.cpp
     ${CMAKE_SOURCE_DIR}/src/installer/cli/InstallCommandLine.cpp

+ 5 - 0
test/common/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_installer_tests(
+    DataDirectory.cpp
+    OgrePlugins.cpp
+)

+ 4 - 0
test/engine/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+add_subdirectory(entity)
+add_subdirectory(graphics)
+add_subdirectory(ui)

+ 5 - 0
test/engine/entity/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    EntityManager.cpp
+    EntityPoint.cpp
+)

+ 6 - 0
test/engine/graphics/CMakeLists.txt

@@ -0,0 +1,6 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    MovieCameraFrame.cpp
+    MovieState.cpp
+    ScreenFadeState.cpp
+)

+ 4 - 0
test/engine/ui/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    TextHandler.cpp
+)

+ 3 - 0
test/formats/CMakeLists.txt

@@ -0,0 +1,3 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+add_subdirectory(model)
+add_subdirectory(worldmap)

+ 4 - 0
test/formats/model/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    AFile.cpp
+)

+ 4 - 0
test/formats/worldmap/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    MapFileSerializer.cpp
+)

+ 4 - 0
test/installer/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+add_subdirectory(decompiler)
+add_subdirectory(extractors)
+add_subdirectory(steps)

+ 3 - 0
test/installer/decompiler/CMakeLists.txt

@@ -0,0 +1,3 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+add_subdirectory(field)
+add_subdirectory(world)

+ 5 - 0
test/installer/decompiler/field/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    FieldCodeGenerator.cpp
+    FieldDecompiler.cpp
+)

+ 5 - 0
test/installer/decompiler/world/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    WorldDisassembler.cpp
+)
+add_subdirectory(instruction)

+ 4 - 0
test/installer/decompiler/world/instruction/CMakeLists.txt

@@ -0,0 +1,4 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    WorldSubStackInstruction.cpp
+)

+ 9 - 0
test/installer/extractors/CMakeLists.txt

@@ -0,0 +1,9 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_tests(
+    FieldDataInstaller.cpp
+    SfxDump.cpp
+    WindowFonts.cpp
+)
+vgears_installer_tests(
+    MovieCamera.cpp
+)

+ 5 - 0
test/installer/steps/CMakeLists.txt

@@ -0,0 +1,5 @@
+# Tests of this folder (see vgears_tests and vgears_installer_tests in test/CMakeLists.txt).
+vgears_installer_tests(
+    ExternalTools.cpp
+    InstallLogic.cpp
+)