xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. add_rules("mode.debug", "mode.release")
  2. add_includedirs("include", {public = true})
  3. -- ENABLE_INTEL_RDRAND
  4. option("ENABLE_INTEL_RDRAND")
  5. set_default(false)
  6. set_showmenu(true)
  7. set_description("Enable Intel RDRAND")
  8. -- ENABLE_SM4_AESNI_AVX
  9. option("ENABLE_SM4_AESNI_AVX")
  10. set_default(false)
  11. set_showmenu(true)
  12. set_description("Enable SM4 AESNI AVX")
  13. target("gmssl")
  14. set_kind("static")
  15. set_languages("c11", "c++17")
  16. add_files(
  17. "src/*.c" ..
  18. "|rand_win.c|rand_apple.c|rand_unix.c|http_win.c|http.c" ..
  19. "|gf128_avx.c|rdrand.c|sm3_x8_avx2.c|sm4_aesni_avx.c|sm4_cl.c",
  20. "src/skf/*.c",
  21. "src/sdf/*.c"
  22. )
  23. if is_host("windows") then
  24. add_files("src/rand_win.c", "src/http_win.c")
  25. elseif is_host("macosx") then
  26. add_files("src/rand_apple.c", "src/http.c")
  27. elseif is_host("linux") then
  28. add_files("src/rand_unix.c", "src/http.c")
  29. else
  30. add_files("src/rand.c", "src/http.c")
  31. end
  32. if has_config("ENABLE_INTEL_RDRAND") then
  33. add_files("src/rdrand.c")
  34. end
  35. if has_config("ENABLE_SM4_AESNI_AVX") then
  36. add_files("src/sm4_aesni_avx.c")
  37. end
  38. add_syslinks("pthread", "dl", "rt")
  39. add_rpathdirs("$ORIGIN")
  40. add_rpathdirs("$ORIGIN/../lib")
  41. if is_host("linux") then
  42. add_cxflags("-fPIC", "-fexceptions")
  43. add_ldflags("-fPIC", "-fexceptions")
  44. end
  45. target_end()