Make cxxtest optional

Remove mocks as they are no longer used making cxxtest effectively
optional.

Fixes: #8618
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2025-12-20 14:12:25 +01:00
parent 2d317d509d
commit 25f920bdb2
No known key found for this signature in database
5 changed files with 0 additions and 141 deletions

View file

@ -1078,22 +1078,6 @@ function setup_all_libs ()
filter "action:vs*"
buildoptions { "/wd4551" }
filter {}
-- CxxTest mock function support
extern_libs = {
"boost",
"cxxtest",
}
-- 'real' implementations, to be linked against the main executable
-- (files are added manually and not with setup_static_lib_project
-- because not all files in the directory are included)
setup_static_lib_project("mocks_real", {}, extern_libs, { no_default_link = 1, no_pch = 1 })
files { "mocks/*.h", source_root.."mocks/*_real.cpp" }
-- 'test' implementations, to be linked against the test executable
setup_static_lib_project("mocks_test", {}, extern_libs, { no_default_link = 1, no_pch = 1 })
files { source_root.."mocks/*.h", source_root.."mocks/*_test.cpp" }
end
--------------------------------------------------------------------------------
@ -1160,8 +1144,6 @@ function setup_main_exe ()
linkgroups 'On'
filter {}
links { "mocks_real" }
local extra_params = {
extra_files = { "main.cpp" },
no_pch = 1
@ -1577,7 +1559,6 @@ function setup_tests()
links { static_lib_names_release }
filter { }
links { "mocks_test" }
if not _OPTIONS["without-atlas"] then
links { "AtlasObject" }
end

View file

@ -1,24 +0,0 @@
/* Copyright (C) 2010 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. 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.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dlfcn.h>
#include <cxxtest/Mock.h>
CXXTEST_MOCK_GLOBAL(
int, dladdr,
(void *addr, Dl_info *info),
(addr, info)
);

View file

@ -1,33 +0,0 @@
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. 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.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#define CXXTEST_MOCK_REAL_SOURCE_FILE
// Pull in the common config headers from precompiled.h,
// but disable the actual precompiling (since we've only got
// one source file)
#ifdef USING_PCH
# undef USING_PCH
#endif
#include "lib/precompiled.h"
#include "lib/sysdep/os.h"
#if OS_LINUX || OS_BSD
#include "mocks/dlfcn.h"
#include "mocks/unistd.h"
#endif // OS_LINUX

View file

@ -1,41 +0,0 @@
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. 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.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#define CXXTEST_MOCK_TEST_SOURCE_FILE
// Pull in the common config headers from precompiled.h,
// but disable the actual precompiling (since we've only got
// one source file)
#ifdef USING_PCH
# undef USING_PCH
#endif
#include "lib/precompiled.h"
#include "lib/sysdep/os.h"
// Cause calls to be redirected to the real function by default
#define DEFAULT(name) static T::Real_##name real_##name
#if OS_LINUX || OS_BSD
#include "mocks/dlfcn.h"
DEFAULT(dladdr);
#include "mocks/unistd.h"
DEFAULT(getcwd);
#endif // OS_LINUX

View file

@ -1,24 +0,0 @@
/* Copyright (C) 2010 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. 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.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <cxxtest/Mock.h>
CXXTEST_MOCK_GLOBAL(
char *, getcwd,
(char *buf, size_t size),
(buf, size)
);