Warning, /pim/kitinerary/src/knowledgedb-generator/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2018-2020 Volker Krause <vkrause@kde.org>
0002 # SPDX-License-Identifier: BSD-3-Clause
0003 
0004 add_executable(generate-knowledgedb
0005     main.cpp
0006     codegen.cpp
0007     timezones.cpp
0008     wikidata.cpp
0009     airportdbgenerator.cpp
0010     countrydbgenerator.cpp
0011     osmairportdb.cpp
0012     trainstationdbgenerator.cpp
0013     util.cpp
0014     ../lib/stringutil.cpp
0015     ../lib/knowledgedb/airportnametokenizer.cpp
0016     ../lib/knowledgedb/alphaid.cpp
0017     ../lib/knowledgedb/iatacode.cpp
0018     ../lib/knowledgedb/stationidentifier.cpp
0019 )
0020 target_compile_definitions(generate-knowledgedb PRIVATE "KITINERARY_STATIC_DEFINE")
0021 target_include_directories(generate-knowledgedb PRIVATE
0022     ${CMAKE_CURRENT_SOURCE_DIR}/../lib/knowledgedb
0023     ${CMAKE_CURRENT_BINARY_DIR}/../lib
0024 )
0025 target_link_libraries(generate-knowledgedb PRIVATE Qt::Network Qt::Gui KOSM KF6::Codecs)
0026 # extract all elements we are interested in (airports, terminals, stations at airports)
0027 osm_filter(OUTPUT airports.o5m FILTER --keep=\"iata=* or aeroway=terminal or public_transport=station or railway=station or railway=halt or railway=tram_stop\")
0028 
0029 # augment bounding box information
0030 osm_convert(INPUT airports.o5m OUTPUT airports-bbox.o5m ADD_BBOX ON)
0031 
0032 # convert the output to OSM XML format, so the code generator can consume it
0033 osm_convert(INPUT airports-bbox.o5m OUTPUT airports-bbox.osm)
0034 
0035 set(outfiles "")
0036 function(generate_db dbtype outfile)
0037     set(extra_args "")
0038     if (ARGN)
0039         set(extra_args "--osm-data=${ARGN}")
0040     endif()
0041     add_custom_command(
0042         OUTPUT ${outfile}
0043         COMMAND generate-knowledgedb -o ${CMAKE_CURRENT_SOURCE_DIR}/../lib/knowledgedb/${outfile} -d ${dbtype} ${extra_args}
0044         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
0045     DEPENDS
0046         ${ARGN}
0047         generate-knowledgedb
0048     )
0049     list(APPEND outfiles ${outfile})
0050     set(outfiles ${outfiles} PARENT_SCOPE)
0051 endfunction()
0052 generate_db(country countrydb_data.cpp)
0053 generate_db(airport airportdb_data.cpp ${OSM_PLANET_DIR}/airports-bbox.osm)
0054 generate_db(trainstation trainstationdb_data.cpp)
0055 
0056 add_custom_target(rebuild-knowledgedb DEPENDS ${outfiles})