-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
88 lines (75 loc) · 2.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 3.10...3.31)
project(ecal-go LANGUAGES C CXX)
find_package(eCAL CONFIG REQUIRED)
add_library(utils INTERFACE)
target_include_directories(utils INTERFACE .)
add_library(ecal_go_types)
target_sources(ecal_go_types PRIVATE
./ecal/types/types.h
./ecal/types/types.hpp
./ecal/types/types.cpp
)
target_include_directories(ecal_go_types
PUBLIC ./ecal/types
)
target_link_libraries(ecal_go_types PRIVATE eCAL::core)
add_library(ecal_go_core)
target_sources(ecal_go_core PRIVATE
./ecal/core.h
./ecal/core.cpp
)
target_link_libraries(ecal_go_core PRIVATE eCAL::core)
add_library(ecal_go_publisher)
target_sources(ecal_go_publisher PRIVATE
./ecal/publisher/publisher.h
./ecal/publisher/publisher.cpp
)
target_link_libraries(ecal_go_publisher PRIVATE eCAL::core utils)
add_library(ecal_go_subscriber)
target_sources(ecal_go_subscriber PRIVATE
./ecal/subscriber/subscriber.h
./ecal/subscriber/subscriber.cpp
)
target_link_libraries(ecal_go_subscriber PRIVATE eCAL::core utils)
add_library(ecal_go_logging)
target_sources(ecal_go_logging PRIVATE
./ecal/logging/logging.h
./ecal/logging/logging.cpp
)
target_link_libraries(ecal_go_logging PRIVATE eCAL::core ecal_go_types)
add_library(ecal_go_registration)
target_sources(ecal_go_registration PRIVATE
./ecal/registration/registration.h
./ecal/registration/registration.cpp
)
target_link_libraries(ecal_go_registration PRIVATE eCAL::core ecal_go_types)
add_library(ecal_go_monitoring)
target_sources(ecal_go_monitoring PRIVATE
./ecal/monitoring/monitoring.h
./ecal/monitoring/monitoring.cpp
)
target_link_libraries(ecal_go_monitoring PRIVATE eCAL::core ecal_go_types)
# Subpackages that use cgo
set(subpackages
"ecal"
"ecal/types"
"ecal/publisher"
"ecal/subscriber"
"ecal/logging"
"ecal/registration"
"ecal/monitoring"
)
foreach(package ${subpackages})
cmake_path(GET package STEM package_name)
# Have content embedded here to evalue the package_name variable
file(GENERATE
OUTPUT "${CMAKE_SOURCE_DIR}/${package}/package_user.go"
CONTENT "\
package ${package_name}
// #cgo CPPFLAGS: -I$<TARGET_PROPERTY:eCAL::core,INTERFACE_INCLUDE_DIRECTORIES>
// #cgo LDFLAGS: -L$<TARGET_LINKER_FILE_DIR:eCAL::core>
// #cgo LDFLAGS: -Wl,-rpath,$<TARGET_LINKER_FILE_DIR:eCAL::core>
import \"C\"
"
)
endforeach()