Skip to content

Commit 1cbf137

Browse files
Merge pull request #20 from F2I-Consulting/dev
v0.2.0.0
2 parents f67e350 + e7de2a4 commit 1cbf137

37 files changed

Lines changed: 2100 additions & 624 deletions

.github/workflows/github-actions.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
cd ${{ github.workspace }}/..
2828
mkdir build
2929
cd build
30-
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DAVRO_INCLUDE_DIR=${{ runner.temp }}/avro-cpp-1.10.2-install/include -DAVRO_LIBRARY_RELEASE=${{ runner.temp }}/avro-cpp-1.10.2-install/lib/avrocpp_s.lib -DWITH_ETP_SSL=FALSE ${{ github.workspace }}
30+
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DAVRO_ROOT=${{ runner.temp }}/avro-cpp-1.10.2-install -DWITH_ETP_SSL=FALSE ${{ github.workspace }}
3131
cmake --build . --config Release -j2
3232
windows-2019-with-fesapi:
3333
runs-on: windows-2019
@@ -66,7 +66,7 @@ jobs:
6666
cmake --build . --config Release --target INSTALL
6767
- name: FESAPI install
6868
run: |
69-
git clone --branch v2.6.0.0 --single-branch https://github.com/F2I-Consulting/fesapi.git ${{ runner.temp }}/fesapi-src
69+
git clone --branch v2.8.0.0 --single-branch https://github.com/F2I-Consulting/fesapi.git ${{ runner.temp }}/fesapi-src
7070
cd ${{ runner.temp }}
7171
mkdir fesapi-build
7272
cd fesapi-build
@@ -78,7 +78,7 @@ jobs:
7878
cd ${{ github.workspace }}/..
7979
mkdir build
8080
cd build
81-
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DAVRO_INCLUDE_DIR=${{ runner.temp }}/avro-cpp-1.10.2-install/include -DAVRO_LIBRARY_RELEASE=${{ runner.temp }}/avro-cpp-1.10.2-install/lib/avrocpp_s.lib -DWITH_FESAPI=TRUE -DFESAPI_INCLUDE_DIR=${{ runner.temp }}/fesapi-install/include -DFESAPI_LIBRARY_RELEASE=${{ runner.temp }}/fesapi-install/lib/FesapiCpp.2.6.0.0.lib -DWITH_ETP_SSL=FALSE ${{ github.workspace }}
81+
cmake -G"Visual Studio 16 2019" -A x64 -T host=x64 -Wno-dev -Wno-deprecated -DBoost_INCLUDE_DIR=${{ runner.temp }}\boost-install -DAVRO_ROOT=${{ runner.temp }}/avro-cpp-1.10.2-install -DWITH_FESAPI=TRUE -DFESAPI_ROOT=${{ runner.temp }}/fesapi-install -DWITH_ETP_SSL=FALSE ${{ github.workspace }}
8282
cmake --build . --config Release -j2
8383
ubuntu-20:
8484
runs-on: ubuntu-20.04
@@ -105,7 +105,7 @@ jobs:
105105
cd ${{ github.workspace }}/..
106106
mkdir build
107107
cd build
108-
cmake -DAVRO_INCLUDE_DIR=${{ runner.temp }}/avro-cpp-1.11.0-install/include -DAVRO_LIBRARY_RELEASE=${{ runner.temp }}/avro-cpp-1.11.0-install/lib/libavrocpp_s.a ${{ github.workspace }}
108+
cmake -DAVRO_ROOT=${{ runner.temp }}/avro-cpp-1.11.0-install ${{ github.workspace }}
109109
cmake --build . --config Release -j2
110110
ubuntu-20-java8:
111111
runs-on: ubuntu-20.04
@@ -136,7 +136,7 @@ jobs:
136136
cd ${{ github.workspace }}/..
137137
mkdir build
138138
cd build
139-
cmake -DAVRO_INCLUDE_DIR=${{ runner.temp }}/avro-cpp-1.11.0-install/include -DAVRO_LIBRARY_RELEASE=${{ runner.temp }}/avro-cpp-1.11.0-install/lib/libavrocpp_s.a -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }}
139+
cmake -DAVRO_ROOT=${{ runner.temp }}/avro-cpp-1.11.0-install -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }}
140140
cmake --build . --config Release -j2
141141
ubuntu-20-java8-with-fesapi:
142142
runs-on: ubuntu-20.04
@@ -167,7 +167,7 @@ jobs:
167167
sudo apt install -y ${{ matrix.xcc_pkg }} libhdf5-dev libminizip-dev libboost-all-dev
168168
- name: FESAPI install
169169
run: |
170-
git clone --branch v2.6.0.0 --single-branch https://github.com/F2I-Consulting/fesapi.git ${{ runner.temp }}/fesapi-src
170+
git clone --branch v2.8.0.0 --single-branch https://github.com/F2I-Consulting/fesapi.git ${{ runner.temp }}/fesapi-src
171171
cd ${{ runner.temp }}
172172
mkdir fesapi-build
173173
cd fesapi-build
@@ -191,5 +191,5 @@ jobs:
191191
cd ${{ github.workspace }}/..
192192
mkdir build
193193
cd build
194-
cmake -DAVRO_INCLUDE_DIR=${{ runner.temp }}/avro-cpp-1.11.0-install/include -DAVRO_LIBRARY_RELEASE=${{ runner.temp }}/avro-cpp-1.11.0-install/lib/libavrocpp_s.a -DWITH_FESAPI=TRUE -DFESAPI_INCLUDE_DIR=${{ runner.temp }}/fesapi-install/include -DFESAPI_LIBRARY_RELEASE=${{ runner.temp }}/fesapi-install/lib/libFesapiCpp.so -DFESAPI_JAR=${{ runner.temp }}/fesapi-install/lib/fesapiJava-2.6.0.0.jar -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
194+
cmake -DAVRO_ROOT=${{ runner.temp }}/avro-cpp-1.11.0-install -DWITH_FESAPI=TRUE -DFESAPI_ROOT=${{ runner.temp }}/fesapi-install -DFESAPI_JAR=${{ runner.temp }}/fesapi-install/lib/fesapiJava-2.8.0.0.jar -DWITH_JAVA_WRAPPING=TRUE ${{ github.workspace }} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
195195
cmake --build . --config Release -j2

