build_clibs_linux.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. set -e
  2. build_lib_x64_release() {
  3. src=$1
  4. dst=$2
  5. backend=$3
  6. libs=$4
  7. echo $dst
  8. # static
  9. cc -pthread -c -O2 -DNDEBUG -DIMPL -D$backend c/$src.c
  10. ar rcs $dst.a $src.o
  11. # shared
  12. cc -pthread -shared -O2 -fPIC -DNDEBUG -DIMPL -D$backend -o $dst.so c/$src.c $libs
  13. }
  14. build_lib_x64_debug() {
  15. src=$1
  16. dst=$2
  17. backend=$3
  18. libs=$4
  19. echo $dst
  20. # static
  21. cc -pthread -c -g -DIMPL -D$backend c/$src.c
  22. ar rcs $dst.a $src.o
  23. # shared
  24. cc -pthread -shared -g -fPIC -DIMPL -D$backend -o $dst.so c/$src.c $libs
  25. }
  26. # x64 + GL + Release
  27. build_lib_x64_release sokol_log log/sokol_log_linux_x64_gl_release SOKOL_GLCORE
  28. build_lib_x64_release sokol_gfx gfx/sokol_gfx_linux_x64_gl_release SOKOL_GLCORE
  29. build_lib_x64_release sokol_app app/sokol_app_linux_x64_gl_release SOKOL_GLCORE
  30. build_lib_x64_release sokol_glue glue/sokol_glue_linux_x64_gl_release SOKOL_GLCORE
  31. build_lib_x64_release sokol_time time/sokol_time_linux_x64_gl_release SOKOL_GLCORE
  32. build_lib_x64_release sokol_audio audio/sokol_audio_linux_x64_gl_release SOKOL_GLCORE "-lasound"
  33. build_lib_x64_release sokol_debugtext debugtext/sokol_debugtext_linux_x64_gl_release SOKOL_GLCORE
  34. build_lib_x64_release sokol_shape shape/sokol_shape_linux_x64_gl_release SOKOL_GLCORE
  35. build_lib_x64_release sokol_gl gl/sokol_gl_linux_x64_gl_release SOKOL_GLCORE
  36. # x64 + GL + Debug
  37. build_lib_x64_debug sokol_log log/sokol_log_linux_x64_gl_debug SOKOL_GLCORE
  38. build_lib_x64_debug sokol_gfx gfx/sokol_gfx_linux_x64_gl_debug SOKOL_GLCORE
  39. build_lib_x64_debug sokol_app app/sokol_app_linux_x64_gl_debug SOKOL_GLCORE
  40. build_lib_x64_debug sokol_glue glue/sokol_glue_linux_x64_gl_debug SOKOL_GLCORE
  41. build_lib_x64_debug sokol_time time/sokol_time_linux_x64_gl_debug SOKOL_GLCORE
  42. build_lib_x64_debug sokol_audio audio/sokol_audio_linux_x64_gl_debug SOKOL_GLCORE "-lasound"
  43. build_lib_x64_debug sokol_debugtext debugtext/sokol_debugtext_linux_x64_gl_debug SOKOL_GLCORE
  44. build_lib_x64_debug sokol_shape shape/sokol_shape_linux_x64_gl_debug SOKOL_GLCORE
  45. build_lib_x64_debug sokol_gl gl/sokol_gl_linux_x64_gl_debug SOKOL_GLCORE
  46. rm *.o