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

Build examples from CMake rather than executable #502

Merged
merged 12 commits into from
Aug 28, 2023
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
10 changes: 6 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ jobs:
run: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/${PACKAGE}/HEAD
- run: make
working-directory: build
- run: make test
working-directory: build
env:
CTEST_OUTPUT_ON_FAILURE: 1
# Run make install before make test so that the package will be available to
# build examples as part of the test
- name: make install
working-directory: build
run: |
make install;
brew link ${PACKAGE};
- run: make test
working-directory: build
env:
CTEST_OUTPUT_ON_FAILURE: 1
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ gz_configure_build(QUIT_IF_BUILD_ERRORS
#============================================================================
gz_create_packages()


#============================================================================
# Create documentation
#============================================================================
Expand All @@ -157,3 +156,13 @@ gz_create_docs(
TAGFILES
"${GZ-MATH_DOXYGEN_TAGFILE} = ${GZ-MATH_API_URL}"
)

#============================================================================
# Build examples
#============================================================================
if (BUILD_TESTING)
gz_build_examples(
SOURCE_DIR ${PROJECT_SOURCE_DIR}/examples
BINARY_DIR ${PROJECT_BINARY_DIR}/examples
)
endif()
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(gz-common-examples)

# Find the gz-common library
find_package(gz-common5 QUIET REQUIRED COMPONENTS events profiler)
Expand Down
Loading