Skip to content

Commit 61d1cf4

Browse files
authored
Added GeoJSONSpawnerROS2 Gem (#95)
--------- Signed-off-by: Patryk Antosz <[email protected]>
1 parent a3380ce commit 61d1cf4

File tree

54 files changed

+1486
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1486
-4
lines changed

Gems/GeoJSONSpawner/Code/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ ly_add_target(
7373
Gem::${gem_name}.Private.Object
7474
)
7575

76-
target_depends_on_ros2_packages(${gem_name}.Private.Object std_msgs std_srvs)
77-
7876
# By default, we will specify that the above target ${gem_name} would be used by
7977
# Client and Server type targets when this gem is enabled. If you don't want it
8078
# active in Clients or Servers by default, delete one of both of the following lines:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
o3de_gem_setup("GeoJSONSpawnerROS2")
3+
4+
ly_add_external_target_path(${CMAKE_CURRENT_SOURCE_DIR}/3rdParty)
5+
6+
add_subdirectory(Code)
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
2+
# Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
3+
# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
4+
# Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
5+
# in which case it will see if that platform is present here or in the restricted folder.
6+
# i.e. It could here in our gem : Gems/GeoJSONSpawnerROS2/Code/Platform/<platorm_name> or
7+
# <restricted_folder>/<platform_name>/Gems/GeoJSONSpawnerROS2/Code
8+
o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
9+
10+
# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
11+
# traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
12+
# is supported by this platform.
13+
include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
14+
15+
# Check to see if building the Gem Modules are supported for the current platform
16+
if(NOT PAL_TRAIT_GEOJSONSPAWNERROS2_SUPPORTED)
17+
return()
18+
endif()
19+
20+
# The ${gem_name}.API target declares the common interface that users of this gem should depend on in their targets
21+
ly_add_target(
22+
NAME ${gem_name}.API INTERFACE
23+
NAMESPACE Gem
24+
FILES_CMAKE
25+
geojsonspawnerros2_api_files.cmake
26+
${pal_dir}/geojsonspawnerros2_api_files.cmake
27+
INCLUDE_DIRECTORIES
28+
INTERFACE
29+
Include
30+
BUILD_DEPENDENCIES
31+
INTERFACE
32+
AZ::AzCore
33+
)
34+
35+
# The ${gem_name}.Private.Object target is an internal target
36+
# It should not be used outside of this Gems CMakeLists.txt
37+
ly_add_target(
38+
NAME ${gem_name}.Private.Object STATIC
39+
NAMESPACE Gem
40+
FILES_CMAKE
41+
geojsonspawnerros2_private_files.cmake
42+
${pal_dir}/geojsonspawnerros2_private_files.cmake
43+
TARGET_PROPERTIES
44+
O3DE_PRIVATE_TARGET TRUE
45+
INCLUDE_DIRECTORIES
46+
PRIVATE
47+
Include
48+
Source
49+
BUILD_DEPENDENCIES
50+
PUBLIC
51+
AZ::AzCore
52+
AZ::AzFramework
53+
PRIVATE
54+
Gem::GeoJSONSpawner.API
55+
Gem::ROS2.Static
56+
)
57+
58+
# Here add ${gem_name} target, it depends on the Private Object library and Public API interface
59+
ly_add_target(
60+
NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
61+
NAMESPACE Gem
62+
FILES_CMAKE
63+
geojsonspawnerros2_shared_files.cmake
64+
${pal_dir}/geojsonspawnerros2_shared_files.cmake
65+
INCLUDE_DIRECTORIES
66+
PUBLIC
67+
Include
68+
PRIVATE
69+
Source
70+
BUILD_DEPENDENCIES
71+
PUBLIC
72+
Gem::${gem_name}.API
73+
PRIVATE
74+
Gem::${gem_name}.Private.Object
75+
)
76+
77+
target_depends_on_ros2_packages(${gem_name}.Private.Object std_msgs std_srvs)
78+
79+
# Include the gem name into the Client Module source file
80+
# for use with the AZ_DECLARE_MODULE_CLASS macro
81+
# This is to allow renaming of the gem to also cause
82+
# the CreateModuleClass_Gem_<gem-name> function which
83+
# is used to bootstrap the gem in monolithic builds to link to the new gem name
84+
ly_add_source_properties(
85+
SOURCES
86+
Source/Clients/GeoJSONSpawnerROS2Module.cpp
87+
PROPERTY COMPILE_DEFINITIONS
88+
VALUES
89+
O3DE_GEM_NAME=${gem_name}
90+
O3DE_GEM_VERSION=${gem_version})
91+
92+
# By default, we will specify that the above target ${gem_name} would be used by
93+
# Client and Server type targets when this gem is enabled. If you don't want it
94+
# active in Clients or Servers by default, delete one of both of the following lines:
95+
ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name})
96+
ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name})
97+
ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name})
98+
99+
# For the Client and Server variants of ${gem_name} Gem, an alias to the ${gem_name}.API target will be made
100+
ly_create_alias(NAME ${gem_name}.Clients.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
101+
ly_create_alias(NAME ${gem_name}.Servers.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
102+
ly_create_alias(NAME ${gem_name}.Unified.API NAMESPACE Gem TARGETS Gem::${gem_name}.API)
103+
104+
# Add in CMake dependencies for each gem dependency listed in this gem's gem.json file
105+
# for the Clients, Servers, Unified gem variants
106+
o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Clients Servers Unified)
107+
108+
# If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor MODULE target
109+
if(PAL_TRAIT_BUILD_HOST_TOOLS)
110+
# The ${gem_name}.Editor.API target can be used by other gems that want to interact with the ${gem_name}.Editor module
111+
ly_add_target(
112+
NAME ${gem_name}.Editor.API INTERFACE
113+
NAMESPACE Gem
114+
FILES_CMAKE
115+
geojsonspawnerros2_editor_api_files.cmake
116+
${pal_dir}/geojsonspawnerros2_editor_api_files.cmake
117+
INCLUDE_DIRECTORIES
118+
INTERFACE
119+
Include
120+
BUILD_DEPENDENCIES
121+
INTERFACE
122+
AZ::AzToolsFramework
123+
)
124+
125+
# The ${gem_name}.Editor.Private.Object target is an internal target
126+
# which is only to be used by this gems CMakeLists.txt and any subdirectories
127+
# Other gems should not use this target
128+
ly_add_target(
129+
NAME ${gem_name}.Editor.Private.Object STATIC
130+
NAMESPACE Gem
131+
FILES_CMAKE
132+
geojsonspawnerros2_editor_private_files.cmake
133+
TARGET_PROPERTIES
134+
O3DE_PRIVATE_TARGET TRUE
135+
INCLUDE_DIRECTORIES
136+
PRIVATE
137+
Include
138+
Source
139+
BUILD_DEPENDENCIES
140+
PUBLIC
141+
AZ::AzToolsFramework
142+
${gem_name}.Private.Object
143+
Gem::ROS2.Editor.Static
144+
Gem::GeoJSONSpawner.API
145+
)
146+
147+
ly_add_target(
148+
NAME ${gem_name}.Editor GEM_MODULE
149+
NAMESPACE Gem
150+
AUTOMOC
151+
FILES_CMAKE
152+
geojsonspawnerros2_editor_shared_files.cmake
153+
INCLUDE_DIRECTORIES
154+
PRIVATE
155+
Source
156+
PUBLIC
157+
Include
158+
BUILD_DEPENDENCIES
159+
PUBLIC
160+
Gem::${gem_name}.Editor.API
161+
PRIVATE
162+
Gem::${gem_name}.Editor.Private.Object
163+
Gem::ROS2.Editor.Static
164+
Gem::GeoJSONSpawner.API
165+
)
166+
167+
# Include the gem name into the Editor Module source file
168+
# for use with the AZ_DECLARE_MODULE_CLASS macro
169+
# This is to allow renaming of the gem to also cause
170+
# the CreateModuleClass_Gem_<gem-name> function which
171+
# is used to bootstrap the gem in monolithic builds to link to the new gem name
172+
ly_add_source_properties(
173+
SOURCES
174+
Source/Tools/GeoJSONSpawnerROS2EditorModule.cpp
175+
PROPERTY COMPILE_DEFINITIONS
176+
VALUES
177+
O3DE_GEM_NAME=${gem_name}
178+
O3DE_GEM_VERSION=${gem_version})
179+
180+
# By default, we will specify that the above target ${gem_name} would be used by
181+
# Tool and Builder type targets when this gem is enabled. If you don't want it
182+
# active in Tools or Builders by default, delete one of both of the following lines:
183+
ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
184+
ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor)
185+
186+
# For the Tools and Builders variants of ${gem_name} Gem, an alias to the ${gem_name}.Editor API target will be made
187+
ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
188+
ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API)
189+
190+
# Add in CMake dependencies for each gem dependency listed in this gem's gem.json file
191+
# for the Tools and Builders gem variants
192+
o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Tools Builders)
193+
endif()
194+
195+
################################################################################
196+
# Tests
197+
################################################################################
198+
# See if globally, tests are supported
199+
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
200+
# We globally support tests, see if we support tests on this platform for ${gem_name}.Tests
201+
if(PAL_TRAIT_GEOJSONSPAWNERROS2_TEST_SUPPORTED)
202+
# We support ${gem_name}.Tests on this platform, add dependency on the Private Object target
203+
ly_add_target(
204+
NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
205+
NAMESPACE Gem
206+
FILES_CMAKE
207+
geojsonspawnerros2_tests_files.cmake
208+
INCLUDE_DIRECTORIES
209+
PRIVATE
210+
Tests
211+
Source
212+
Include
213+
BUILD_DEPENDENCIES
214+
PRIVATE
215+
AZ::AzTest
216+
AZ::AzFramework
217+
Gem::${gem_name}.Private.Object
218+
)
219+
220+
# Add ${gem_name}.Tests to googletest
221+
ly_add_googletest(
222+
NAME Gem::${gem_name}.Tests
223+
)
224+
endif()
225+
226+
# If we are a host platform we want to add tools test like editor tests here
227+
if(PAL_TRAIT_BUILD_HOST_TOOLS)
228+
# We are a host platform, see if Editor tests are supported on this platform
229+
if(PAL_TRAIT_GEOJSONSPAWNERROS2_EDITOR_TEST_SUPPORTED)
230+
# We support ${gem_name}.Editor.Tests on this platform, add ${gem_name}.Editor.Tests target which depends on
231+
# private ${gem_name}.Editor.Private.Object target
232+
ly_add_target(
233+
NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
234+
NAMESPACE Gem
235+
FILES_CMAKE
236+
geojsonspawnerros2_editor_tests_files.cmake
237+
INCLUDE_DIRECTORIES
238+
PRIVATE
239+
Tests
240+
Source
241+
Include
242+
BUILD_DEPENDENCIES
243+
PRIVATE
244+
AZ::AzTest
245+
Gem::${gem_name}.Editor.Private.Object
246+
)
247+
248+
# Add ${gem_name}.Editor.Tests to googletest
249+
ly_add_googletest(
250+
NAME Gem::${gem_name}.Editor.Tests
251+
)
252+
endif()
253+
endif()
254+
endif()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (C) Robotec AI - All Rights Reserved
3+
*
4+
* This source code is protected under international copyright law. All rights
5+
* reserved and protected by the copyright holders.
6+
* This file is confidential and only available to authorized individuals with the
7+
* permission of the copyright holders. If you encounter this file and do not have
8+
* permission, please contact the copyright holders and delete this file.
9+
*/
10+
11+
#pragma once
12+
13+
namespace GeoJSONSpawnerROS2
14+
{
15+
// System Component TypeIds
16+
inline constexpr const char* GeoJSONSpawnerROS2SystemComponentTypeId = "{715CB9C6-1EFD-469D-B7DC-72D097E1FBE9}";
17+
inline constexpr const char* GeoJSONSpawnerROS2EditorSystemComponentTypeId = "{F56F94B4-D27B-4466-9794-3ECC2D35F5E9}";
18+
19+
// Module derived classes TypeIds
20+
inline constexpr const char* GeoJSONSpawnerROS2ModuleInterfaceTypeId = "{F8EFEBC9-E997-4830-A035-AF7A201F42A9}";
21+
inline constexpr const char* GeoJSONSpawnerROS2ModuleTypeId = "{4F1BA299-BF1E-4810-B636-4896CC2842E8}";
22+
// The Editor Module by default is mutually exclusive with the Client Module
23+
// so they use the Same TypeId
24+
inline constexpr const char* GeoJSONSpawnerROS2EditorModuleTypeId = GeoJSONSpawnerROS2ModuleTypeId;
25+
26+
// Editor Components TypeIds
27+
inline constexpr const char* GeoJSONSpawnerROS2EditorComponentTypeId = "{e73adfb4-d45e-49de-a863-b20877300e99}";
28+
29+
// Configurations TypeIds
30+
inline constexpr const char* GeoJSONSpawnerROS2ConfigurationTypeId = "{a023282f-5ec5-4af1-902d-74772f024339}";
31+
32+
// Components TypeIds
33+
inline constexpr const char* GeoJSONSpawnerROS2TypeId = "{a302588e-10c5-443b-a9ec-5edc33c56ef2}";
34+
35+
// Interface TypeIds
36+
inline constexpr const char* GeoJSONSpawnerROS2RequestsTypeId = "{636D9D5F-7EA7-47CA-902E-7DE5003A7FC7}";
37+
} // namespace GeoJSONSpawnerROS2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_SUPPORTED TRUE)
3+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_TEST_SUPPORTED FALSE)
4+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_EDITOR_TEST_SUPPORTED FALSE)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
set(FILES
3+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Platform specific files for Android
3+
# i.e. ../Source/Android/GeoJSONSpawnerROS2Android.cpp
4+
# ../Source/Android/GeoJSONSpawnerROS2Android.h
5+
# ../Include/Android/GeoJSONSpawnerROS2Android.h
6+
7+
set(FILES
8+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Platform specific files for Android
3+
# i.e. ../Source/Android/GeoJSONSpawnerROS2Android.cpp
4+
# ../Source/Android/GeoJSONSpawnerROS2Android.h
5+
# ../Include/Android/GeoJSONSpawnerROS2Android.h
6+
7+
set(FILES
8+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_SUPPORTED TRUE)
3+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_TEST_SUPPORTED FALSE)
4+
set(PAL_TRAIT_GEOJSONSPAWNERROS2_EDITOR_TEST_SUPPORTED FALSE)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
set(FILES
3+
)

0 commit comments

Comments
 (0)