CMAKE: allow to use system wide installation of flatbuffers

master
Martin Gerhardy 2022-01-25 19:48:43 +01:00
parent 70b4c0c730
commit 14febac20b
5 changed files with 54 additions and 46 deletions

View File

@ -61,7 +61,7 @@ jobs:
- name: Setup
run: |
sudo apt-get update
sudo apt-get install cmake debhelper devscripts build-essential lintian libsdl2-dev libuv1-dev libsdl2-mixer-dev postgresql-server-dev-all libpq-dev libenet-dev opencl-c-headers wayland-protocols pkg-config uuid-dev python3
sudo apt-get install cmake debhelper devscripts build-essential lintian libsdl2-dev libuv1-dev libsdl2-mixer-dev postgresql-server-dev-all libpq-dev libenet-dev opencl-c-headers wayland-protocols pkg-config uuid-dev python3 flatbuffers-compiler
- name: Ubuntu
run: |
@ -107,7 +107,7 @@ jobs:
- name: Setup
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev postgresql-server-dev-all libpq-dev libenet-dev opencl-c-headers wayland-protocols pkg-config uuid-dev ninja-build python3
sudo apt-get install libsdl2-dev postgresql-server-dev-all libpq-dev libenet-dev opencl-c-headers wayland-protocols pkg-config uuid-dev ninja-build python3 flatbuffers-compiler
- name: Linux
run: |

View File

@ -1,2 +1,2 @@
include("${ROOT_DIR}/cmake/macros.cmake")
engine_find_header_only(flatbuffers flatbuffers.h "" "" "")
engine_find_header_only(flatbuffers flatbuffers.h flatbuffers "")

View File

@ -1,3 +1,3 @@
#We need 0.9.8
include("${ROOT_DIR}/cmake/macros.cmake")
engine_find_header_only(glm detail/type_mat.hpp glm "" "")
engine_find_header_only(glm detail/type_mat.hpp glm "")

View File

@ -14,7 +14,13 @@ engine_add_library(
if (NOT FLATBUFFERS_FOUND)
target_include_directories(flatbuffers PUBLIC .)
endif()
set(COMPILER_SRCS
find_program(FLATC_EXECUTABLE NAMES flatc)
if (FLATC_EXECUTABLE)
add_executable(flatc IMPORTED GLOBAL)
set_property(TARGET flatc PROPERTY IMPORTED_LOCATION ${FLATC_EXECUTABLE})
else()
set(COMPILER_SRCS
compiler/src/compiler/cpp_generator.cc
compiler/src/compiler/cpp_generator.h
compiler/src/compiler/go_generator.cc
@ -51,8 +57,9 @@ set(COMPILER_SRCS
compiler/idl_parser.cpp
compiler/reflection.cpp
compiler/util.cpp
)
engine_add_build_executable(TARGET flatc SRCS ${COMPILER_SRCS} NOINSTALL)
set_target_properties(flatc PROPERTIES UNITY_BUILD FALSE)
target_link_libraries(flatc flatbuffers)
target_include_directories(flatc PRIVATE compiler/)
)
engine_add_build_executable(TARGET flatc SRCS ${COMPILER_SRCS} NOINSTALL)
set_target_properties(flatc PROPERTIES UNITY_BUILD FALSE)
target_link_libraries(flatc flatbuffers)
target_include_directories(flatc PRIVATE compiler/)
endif()

1
debian/control vendored
View File

@ -14,6 +14,7 @@ Build-Depends:
wayland-protocols,
pkg-config,
uuid-dev,
libflatbuffers-dev,
libsdl2-mixer-dev
Standards-Version: 4.1.4
Homepage: https://github.com/mgerhardy/vengi