Skip to content

Commit

Permalink
Add docker to build in docker
Browse files Browse the repository at this point in the history
Signed-off-by: Kunlin Yu <[email protected]>
  • Loading branch information
kunlinyu committed Dec 26, 2024
1 parent 274c570 commit 9fee2cf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ project(cql2cpp
LANGUAGES CXX
)

find_package(gflags REQUIRED)
find_package(GTest REQUIRED)
find_package(geos REQUIRED)
find_package(glog REQUIRED)

find_package(GFlags QUIET)
find_package(gflags QUIET)
if (NOT GFlags-FOUND AND NOT gflags_FOUND)
message(FATAL_ERROR "can not find gflags")
endif()

include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR})

Expand All @@ -37,14 +42,17 @@ add_custom_command(
COMMENT "Generating ${BISON_OUTPUT} from ${BISON_FILE} using bison++"
)

add_definitions(-DUSE_UNSTABLE_GEOS_CPP_API)

# library
add_library(cql2cpp src/id_generator.cc src/ast_node.cc ${FLEX_OUTPUT} ${BISON_OUTPUT})
target_compile_options(cql2cpp PRIVATE -Wno-register -Wno-write-strings)
target_link_libraries(cql2cpp gflags::gflags GEOS::geos_c glog::glog)
target_link_libraries(cql2cpp GEOS::geos glog::glog)

# CLI tool
add_executable(cql2 src/main.cc)
target_compile_options(cql2 PRIVATE -Wno-register -Wno-write-strings)
target_link_libraries(cql2 cql2cpp gflags::gflags GEOS::geos_c glog::glog)
target_link_libraries(cql2 cql2cpp GEOS::geos glog::glog)

# Test
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ c++ library for OGC CQL2(Common Query Language)

## build
```bash
conan install . --output-folder build
conan install . --build=missing --output-folder build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=build -DCMAKE_MODULE_PATH=build
```
25 changes: 25 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

# install basic tools
RUN apt-get install -y sudo
RUN apt-get install -y curl wget iputils-ping
RUN apt-get install -y build-essential pkg-config
RUN apt-get install -y file gdb
RUN apt-get install -y git cmake repo
RUN apt-get install -y vim tree silversearcher-ag

# install toolchain
RUN apt-get install -y gcc-aarch64-linux-gnu
RUN apt-get install -y g++-aarch64-linux-gnu

# install dependencies
RUN apt-get install -y flex bison++
RUN apt-get install -y libgflags-dev libgoogle-glog-dev libgtest-dev
RUN apt-get install -y libgeos++-dev

USER ubuntu
WORKDIR /home/ubuntu/
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(int argc, char** argv) {
if (cql2cpp.filter(FLAGS_cql2_query, &result)) {
LOG(INFO) << "get feature count: " << result.size();
for (const auto& feature : result) {
LOG(INFO) << "get feature id " << feature->getId();
LOG(INFO) << "get feature geometry: " << feature->getGeometry()->toText();
}
} else {
LOG(ERROR) << "filter error: " << cql2cpp.error_msg();
Expand Down

0 comments on commit 9fee2cf

Please sign in to comment.