compile.sh 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. #! /bin/sh
  2. DB_FLAG=$1
  3. COMMIT="$2"
  4. if [ "$COMMIT" = "" ]; then
  5. COMMIT="a046b3345098157849d9e2ab49a475aaabf4a90f"
  6. fi
  7. if [ $DB_FLAG = "TFB_MYSQL" ]; then
  8. CXX_FLAGS="-I /usr/include/mariadb -lmariadbclient "
  9. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
  10. elif [ $DB_FLAG = "TFB_PGSQL" ]; then
  11. CXX_FLAGS="-lpthread -L/usr/lib -lpq -I/postgres-bab150045bd9766869f471ede88734ea0989261c/src/include"
  12. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
  13. fi
  14. COMPILER="clang++"
  15. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_server.hh
  16. if [ $COMPILER = "clang++" ]; then
  17. clang++ -fprofile-instr-generate=./profile.prof -flto -DLITHIUM_SERVER_NAME=l -DPROFILE_MODE -DNDEBUG -D$DB_FLAG -O3 -march=native -std=c++17 ./lithium.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf
  18. /lithium_tbf tfb-database 8081
  19. llvm-profdata-10 merge -output=./profile.pgo ./profile.prof
  20. clang++ -fprofile-instr-use=./profile.pgo -flto -DLITHIUM_SERVER_NAME=l -DNDEBUG -D$DB_FLAG -O3 -march=native -std=c++17 ./lithium.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf
  21. else
  22. g++ -flto -DLITHIUM_SERVER_NAME=l -DNDEBUG -D$DB_FLAG -O3 -march=native -std=c++17 ./lithium.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf
  23. fi
  24. /lithium_tbf tfb-database 8080