CppRestApi environment settings
Share
unix or mac
・Unzip cpprestapi.
tar -xvzf cpprestapi.tar.gz
・Download CDash and mysql-connector-cpp.
cd /path_to/cpprestapi/ThirdParty
sh setup.sh
I will write about CDash in a separate article later.
・Create a container for the Ubuntu execution environment.
Comment out the last three lines in /path_to/cpprestapi/Dockerfile.
#COPY . /CppRestApi
#WORKDIR /CppRestApi/ThirdParty/mysql-connector-cpp
#RUN cmake --build . --target install
・Launch Docker.
cd /path_to/cpprestapi
docker compose up
Build mysql-connector-cpp in the ubuntu container (build it twice because the first build will give a protobuf link error).
Find your cpp container name in docker-compose ps.
docker container exec -it container name bash
cd /CppRestApi/ThirdParty/mysql-connector-cpp
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON .
cmake --build .
cmake --build .
・Once the build of mysql-connector-cpp is complete, remove the comment out line.
Uncomment the three lines at the bottom of /path_to/cpprestapi/Dockerfile.
COPY . /CppRestApi
WORKDIR /CppRestApi/ThirdParty/mysql-connector-cpp
RUN cmake --build . --target install
Build the container again.
cd /path_to/cpprestapi
docker compose build cpp
・Build cpprestapi.
cd /CppRestApi/scripts
sh build.sh
cd /CppRestApi/build
Test Run
ctest
Server Start
src/server
This completes the environment setup.