CMakeLists.txt

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.12)
22

33
project(Fetpapi)
44

5+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
6+
57
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "DEBUG_POSTFIX property is initialized when the target is created to the value of this variable except for executable targets")
68

79
# Allow to have all executables generated in the same binary directory. Otherwise there would be in a directory different for each add_subdirectory cmake commande.
810
set (FETPAPI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
911

1012
# version mechanism
1113
set (Fetpapi_VERSION_MAJOR 0)
12-
set (Fetpapi_VERSION_MINOR 1)
14+
set (Fetpapi_VERSION_MINOR 2)
1315
set (Fetpapi_VERSION_PATCH 0)
1416
set (Fetpapi_VERSION_TWEAK 0)
17+
1518
set (Fetpapi_VERSION ${Fetpapi_VERSION_MAJOR}.${Fetpapi_VERSION_MINOR}.${Fetpapi_VERSION_PATCH}.${Fetpapi_VERSION_TWEAK})
1619

20+
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
21+
set (CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install CACHE PATH "${PROJECT_NAME} install prefix" FORCE)
22+
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
23+
1724
set(CMAKE_CXX_STANDARD 11)
1825
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1926
set(CMAKE_CXX_EXTENSIONS OFF)
2027
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
2128

22-
IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
23-
set (CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install CACHE PATH "${PROJECT_NAME} install prefix" FORCE)
24-
ENDIF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
25-
2629
# required to define CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR
2730
include(GNUInstallDirs)
2831

@@ -83,42 +86,30 @@ endif (WIN32)
8386
# some useful variables
8487
# ============================================================================
8588

86-
set (WITH_FESAPI OFF CACHE BOOL "Build Fetpapi with Fesapi support.")
87-
set (WITH_ETP_SSL ON CACHE BOOL "Build Fesapi with ETP SSL support.")
89+
set (WITH_FESAPI OFF CACHE BOOL "Build FETPAPI with FESAPI support.")
90+
set (WITH_ETP_SSL ON CACHE BOOL "Build FETPAPI with ETP SSL support.")
8891

8992
# ============================================================================
9093
# checking for required dependencies
9194
# ============================================================================
9295

9396
find_package (Threads)
9497

95-
# avro DEPENDENCY
96-
set (AVRO_INCLUDE_DIR AVRO_INCLUDE_DIR-NOTFOUND CACHE PATH "Path to the directory which contains the avro header files")
97-
if (NOT IS_DIRECTORY ${AVRO_INCLUDE_DIR})
98-
message(SEND_ERROR "The Avro include dir (AVRO_INCLUDE_DIR variable) does not look to be a valid directory. Please modify it.")
99-
endif ()
100-
set (AVRO_LIBRARY_RELEASE AVRO_LIBRARY_RELEASE-NOTFOUND CACHE FILEPATH "Path to the file which contains the avro library release")
101-
if (NOT EXISTS ${AVRO_LIBRARY_RELEASE})
102-
message(WARNING "The avro library (AVRO_LIBRARY_RELEASE variable) does not look to be a valid file. Please modify it.")
103-
endif ()
104-
set (AVRO_LIBRARY_DEBUG AVRO_LIBRARY_DEBUG-NOTFOUND CACHE FILEPATH "Path to the file which contains the AVRO library DEBUG")
105-
if (NOT EXISTS ${AVRO_LIBRARY_DEBUG})
106-
message(WARNING "The AVRO library (AVRO_LIBRARY_DEBUG variable) does not look to be a valid file. Please modify it.")
98+
# Boost DEPENDENCY
99+
find_package(Boost 1.70)
100+
if (NOT Boost_FOUND)
101+
# Boost system is required for Beast untill version 1.70 : https://www.boost.org/doc/libs/1_69_0/libs/beast/doc/html/beast/introduction.html
102+
find_package(Boost 1.66 REQUIRED system)
103+
endif()
104+
if (WIN32 AND (Boost_VERSION_MAJOR EQUAL 1) AND (Boost_VERSION_MINOR LESS 74) AND (Boost_VERSION_MINOR GREATER 71))
105+
message(WARNING "You may experience min/max issue with this boost version : See https://github.com/boostorg/beast/issues/1980")
107106
endif ()
108107

108+
# avro DEPENDENCY
109+
find_package(AVRO REQUIRED)
110+
109111
if (WITH_FESAPI)
110-
set (FESAPI_INCLUDE_DIR FESAPI_INCLUDE_DIR-NOTFOUND CACHE PATH "Path to the directory which contains the FESAPI header files")
111-
if (NOT IS_DIRECTORY ${FESAPI_INCLUDE_DIR})
112-
message(SEND_ERROR "The FESAPI include dir (FESAPI_INCLUDE_DIR variable) does not look to be a valid directory. Please modify it.")
113-
endif ()
114-
set (FESAPI_LIBRARY_RELEASE FESAPI_LIBRARY_RELEASE-NOTFOUND CACHE FILEPATH "Path to the file which contains the FESAPI library release")
115-
if (NOT EXISTS ${FESAPI_LIBRARY_RELEASE})
116-
message(WARNING "The FESAPI library (FESAPI_LIBRARY_RELEASE variable) does not look to be a valid file. Please modify it.")
117-
endif ()
118-
set (FESAPI_LIBRARY_DEBUG FESAPI_LIBRARY_DEBUG-NOTFOUND CACHE FILEPATH "Path to the file which contains the FESAPI library DEBUG")
119-
if (NOT EXISTS ${FESAPI_LIBRARY_DEBUG})
120-
message(WARNING "The FESAPI library (FESAPI_LIBRARY_DEBUG variable) does not look to be a valid file. Please modify it.")
121-
endif ()
112+
find_package(FESAPI REQUIRED)
122113
if (WITH_JAVA_WRAPPING)
123114
set (FESAPI_JAR FESAPI_JAR-NOTFOUND CACHE FILEPATH "Path to the jar of FESAPI")
124115
if (NOT EXISTS ${FESAPI_JAR})
@@ -127,27 +118,14 @@ if (WITH_FESAPI)
127118
endif (WITH_JAVA_WRAPPING)
128119
endif (WITH_FESAPI)
129120

130-
131-
# Boost DEPENDENCY
132-
find_package(Boost 1.66.0 REQUIRED system)
133-
if (WIN32 AND (Boost_VERSION_MAJOR EQUAL 1) AND (Boost_VERSION_MINOR LESS 74) AND (Boost_VERSION_MINOR GREATER 71))
134-
message(WARNING "You may experience min/max issue with this boost version : See https://github.com/boostorg/beast/issues/1980")
135-
endif ()
136-
137121
target_compile_definitions(${PROJECT_NAME} PRIVATE BOOST_ALL_NO_LIB)
138-
139-
target_link_libraries (${PROJECT_NAME} PRIVATE ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
122+
target_link_libraries (${PROJECT_NAME} PRIVATE AVRO::AVRO ${CMAKE_THREAD_LIBS_INIT})
123+
if (DEFINED Boost_SYSTEM_LIBRARY)
124+
target_link_libraries (${PROJECT_NAME} PRIVATE ${Boost_SYSTEM_LIBRARY})
125+
endif()
140126
if (WIN32)
141127
target_link_libraries (${PROJECT_NAME} PRIVATE bcrypt.lib)
142128

143-
if (EXISTS ${AVRO_LIBRARY_RELEASE} AND EXISTS ${AVRO_LIBRARY_DEBUG})
144-
target_link_libraries (${PROJECT_NAME} PRIVATE optimized ${AVRO_LIBRARY_RELEASE} debug ${AVRO_LIBRARY_DEBUG})
145-
elseif (EXISTS ${AVRO_LIBRARY_RELEASE})
146-
target_link_libraries (${PROJECT_NAME} PRIVATE ${AVRO_LIBRARY_RELEASE})
147-
elseif (EXISTS ${AVRO_LIBRARY_DEBUG})
148-
target_link_libraries (${PROJECT_NAME} PRIVATE ${AVRO_LIBRARY_DEBUG})
149-
endif ()
150-
151129
set_target_properties(${PROJECT_NAME} PROPERTIES
152130
PDB_NAME ${PROJECT_NAME}.${Fetpapi_VERSION}
153131
PDB_NAME_DEBUG ${PROJECT_NAME}${CMAKE_DEBUG_POSTFIX}.${Fetpapi_VERSION}
@@ -158,8 +136,6 @@ if (WIN32)
158136
VERSION ${Fetpapi_VERSION_MAJOR}.${Fetpapi_VERSION_MINOR}
159137
)
160138
else (WIN32)
161-
target_link_libraries (${PROJECT_NAME} PRIVATE ${AVRO_LIBRARY_RELEASE})
162-
163139
set_target_properties(${PROJECT_NAME} PROPERTIES
164140
VERSION ${Fetpapi_VERSION}
165141
SOVERSION ${Fetpapi_VERSION_MAJOR}.${Fetpapi_VERSION_MINOR})
@@ -174,17 +150,7 @@ if (WITH_ETP_SSL)
174150
endif ()
175151

176152
if (WITH_FESAPI)
177-
if (WIN32)
178-
if (EXISTS ${FESAPI_LIBRARY_RELEASE} AND EXISTS ${FESAPI_LIBRARY_DEBUG})
179-
target_link_libraries (${PROJECT_NAME} PRIVATE optimized ${FESAPI_LIBRARY_RELEASE} debug ${FESAPI_LIBRARY_DEBUG})
180-
elseif (EXISTS ${FESAPI_LIBRARY_RELEASE})
181-
target_link_libraries (${PROJECT_NAME} PRIVATE ${FESAPI_LIBRARY_RELEASE})
182-
elseif (EXISTS ${FESAPI_LIBRARY_DEBUG})
183-
target_link_libraries (${PROJECT_NAME} PRIVATE ${FESAPI_LIBRARY_DEBUG})
184-
endif ()
185-
else (WIN32)
186-
target_link_libraries (${PROJECT_NAME} PRIVATE ${FESAPI_LIBRARY_RELEASE})
187-
endif (WIN32)
153+
target_link_libraries(${PROJECT_NAME} PRIVATE FESAPI::FESAPI)
188154
endif (WITH_FESAPI)
189155

190156
# Namespaces definitions
@@ -292,6 +258,16 @@ if (WITH_FESAPI)
292258
endif (WITH_TEST)
293259
endif (WITH_FESAPI)
294260

261+
set (WITH_EXAMPLE OFF CACHE BOOL "Also builds and installs an ETP1.2 client example.")
262+
if (WITH_EXAMPLE)
263+
if (WITH_FESAPI)
264+
add_subdirectory(example/withFesapi)
265+
else ()
266+
add_subdirectory(example/withoutFesapi)
267+
endif (WITH_FESAPI)
268+
endif (WITH_EXAMPLE)
269+
270+
295271
# ============================================================================
296272
# Install Fetpapi library
297273
# ============================================================================

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- dependencies
88
- The following compilers are known to work (used in CI)
99
- gcc from version 4.8
10-
- visual studio from version 2017
10+
- visual studio from version 2019
1111
# Prepare the dependencies
1212
Download (build and install if necessary) third party libraries:
1313
- BOOST : All versions from version 1.66 should be ok but you may experience some [min/max build issues](https://github.com/boostorg/beast/issues/1980) using version 1.72 or 1.73.
@@ -27,10 +27,8 @@ FETPAPI uses cmake as its build tool. A 3.12 version or later of cmake is requir
2727
- give real path and files to the following cmake variables:
2828
- BOOST
2929
- Boost_INCLUDE_DIR : the directory where you can find the directory named "boost" which contain all BOOST headers
30-
- AVRO
31-
- AVRO_INCLUDE_DIR : where the "avro" directory containing all AVRO headers is located
32-
- (ONLY FOR WINDOWS) AVRO_LIBRARY_DEBUG : Optional, only used by Visual studio Debug configuration, the Avro debug library you want to link to.
33-
- AVRO_LIBRARY_RELEASE : the AVRO system library you want to link to.
30+
- AVRO (using [our own cmake find module](./cmake/modules/FindAVRO.cmake))
31+
- (ONLY IF NOT AUTOMATICALLY FOUND) AVRO_ROOT : The path to the folder containing include and lib folders of AVRO
3432
- Click again on "Configure" button. You should no more have errors so you can now click on "Generate" button.
3533
- You can now build your solution with your favorite compiler (and linker) using the generated solution in yourPath/fesapiEnv/build/theNameYouWant
3634
- OPTIONALLY, you can also set the variables WITH_DOTNET_WRAPPING, WITH_PYTHON_WRAPPING to true if you want to also generate wrappers on top of FETPAPI for these two other programming languages. Don't forget to click again on "Configure" button once you changed the value of these two variables.
@@ -40,10 +38,8 @@ FETPAPI uses cmake as its build tool. A 3.12 version or later of cmake is requir
4038
- OPENSSL_INCLUDE_DIR : the OpenSSL include directory
4139
- LIB_EAY_RELEASE : the OpenSSL crypto library you want to link with.
4240
- SSL_EAY_RELEASE : the OpenSSL ssl library you want to link with.
43-
- OPTIONALLY, for FESAPI (v2.7.0.0 as a minimal version) support (see [here](https://github.com/F2I-Consulting/fesapi) for documentation on how to build fesapi), please enable the WITH_FESAPI variable and set the following variables :
44-
- FESAPI_INCLUDE_DIR : the directory where the FESAPI headers are located (generally the include subdirectory of the fesapi installation directory).
45-
- (ONLY FOR WINDOWS) FESAPI_LIBRARY_DEBUG : Optional, only used by Visual studio Debug configuration, the FESAPI debug library you want to link to.
46-
- FESAPI_LIBRARY_RELEASE : the FESAPI library you want to link to.
41+
- OPTIONALLY, for FESAPI (v2.7.0.0 as a minimal version) support (see [here](https://github.com/F2I-Consulting/fesapi) for documentation on how to build fesapi), please enable the WITH_FESAPI variable and usually set the following variable :
42+
- FESAPI_ROOT : The path to the folder containing include and lib folders of FESAPI (using [our own cmake find module](./cmake/modules/FindFESAPI.cmake))
4743

4844
Remark : you can choose where FETPAPI will be installed (using "make install" on Linux or by generating the "INSTALL" project on Visual Studio) by setting the cmake variable called CMAKE_INSTALL_PREFIX
4945
# How to start

cmake/modules/FindAVRO.cmake

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2+
# file Copyright.txt or https://cmake.org/licensing for details.
3+
4+
#[=======================================================================[.rst:
5+
AVRO
6+
--------
7+
8+
Find the native AVRO includes and library.
9+
Heavily inspired by the official FindZLIB cmake module v3.27.
10+
11+
IMPORTED Targets
12+
^^^^^^^^^^^^^^^^
13+
14+
This module defines :prop_tgt:`IMPORTED` target ``AVRO::AVRO``, if
15+
AVRO has been found.
16+
17+
Result Variables
18+
^^^^^^^^^^^^^^^^
19+
20+
This module defines the following variables:
21+
22+
::
23+
24+
AVRO_INCLUDE_DIRS - where to find zip.h, unzip.h, etc.
25+
AVRO_LIBRARIES - List of libraries when using avro.
26+
AVRO_FOUND - True if avro found.
27+
28+
Hints
29+
^^^^^
30+
31+
A user may set ``AVRO_ROOT`` to a avro installation root to tell this
32+
module where to look.
33+
#]=======================================================================]
34+
include(SelectLibraryConfigurations)
35+
36+
set(_AVRO_SEARCHES)
37+
38+
# Search AVRO_ROOT first if it is set.
39+
if(AVRO_ROOT)
40+
set(_AVRO_SEARCH_ROOT PATHS ${AVRO_ROOT} NO_DEFAULT_PATH)
41+
list(APPEND _AVRO_SEARCHES _AVRO_SEARCH_ROOT)
42+
endif()
43+
44+
# Normal search.
45+
set(_AVRO_x86 "(x86)")
46+
set(_AVRO_SEARCH_NORMAL
47+
PATHS "$ENV{ProgramFiles}/avro"
48+
"$ENV{ProgramFiles${_AVRO_x86}}/avro")
49+
unset(_AVRO_x86)
50+
list(APPEND _AVRO_SEARCHES _AVRO_SEARCH_NORMAL)
51+
52+
set(AVRO_NAMES avrocpp avrocpp_s)
53+
set(AVRO_NAMES_DEBUG avrod avrocpp_d avrocpp_s_d)
54+
55+
# Try each search configuration.
56+
foreach(search ${_AVRO_SEARCHES})
57+
find_path(AVRO_INCLUDE_DIR NAMES avro/AvroParse.hh ${${search}} PATH_SUFFIXES include)
58+
endforeach()
59+
60+
# Allow AVRO_LIBRARY to be set manually, as the location of the zlib library
61+
if(NOT AVRO_LIBRARY)
62+
foreach(search ${_AVRO_SEARCHES})
63+
find_library(AVRO_LIBRARY_RELEASE NAMES ${AVRO_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
64+
find_library(AVRO_LIBRARY_DEBUG NAMES ${AVRO_NAMES_DEBUG} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
65+
endforeach()
66+
67+
select_library_configurations(AVRO)
68+
endif()
69+
70+
unset(AVRO_NAMES)
71+
unset(AVRO_NAMES_DEBUG)
72+
73+
mark_as_advanced(AVRO_INCLUDE_DIR)
74+
75+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVRO REQUIRED_VARS AVRO_LIBRARY AVRO_INCLUDE_DIR)
76+
77+
if(AVRO_FOUND)
78+
set(AVRO_INCLUDE_DIRS ${AVRO_INCLUDE_DIR})
79+
80+
if(NOT AVRO_LIBRARIES)
81+
set(AVRO_LIBRARIES ${AVRO_LIBRARY})
82+
endif()
83+
84+
if(NOT TARGET AVRO::AVRO)
85+
add_library(AVRO::AVRO UNKNOWN IMPORTED)
86+
set_target_properties(AVRO::AVRO PROPERTIES
87+
INTERFACE_INCLUDE_DIRECTORIES "${AVRO_INCLUDE_DIRS}")
88+
89+
if(AVRO_LIBRARY_RELEASE)
90+
set_property(TARGET AVRO::AVRO APPEND PROPERTY
91+
IMPORTED_CONFIGURATIONS RELEASE)
92+
set_target_properties(AVRO::AVRO PROPERTIES
93+
IMPORTED_LOCATION_RELEASE "${AVRO_LIBRARY_RELEASE}")
94+
endif()
95+
96+
if(AVRO_LIBRARY_DEBUG)
97+
set_property(TARGET AVRO::AVRO APPEND PROPERTY
98+
IMPORTED_CONFIGURATIONS DEBUG)
99+
set_target_properties(AVRO::AVRO PROPERTIES
100+
IMPORTED_LOCATION_DEBUG "${AVRO_LIBRARY_DEBUG}")
101+
endif()
102+
103+
if(NOT AVRO_LIBRARY_RELEASE AND NOT AVRO_LIBRARY_DEBUG)
104+
set_property(TARGET AVRO::AVRO APPEND PROPERTY
105+
IMPORTED_LOCATION "${AVRO_LIBRARY}")
106+
endif()
107+
endif()
108+
endif()

0 commit comments

Comments
 (0)