CMakeLists.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. cmake_minimum_required(VERSION 3.15)
  2. project(gblibc)
  3. add_library(gblibc STATIC
  4. src/stdio.c
  5. src/arithmetic.c
  6. src/string.c
  7. src/fcntl.c
  8. src/unistd.c
  9. src/wait.c
  10. src/assert.c
  11. src/dirent.c
  12. src/ctype.c
  13. src/stdlib.c
  14. src/errno.c
  15. src/init.c
  16. src/internal.c
  17. src/stat.c
  18. src/time.c
  19. src/signal.c
  20. src/platform-independent.s
  21. )
  22. add_library(gblibc_32 STATIC
  23. src/stdio.c
  24. src/arithmetic.c
  25. src/string.c
  26. src/fcntl.c
  27. src/unistd.c
  28. src/wait.c
  29. src/assert.c
  30. src/dirent.c
  31. src/ctype.c
  32. src/stdlib.c
  33. src/errno.c
  34. src/init.c
  35. src/internal.c
  36. src/stat.c
  37. src/time.c
  38. src/signal.c
  39. src/platform-independent.s
  40. )
  41. add_library(crt0_32 OBJECT
  42. src/crt0.s
  43. )
  44. target_compile_options(gblibc_32 PRIVATE "-fno-pic")
  45. target_compile_options(gblibc_32 PRIVATE "-mcmodel=32")
  46. target_compile_options(gblibc_32 PRIVATE "-m32")
  47. target_compile_options(crt0_32 PRIVATE "-fno-pic")
  48. target_compile_options(crt0_32 PRIVATE "-m32")
  49. target_compile_options(crt0_32 PRIVATE "-mcmodel=32")
  50. target_link_options(gblibc_32 PRIVATE "LINKER:-melf_i386")
  51. target_link_options(crt0_32 PRIVATE "LINKER:-melf_i386")
  52. file(GLOB_RECURSE GBLIBC_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include)
  53. target_include_directories(gblibc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
  54. PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/private-include)
  55. set_target_properties(gblibc PROPERTIES PRIVATE_HEADER
  56. "private-include/devutil.h,private-include/syscall.h")
  57. set_target_properties(gblibc PROPERTIES PUBLIC_HEADER "${GBLIBC_PUBLIC_HEADERS}")
  58. target_include_directories(gblibc_32 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
  59. PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/private-include)
  60. set_target_properties(gblibc_32 PROPERTIES PRIVATE_HEADER
  61. "private-include/devutil.h,private-include/syscall.h")
  62. set_target_properties(gblibc_32 PROPERTIES PUBLIC_HEADER "${GBLIBC_PUBLIC_HEADERS}")