forked from FLECS-Technologies/flecs-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (67 loc) · 2.29 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
# Copyright 2021-2023 FLECS Technologies GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.21)
include(${CMAKE_SOURCE_DIR}/flecs-build/cmake/flecs-build.cmake)
project(
FLECS
VERSION 3.4.0
HOMEPAGE_URL https://flecs.tech
LANGUAGES CXX
)
set(CODENAME hedgehog)
# set version
set(FLECS_VERSION_FULL "${PROJECT_VERSION}-${CODENAME}")
if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(FLECS_VERSION_FULL "${FLECS_VERSION_FULL}-dev")
endif()
set(API_VERSION 2.0.0)
add_definitions(-DFLECS_VERSION="${FLECS_VERSION_FULL}")
add_definitions(-DFLECS_API_VERSION="${API_VERSION}")
include(FetchContent)
FetchContent_Declare(
Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG 64289b1d79d6d19cd2e241db515381a086bb8407
)
if ("${ARCH}" STREQUAL "amd64")
set(Rust_CARGO_TARGET "x86_64-unknown-linux-gnu")
elseif("${ARCH}" STREQUAL "armhf")
set(Rust_CARGO_TARGET "armv7-unknown-linux-gnueabihf")
elseif("${ARCH}" STREQUAL "arm64")
set(Rust_CARGO_TARGET "aarch64-unknown-linux-gnu")
endif()
message(STATUS "Rust_CARGO_TARGET: ${Rust_CARGO_TARGET}")
# Set any global configuration variables such as `Rust_TOOLCHAIN` before this line!
FetchContent_MakeAvailable(Corrosion)
# workaround for gcc-12 bug
add_compile_options(-Wno-error=restrict)
if(FLECS_BUILD_TESTS)
include(CTest)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(FLECS_NEED_CPR TRUE)
set(FLECS_NEED_JSON TRUE)
set(FLECS_NEED_LIBARCHIVE TRUE)
set(FLECS_NEED_LIBUSB TRUE)
set(FLECS_NEED_YAMLCPP TRUE)
set(FLECS_NEED_ZENOHC TRUE)
add_subdirectory(flecs-external)
add_subdirectory(flunder)
add_subdirectory(flecs)
add_custom_target(version
COMMAND echo "${FLECS_VERSION_FULL}"
)
add_subdirectory(docker)
add_subdirectory(pkg)
include(flecs-rules)