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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build examples from CMake rather than executable #482

Merged
merged 15 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(gz-math7 VERSION 7.1.0)
#============================================================================
# If you get an error at this line, you need to install gz-cmake
find_package(gz-cmake3 REQUIRED)
set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR})

#============================================================================
# Configure the project
Expand Down Expand Up @@ -139,3 +140,13 @@ configure_file(${CMAKE_SOURCE_DIR}/tutorials.md.in ${CMAKE_BINARY_DIR}/tutorials
gz_create_docs(
API_MAINPAGE_MD "${CMAKE_BINARY_DIR}/api.md"
TUTORIALS_MAINPAGE_MD "${CMAKE_BINARY_DIR}/tutorials.md")

#============================================================================
# Build examples
#============================================================================
if (BUILD_TESTING)
gz_build_examples(
SOURCE_DIR ${PROJECT_SOURCE_DIR}/examples
BINARY_DIR ${PROJECT_BINARY_DIR}/examples
)
endif()
21 changes: 0 additions & 21 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@ include_directories (
${PROJECT_BINARY_DIR}/include
)

#============================================================================
# Do a fake install of gz-math in order to test the examples.
#============================================================================
# install to FAKE_INSTALL_PREFIX defined in root CMakeLists.txt

file(MAKE_DIRECTORY ${FAKE_INSTALL_PREFIX})

include(ExternalProject)
ExternalProject_Add(
FAKE_INSTALL

SOURCE_DIR "${CMAKE_SOURCE_DIR}"
EXCLUDE_FROM_ALL 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
CMAKE_ARGS
"-DBUILD_TESTING=OFF"
"-DCMAKE_INSTALL_PREFIX=${FAKE_INSTALL_PREFIX}"
)

add_subdirectory(gtest_vendor)
add_subdirectory(integration)
add_subdirectory(performance)
Expand Down
9 changes: 0 additions & 9 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,3 @@ if (UNIX AND NOT APPLE)
endif()

gz_build_tests(TYPE INTEGRATION SOURCES ${tests})

if(TARGET INTEGRATION_ExamplesBuild_TEST)
add_dependencies(INTEGRATION_ExamplesBuild_TEST FAKE_INSTALL)

set(_env_vars)
list(APPEND _env_vars "CMAKE_PREFIX_PATH=${FAKE_INSTALL_PREFIX}:$ENV{CMAKE_PREFIX_PATH}")
set_tests_properties(INTEGRATION_ExamplesBuild_TEST PROPERTIES
ENVIRONMENT "${_env_vars}")
endif()
Loading