Skip to content

Commit 0e0a875

Browse files
authored
[CMAKE][CORE] Move compression library and compress tool to Core (TheSuperHackers#649)
1 parent 23e81e3 commit 0e0a875

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+204
-5626
lines changed

Core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ add_subdirectory(Libraries)
2222
# add_subdirectory(GameEngineDevice)
2323

2424
if (RTS_BUILD_CORE_TOOLS OR RTS_BUILD_CORE_EXTRAS)
25-
# add_subdirectory(Tools)
25+
add_subdirectory(Tools)
2626
endif()

Core/Libraries/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
add_subdirectory(Source/EABrowserDispatch)
1111
add_subdirectory(Source/EABrowserEngine)
12-
#add_subdirectory(Source/Compression)
12+
add_subdirectory(Source/Compression)
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
** Copyright 2025 Electronic Arts Inc.
3+
**
4+
** This program is free software: you can redistribute it and/or modify
5+
** it under the terms of the GNU General Public License as published by
6+
** the Free Software Foundation, either version 3 of the License, or
7+
** (at your option) any later version.
8+
**
9+
** This program is distributed in the hope that it will be useful,
10+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
** GNU General Public License for more details.
13+
**
14+
** You should have received a copy of the GNU General Public License
15+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
// FILE: BaseTypeCore.h ///////////////////////////////////////////////////////////
19+
//
20+
// Project: RTS3
21+
//
22+
// Basic types and constants
23+
// Author: Michael S. Booth, January 1995, September 2000
24+
// TheSuperHackers @compile feliwir 11/04/2025 Move common BaseType.h code to BaseTypeCore.h
25+
//
26+
///////////////////////////////////////////////////////////////////////////////
27+
28+
// tell the compiler to only load this file once
29+
#pragma once
30+
31+
32+
#ifndef _BASE_TYPE_CORE_H_
33+
#define _BASE_TYPE_CORE_H_
34+
35+
#include <math.h>
36+
#include <string.h>
37+
// TheSuperHackers @compile feliwir 07/04/2025 Adds utility macros for cross-platform compatibility
38+
#include <Utility/compat.h>
39+
40+
/*
41+
** Turn off some unneeded warnings.
42+
** Within the windows headers themselves, Microsoft has disabled the warnings 4290, 4514,
43+
** 4069, 4200, 4237, 4103, 4001, 4035, 4164. Makes you wonder, eh?
44+
*/
45+
46+
// "unreferenced inline function has been removed" Yea, so what?
47+
#pragma warning(disable : 4514)
48+
49+
// Unreferenced local function removed.
50+
#pragma warning(disable : 4505)
51+
52+
// 'unreferenced formal parameter'
53+
#pragma warning(disable : 4100)
54+
55+
// 'identifier was truncated to '255' characters in the browser information':
56+
// Tempates create LLLOOONNNGGG identifiers!
57+
#pragma warning(disable : 4786)
58+
59+
// 'function selected for automatic inline expansion'. Cool, but since we're treating
60+
// warnings as errors, don't warn me about this!
61+
#pragma warning(disable : 4711)
62+
63+
#if 0
64+
// 'assignment within condition expression'. actually a pretty useful warning,
65+
// but way too much existing code violates it.
66+
//#pragma warning(disable : 4706)
67+
#else
68+
// actually, it turned out not to be too bad, so this is now ENABLED. (srj)
69+
#pragma warning(error : 4706)
70+
#endif
71+
72+
// 'conditional expression is constant'. used lots in debug builds.
73+
#pragma warning(disable : 4127)
74+
75+
// 'nonstandard extension used : nameless struct/union'. MS headers violate this...
76+
#pragma warning(disable : 4201)
77+
78+
// 'unreachable code'. STL violates this...
79+
#pragma warning(disable : 4702)
80+
81+
// 'local variable is initialized but not referenced'. good thing to know about...
82+
#pragma warning(error : 4189)
83+
84+
// 'unreferenced local variable'. good thing to know about...
85+
#pragma warning(error : 4101)
86+
87+
#ifndef PI
88+
#define PI 3.14159265359f
89+
#define TWO_PI 6.28318530718f
90+
#endif
91+
92+
#ifndef NULL
93+
//#define NULL ((void *)0)
94+
#define NULL 0 // C++ doesn't like casting void *'s into other pointers
95+
#endif
96+
97+
// MSVC math.h defines overloaded functions with this name...
98+
//#ifndef abs
99+
//#define abs(x) (((x) < 0) ? -(x) : (x))
100+
//#endif
101+
102+
#ifndef min
103+
#define min(x,y) (((x)<(y)) ? (x) : (y))
104+
#endif
105+
106+
#ifndef max
107+
#define max(x,y) (((x)>(y)) ? (x) : (y))
108+
#endif
109+
110+
#ifndef TRUE
111+
#define TRUE true
112+
#endif
113+
114+
#ifndef FALSE
115+
#define FALSE false
116+
#endif
117+
118+
// Elements in an array
119+
#ifndef ELEMENTS_OF
120+
#define ELEMENTS_OF( x ) ( sizeof( x ) / sizeof( x[0] ) )
121+
#endif
122+
123+
//--------------------------------------------------------------------
124+
// Fundamental type definitions
125+
//--------------------------------------------------------------------
126+
typedef float Real; // 4 bytes
127+
typedef int Int; // 4 bytes
128+
typedef unsigned int UnsignedInt; // 4 bytes
129+
typedef unsigned short UnsignedShort; // 2 bytes
130+
typedef short Short; // 2 bytes
131+
typedef unsigned char UnsignedByte; // 1 byte USED TO BE "Byte"
132+
typedef char Byte; // 1 byte USED TO BE "SignedByte"
133+
typedef char Char; // 1 byte of text
134+
typedef bool Bool; //
135+
// note, the types below should use "long long", but MSVC doesn't support it yet
136+
#ifdef _MSC_VER
137+
typedef __int64 Int64; // 8 bytes
138+
typedef unsigned __int64 UnsignedInt64; // 8 bytes
139+
#else
140+
typedef long long Int64; // 8 bytes
141+
typedef unsigned long long UnsignedInt64; // 8 bytes
142+
#endif
143+
144+
#endif // _BASE_TYPE_CORE_H_

GeneralsMD/Code/Libraries/Source/Compression/CMakeLists.txt renamed to Core/Libraries/Source/Compression/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,22 @@ set(COMPRESSION_SRC
1919
Compression.h
2020
)
2121

22-
add_library(z_compression STATIC)
23-
set_target_properties(z_compression PROPERTIES OUTPUT_NAME compression)
22+
add_library(core_compression STATIC)
23+
set_target_properties(core_compression PROPERTIES OUTPUT_NAME compression)
2424

25-
target_sources(z_compression PRIVATE ${COMPRESSION_SRC})
25+
target_sources(core_compression PRIVATE ${COMPRESSION_SRC})
2626

27-
target_include_directories(z_compression INTERFACE
27+
target_include_directories(core_compression INTERFACE
2828
.
2929
)
3030

31-
target_link_libraries(z_compression PRIVATE
31+
target_link_libraries(core_compression PRIVATE
3232
core_config
33-
zi_always
33+
core_utility
34+
corei_libraries_include
3435
)
3536

36-
target_link_libraries(z_compression PUBLIC
37+
target_link_libraries(core_compression PUBLIC
3738
liblzhl
3839
libzlib
3940
)

GeneralsMD/Code/Libraries/Source/Compression/Compression.h renamed to Core/Libraries/Source/Compression/Compression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#ifndef __COMPRESSION_H__
2626
#define __COMPRESSION_H__
2727

28-
#include "Lib/BaseType.h"
28+
#include "Lib/BaseTypeCore.h"
2929

3030
enum CompressionType
3131
{

GeneralsMD/Code/Libraries/Source/Compression/CompressionManager.cpp renamed to Core/Libraries/Source/Compression/CompressionManager.cpp

File renamed without changes.

GeneralsMD/Code/Libraries/Source/Compression/EAC/btreeabout.cpp renamed to Core/Libraries/Source/Compression/EAC/btreeabout.cpp

File renamed without changes.

GeneralsMD/Code/Libraries/Source/Compression/EAC/btreecodex.h renamed to Core/Libraries/Source/Compression/EAC/btreecodex.h

File renamed without changes.

GeneralsMD/Code/Libraries/Source/Compression/EAC/btreedecode.cpp renamed to Core/Libraries/Source/Compression/EAC/btreedecode.cpp

File renamed without changes.

GeneralsMD/Code/Libraries/Source/Compression/EAC/btreeencode.cpp renamed to Core/Libraries/Source/Compression/EAC/btreeencode.cpp

File renamed without changes.

0 commit comments

Comments
 (0)