compile_and_start.sh 1.1 KB

12345678910111213141516171819202122
  1. #! /bin/sh
  2. DB_FLAG=$1
  3. COMMIT=ba3849b86e004798faf91d64a1a9550e379ac53a
  4. if [ $DB_FLAG = "TFB_MYSQL" ]; then
  5. CXX_FLAGS="-I /usr/include/mariadb -lmariadbclient "
  6. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
  7. elif [ $DB_FLAG = "TFB_PGSQL" ]; then
  8. CXX_FLAGS="-I/usr/include/postgresql -I /usr/include/postgresql/12/server -lpthread -lpq"
  9. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
  10. fi
  11. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh
  12. clang++ -fprofile-instr-generate=./profile.prof -flto -DPROFILE_MODE -DNDEBUG -D$DB_FLAG -O3 -march=native -std=c++17 ./lithium.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf
  13. /lithium_tbf tfb-database 8081
  14. llvm-profdata-10 merge -output=./profile.pgo ./profile.prof
  15. clang++ -fprofile-instr-use=./profile.pgo -flto -DNDEBUG -D$DB_FLAG -O3 -march=native -std=c++17 ./lithium.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf
  16. /lithium_tbf tfb-database 8080