compile.sh 1.4 KB

123456789101112131415161718192021222324252627
  1. #! /bin/sh
  2. DB_FLAG=$1
  3. COMMIT=e199537f15abce7cf25c0b4de0f14461a1f426ec
  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="-lpthread -L/usr/lib -lpq -I/postgres-bab150045bd9766869f471ede88734ea0989261c/src/include"
  9. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
  10. fi
  11. COMPILER="clang++"
  12. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_server.hh
  13. if [ $COMPILER = "clang++" ]; then
  14. 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
  15. /lithium_tbf tfb-database 8081
  16. llvm-profdata-10 merge -output=./profile.pgo ./profile.prof
  17. 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
  18. else
  19. 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
  20. fi
  21. /lithium_tbf tfb-database 8080