Skip to content

Commit 3db9151

Browse files
committed
Experimentally enable libgc everywhere to see if things build.
1 parent 2c0514b commit 3db9151

20 files changed

Lines changed: 52 additions & 39 deletions

.github/workflows/ccpp.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
path: 'fluxengine-testdata'
4747
- name: brew
4848
run: |
49-
brew install sqlite pkg-config libusb protobuf wxwidgets fmt make coreutils dylibbundler libjpeg libmagic nlohmann-json cli11 boost glfw3 md4c ninja python freetype2 mbedtls@3 lunasvg
49+
brew install sqlite pkg-config libusb protobuf wxwidgets fmt make coreutils dylibbundler libjpeg libmagic nlohmann-json cli11 boost glfw3 md4c ninja python freetype2 mbedtls@3 lunasvg libgc
5050
brew link mbedtls@3
5151
brew upgrade
5252
- name: make
@@ -77,6 +77,7 @@ jobs:
7777
pacboy: |
7878
protobuf:p pkgconf:p curl-winssl:p file:p glfw:p mbedtls:p
7979
sqlite:p freetype:p boost:p gcc:p binutils:p nsis:p abseil-cpp:p
80+
gc:p
8081
8182
- name: debug
8283
run: |

build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package(name="protobuf_lib", package="protobuf")
1717
package(name="z_lib", package="zlib")
1818
package(name="sqlite3_lib", package="sqlite3")
19+
package(name="gc_lib", package="bdw-gc", ldflags=["-lgccpp"])
1920

2021
clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"})
2122

build/pkg.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ def get_property(self, name, flag):
3434
HostPkgConfig = _PkgConfig(G.HOST_PKG_CONFIG)
3535

3636

37-
def _package(self, name, package, fallback, pkgconfig):
37+
def _package(
38+
self, name, package, fallback, extra_ldflags, extra_cflags, pkgconfig
39+
):
3840
if pkgconfig.has_package(package):
3941
print(f"package '{package}' found")
4042
cflags = pkgconfig.get_property(package, "--cflags")
4143
ldflags = pkgconfig.get_property(package, "--libs")
4244

43-
if cflags:
44-
self.args["caller_cflags"] = [cflags]
45-
if ldflags:
46-
self.args["caller_ldflags"] = [ldflags]
45+
self.args["caller_cflags"] = extra_cflags + [cflags]
46+
self.args["caller_ldflags"] = extra_ldflags + [ldflags]
4747
self.args["clibrary_deps"] = [self]
4848
self.args["cheader_deps"] = [self]
4949
self.traits.update({"clibrary", "cxxlibrary"})
@@ -70,13 +70,17 @@ def _package(self, name, package, fallback, pkgconfig):
7070

7171

7272
@Rule
73-
def package(self, name, package=None, fallback: Target = None):
74-
_package(self, name, package, fallback, TargetPkgConfig)
73+
def package(
74+
self, name, package=None, fallback: Target = None, ldflags=[], cflags=[]
75+
):
76+
_package(self, name, package, fallback, ldflags, cflags, TargetPkgConfig)
7577

7678

7779
@Rule
78-
def hostpackage(self, name, package=None, fallback: Target = None):
79-
_package(self, name, package, fallback, HostPkgConfig)
80+
def hostpackage(
81+
self, name, package=None, fallback: Target = None, ldflags=[], cflags=[]
82+
):
83+
_package(self, name, package, fallback, ldflags, cflags, HostPkgConfig)
8084

8185

8286
def has_package(name):

lib/core/globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <optional>
1818
#include <regex>
1919
#include <ranges>
20+
#include <gc_cpp.h>
2021
#include "fmt/format.h"
2122

2223
#if defined(_WIN32) || defined(__WIN32__)

lib/data/disk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class LogicalTrackLayout;
1111
class PhysicalTrackLayout;
1212
class Sector;
1313

14-
struct Record
14+
struct Record: public gc
1515
{
1616
nanoseconds_t clock = 0;
1717
nanoseconds_t startTime = 0;
@@ -20,7 +20,7 @@ struct Record
2020
Bytes rawData;
2121
};
2222

23-
struct Track
23+
struct Track: public gc
2424
{
2525
std::shared_ptr<const LogicalTrackLayout> ltl;
2626
std::shared_ptr<const PhysicalTrackLayout> ptl;
@@ -36,7 +36,7 @@ struct Track
3636
std::vector<std::shared_ptr<const Sector>> normalisedSectors;
3737
};
3838

39-
struct Disk
39+
struct Disk: public gc
4040
{
4141
Disk();
4242

lib/data/fluxmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class RawBits;
1010

11-
class Fluxmap
11+
class Fluxmap: public gc
1212
{
1313
public:
1414
struct Position

lib/data/fluxpattern.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
class FluxMatcher;
99
class DecoderProto;
1010

11-
struct FluxMatch
11+
struct FluxMatch: public gc
1212
{
1313
const FluxMatcher* matcher;
1414
unsigned intervals;
1515
double clock;
1616
unsigned zeroes;
1717
};
1818

19-
class FluxMatcher
19+
class FluxMatcher: public gc
2020
{
2121
public:
2222
virtual ~FluxMatcher() {}

lib/data/image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct Geometry
1717
unsigned totalBytes = 0;
1818
};
1919

20-
class Image
20+
class Image: public gc
2121
{
2222
public:
2323
Image();

lib/data/layout.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class ConfigProto;
1010

11-
struct LogicalTrackLayout
11+
struct LogicalTrackLayout: public gc
1212
{
1313
/* Physical cylinder of the first element of the group. */
1414
unsigned physicalCylinder;
@@ -50,7 +50,7 @@ struct LogicalTrackLayout
5050
std::map<unsigned, unsigned> sectorIdToNaturalOrdering;
5151
};
5252

53-
struct PhysicalTrackLayout
53+
struct PhysicalTrackLayout: public gc
5454
{
5555
/* Physical location of this track. */
5656
unsigned physicalCylinder;
@@ -65,7 +65,7 @@ struct PhysicalTrackLayout
6565
std::shared_ptr<const LogicalTrackLayout> logicalTrackLayout;
6666
};
6767

68-
class DiskLayout
68+
class DiskLayout: public gc
6969
{
7070
public:
7171
DiskLayout(const ConfigProto& config = globalConfig());
@@ -176,7 +176,7 @@ static std::shared_ptr<DiskLayout> createDiskLayout(
176176
return std::make_shared<DiskLayout>(config);
177177
}
178178

179-
class TrackInfo
179+
class TrackInfo: public gc
180180
{
181181
public:
182182
TrackInfo() {}

lib/data/sector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Record;
99
class LogicalTrackLayout;
1010

11-
struct Sector : public LogicalLocation
11+
struct Sector : public LogicalLocation, public gc
1212
{
1313
enum Status
1414
{

0 commit comments

Comments
 (0)