Skip to content
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
23 changes: 23 additions & 0 deletions FindAlbatross.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (C) 2022 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swift-nav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#

include("GenericFindDependency")

option(albatross_ENABLE_DOCS "" false)
option(albatross_ENABLE_EXAMPLES "" false)
option(albatross_ENABLE_TESTS "" false)
option(albatross_ENABLE_TEST_LIBS "" false)

GenericFindDependency(
TARGET albatross
SYSTEM_INCLUDES
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these have been included in the customer scripts, I'm not in favor of doing this since this is our code and we should be linting, but I'm not going to attempt to open that can of worms right now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little unclear what you mean here. We shouldn't be setting the options in our find scripts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isaactorz We should only be using SYSTEM_INCLUDE for code that doesn't comply with our coding standards. For example, the optional library (see here) is something that we've imported into our code base from an external source and it might not comply with our strict coding guidelines. Swiftlets on the other hand is something that we internally developed (see here) and therefore must comply.

Internally this SYSTEM_INCLUDES flag makes sure that all header files public from these third party targets are included with -isystem when compiling with GCC and Clang rather than the standard -I. So for example, if we wanted to link optional, it would compile it with something like this:

gcc -o main main.cc ... -L third_party/optional -loptional -isystem /third_party/optional/include ...

rather than the usual

gcc -p main main.cc ... -L third_party/optional -loptional -I /third_party/optional/include ...

Any warnings from header files under -isystem would be ignored rather than cause an error during compilation. Likewise the clang-tidy would ignore any issues under -isystem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks for clarifying.

)
24 changes: 24 additions & 0 deletions FindOrion-Engine.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (C) 2022 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swift-nav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#

include("GenericFindDependency")

option(orion-engine_ENABLE_DOCS "" false)
option(orion-engine_ENABLE_EXAMPLES "" false)
option(orion-engine_ENABLE_TESTS "" false)
option(orion-engine_ENABLE_TEST_LIBS "" false)

GenericFindDependency(
TARGET orion_engine
SOURCE_DIR orion-engine
SYSTEM_INCLUDES
)
10 changes: 8 additions & 2 deletions FindOrion-Proto.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2021 Swift Navigation Inc.
# Copyright (C) 2022 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swift-nav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
Expand All @@ -11,7 +11,13 @@
#

include("GenericFindDependency")

option(orion_proto_ENABLE_DOCS "" false)
option(orion_proto_ENABLE_EXAMPLES "" false)
option(orion_proto_ENABLE_TESTS "" false)
option(orion_proto_ENABLE_TEST_LIBS "" false)

GenericFindDependency(
TARGET orion-proto
SOURCE_DIR "orion_proto"
SOURCE_DIR orion_proto
)
24 changes: 24 additions & 0 deletions FindSip.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (C) 2022 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swift-nav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#

include("GenericFindDependency")

option(sip_ENABLE_DOCS "" false)
option(sip_ENABLE_EXAMPLES "" false)
option(sip_ENABLE_TESTS "" false)
option(sip_ENABLE_TEST_LIBS "" false)

GenericFindDependency(
TARGET sip
SOURCE_DIR sip
SYSTEM_INCLUDES
)
18 changes: 13 additions & 5 deletions TestTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ function(swift_add_test_runner target)
message(FATAL_ERROR "swift_add_test_runner unparsed arguments - ${x_UNPARSED_ARGUMENTS}")
endif()

swift_create_test_targets()

if(NOT x_COMMENT)
set(x_COMMENT "test ${target}")
endif()
Expand All @@ -213,6 +211,12 @@ function(swift_add_test_runner target)
message(FATAL_ERROR "Both INTEGRATION_TEST and UNIT_TEST option were specified, you can only specify one")
endif()

if (NOT ${PROJECT_NAME}_BUILD_TESTS)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was moved after the add_executable but before the creation of the do-* custom targets so that user can still build these targets manually but it won't be included into the do-all-tests target

return()
endif()

swift_create_test_targets()

add_custom_target(
do-${target}
COMMAND ${x_COMMAND}
Expand Down Expand Up @@ -266,8 +270,6 @@ function(swift_add_test target)
message(FATAL_ERROR "swift_add_test unparsed arguments - ${x_UNPARSED_ARGUMENTS}")
endif()

swift_create_test_targets()

if(NOT x_SRCS)
message(FATAL_ERROR "swift_add_test must be passed at least one source file")
endif()
Expand All @@ -291,21 +293,27 @@ function(swift_add_test target)
add_executable(${target} EXCLUDE_FROM_ALL ${x_SRCS})
set_target_properties(${target} PROPERTIES SWIFT_TYPE "test")
swift_set_language_standards(${target} C_EXTENSIONS_ON)
target_code_coverage(${target} AUTO ALL)
if(x_INCLUDE)
target_include_directories(${target} PRIVATE ${x_INCLUDE})
endif()
if(x_LINK)
target_link_libraries(${target} PRIVATE ${x_LINK})
endif()

if (NOT ${PROJECT_NAME}_BUILD_TESTS)
return()
endif()

swift_create_test_targets()

add_custom_target(
do-${target}
COMMAND ${target}
${wd}
COMMENT "Running ${x_COMMENT}"
)
add_dependencies(do-${target} ${target})
target_code_coverage(${target} AUTO ALL)

if(x_PARALLEL)
add_custom_target(parallel-${target}
Expand Down