Skip to content

Commit

Permalink
pw_chre: Write our own version.cc
Browse files Browse the repository at this point in the history
Write a pigweed version.cc instead of using the one
from the shared platform files, as the shared platform
adds a section to the DLL in a way incompatible with mac
compilers.

Bug: b/300633363

Change-Id: I95e2510f1bc36b137a5ec453ef75f9253050b87e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/170790
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: David Gilhooley <dgilhooley@google.com>
  • Loading branch information
gilhooleyd authored and CQ Bot Account committed Sep 15, 2023
1 parent ac288ee commit 4b9353e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions third_party/chre/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ filegroup(
name = "chre",
srcs = [
"integration_test.cc",
"version.cc",
],
)
8 changes: 7 additions & 1 deletion third_party/chre/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ if (dir_pw_third_party_chre == "") {
"$dir_pw_third_party_chre/platform/shared/nanoapp/nanoapp_dso_util.cc",
"$dir_pw_third_party_chre/platform/shared/pal_system_api.cc",
"$dir_pw_third_party_chre/platform/shared/system_time.cc",
"$dir_pw_third_party_chre/platform/shared/version.cc",
"$dir_pw_third_party_chre/util/buffer_base.cc",
"$dir_pw_third_party_chre/util/dynamic_vector_base.cc",
"$dir_pw_third_party_chre/util/nanoapp/audio.cc",
Expand All @@ -114,6 +113,13 @@ if (dir_pw_third_party_chre == "") {
"$dir_pw_third_party_chre/util/system/debug_dump.cc",
]

# TODO(b/300633363): Use CHRE's version when it compiles on MacOS.
if (current_os == "mac") {
sources += [ "version.cc" ]
} else {
sources += [ "$dir_pw_third_party_chre/platform/shared/version.cc" ]
}

public_deps = [
":chre_headers",
"$pw_chre_PLATFORM_BACKEND",
Expand Down
26 changes: 26 additions & 0 deletions third_party/chre/version.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.

#include "chre/platform/version.h"

#ifndef CHRE_VERSION_STRING
#define CHRE_VERSION_STRING "undefined"
#endif // CHRE_VERSION_STRING

namespace chre {

// TODO(b/300633363): Use CHRE's version when it compiles on MacOS.
const char* getChreVersionString() { return CHRE_VERSION_STRING; }

} // namespace chre

0 comments on commit 4b9353e

Please sign in to comment.