Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the first target and test #258

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/bazel-*
cmake/build*
Testing
27 changes: 26 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
# 2022, and is our newest officially supported compiler. The next CMake release was v3.23.0, on
# March 29, 2022. Therefore, our minimum version must be at least CMake 3.23.
#
# We also use the `CMAKE_VERIFY_INTERFACE_HEADER_SETS`, which was added in CMake
# 3.24, which means the minimum must also be at least 3.24.
#
# The maximum version should be the latest version we've tested the project with.
#
# [1]: https://cliutils.gitlab.io/modern-cmake/chapters/intro/dodonot.html
cmake_minimum_required(VERSION 3.23...3.29)
cmake_minimum_required(VERSION 3.24...3.29)

project(
Au
Expand All @@ -28,3 +31,25 @@ project(
HOMEPAGE_URL "https://aurora-opensource.github.io/au/0.3.4/"
LANGUAGES CXX
)

enable_testing()

# Bring in GoogleTest so we can build and run the tests.
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # Release 1.12.1
FIND_PACKAGE_ARGS
1.12.1
NAMES GTest
)

# https://google.github.io/googletest/quickstart-cmake.html
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

FetchContent_MakeAvailable(googletest)
include(GoogleTest)

add_subdirectory(au)
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ gcc_register_toolchain(
http_archive(
name = "com_google_googletest",
sha256 = "24564e3b712d3eb30ac9a85d92f7d720f60cc0173730ac166f27dda7fed76cb2",
# NOTE: if updating this version, also update the version numbers in `CMakelists.txt`.
strip_prefix = "googletest-release-1.12.1",
urls = ["https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip"],
)
Expand Down
43 changes: 43 additions & 0 deletions au/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Aurora Operations, Inc.
#
# 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
#
# http://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.

cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH AU_BASE_DIRECTORY)

#
# Private implementation detail targets
#

add_library(stdx INTERFACE)
geoffviola marked this conversation as resolved.
Show resolved Hide resolved
target_sources(stdx
INTERFACE
FILE_SET HEADERS
BASE_DIRS ${AU_BASE_DIRECTORY}
FILES
stdx/experimental/is_detected.hh
stdx/functional.hh
stdx/type_traits.hh
stdx/utility.hh
)

add_executable(stdx_test)
target_sources(stdx_test
PRIVATE
stdx/test/utility_test.cc
)
target_link_libraries(stdx_test
PRIVATE
stdx
GTest::gtest_main
)
gtest_discover_tests(stdx_test)
13 changes: 9 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,15 @@ To build the library using this experimental CMake support, follow these steps:
```sh
# CMake is a "meta build system", not a build system.
# This first command generates the actual build files.
cmake -B cmake/build -S .

# This command builds the library.
cmake --build cmake/build
cmake -S . -B cmake/build -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=TRUE

# This command builds Au, checks include paths, and runs unit tests.
cmake \
--build cmake/build \
--target \
all \
all_verify_interface_header_sets \
test
```

#### Other build systems (CMake / conan / vcpkg / ...)
Expand Down
Loading