meson.build 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. project(
  2. 'slim',
  3. ['c', 'cpp'],
  4. default_options : ['default_library=static'],
  5. )
  6. add_global_arguments('-Wall', language: 'cpp')
  7. add_global_arguments('-g', language: 'cpp')
  8. add_global_arguments('-O2', language: 'cpp')
  9. # Version
  10. slim_version_major = '1'
  11. slim_version_minor = '3'
  12. slim_version_patch = '6'
  13. slim_version = '${SLIM_VERSION_MAJOR}.${SLIM_VERSION_MINOR}.${SLIM_VERSION_PATCH}'
  14. add_global_arguments('-DVERSION=${slim_version}', language: 'cpp')
  15. cmake_install_prefix = ['/usr/local', 'CACHE', 'PATH', 'Installation Directory']
  16. pkgdatadir = '${CMAKE_INSTALL_PREFIX}/share/slim'
  17. sysconfdir = '/etc'
  18. libdir = '/lib'
  19. mandir = '${CMAKE_INSTALL_PREFIX}/share/man'
  20. slim_definitions = [
  21. '-DHAVE_SHADOW',
  22. '-DPACKAGE="slim"',
  23. '-DVERSION="1.3.6"',
  24. '-DPKGDATADIR="/usr/local/share/slim"',
  25. '-DSYSCONFDIR="/etc"']
  26. add_global_arguments(slim_definitions, language: 'cpp')
  27. # Flags
  28. cmake_c_flags = '${CMAKE_C_FLAGS} -Wall -g -O2'
  29. cmake_cpp_flags = '${CMAKE_CPP_FLAGS} -Wall -g -O2'
  30. cmake_cxx_flags = '${CMAKE_CXX_FLAGS} -Wall -g -O2'
  31. # source
  32. slim_srcs = ['main.cpp', 'app.cpp', 'numlock.cpp', 'switchuser.cpp', 'png.c', 'jpeg.c']
  33. slimlock_srcs = 'slimlock.cpp'
  34. common_srcs = ['cfg.cpp', 'image.cpp', 'log.cpp', 'panel.cpp', 'util.cpp']
  35. use_pam = true
  36. build_rust = find_program('build_rust.sh')
  37. rusty = custom_target(
  38. 'rusty',
  39. output: ['libslim.a'],
  40. command: [build_rust, meson.current_source_dir()],
  41. )
  42. cc = meson.get_compiler('cpp')
  43. deps = [
  44. cc.find_library('m'),
  45. cc.find_library('crypt'),
  46. dependency('freetype2'),
  47. dependency('x11'),
  48. dependency('xmu'),
  49. dependency('xft'),
  50. dependency('xrandr'),
  51. dependency('JPEG'),
  52. dependency('PNG'),
  53. dependency('ZLIB'),
  54. dependency('fontconfig'),
  55. ]
  56. ck = dependency('libconsolekit', required: false)
  57. ck_conn = dependency('ck-connector', required: false)
  58. if ck.found() and ck_conn.found()
  59. deps += [ck, ck_conn]
  60. slim_srcs += ['Ck.cpp']
  61. else
  62. endif
  63. if use_pam
  64. common_srcs += ['PAM.cpp']
  65. # for now, only build slimlock if we are using PAM.
  66. build_slimlock = '1'
  67. endif
  68. # Build common library
  69. build_shared_libs = true
  70. if build_shared_libs
  71. # message(['STATUS', 'Enable shared library building'])
  72. libslim_lib = library('libslim', common_srcs, dependencies: deps, include_directories: [include_directories('.')])
  73. else
  74. # message(['STATUS', 'Disable shared library building'])
  75. libslim_lib = static_library('libslim', common_srcs, dependencies: deps)
  76. endif
  77. # if true
  78. # slimlock_exe = executable('slimlock', slimlock_srcs)
  79. # endif
  80. # #Set the custom CMake module directory where our include/lib finders are
  81. # cmake_module_path = '${CMAKE_SOURCE_DIR}/cmake/modules'
  82. slim_exe = executable('slim', slim_srcs, dependencies: deps, include_directories: [include_directories('.')], link_with: [libslim_lib, rusty])
  83. # # Fontconfig
  84. # fontconfig_dir = cmake_module_path
  85. # # PAM
  86. # if false
  87. # # message('\tPAM Enabled')
  88. # PAM_dep = dependency('PAM')
  89. # if 'PAM_FOUND'
  90. # # message('\tPAM Found')
  91. # slim_definitions = [slim_definitions, '-DUSE_PAM']
  92. # # target_link_libraries([project_name, pam_library])
  93. # # target_link_libraries(['slimlock', pam_library])
  94. # # include_directories(pam_include_dir)
  95. # else
  96. # # message('\tPAM Not Found')
  97. # endif
  98. # else
  99. # # message('\tPAM disabled')
  100. # endif
  101. # # ConsoleKit
  102. # use_consolekit = false
  103. # if use_consolekit
  104. # CkConnector_dep = dependency('CkConnector')
  105. # # message('\tConsoleKit Enabled')
  106. # if 'CKCONNECTOR_FOUND'
  107. # # message('\tConsoleKit Found')
  108. # # DBus check
  109. # DBus_dep = dependency('DBus')
  110. # if 'DBUS_FOUND'
  111. # # message('\tDBus Found')
  112. # # target_link_libraries([project_name, dbus_libraries])
  113. # # include_directories(dbus_arch_include_dir)
  114. # # include_directories(dbus_include_dir)
  115. # slim_definitions = [slim_definitions, '-DUSE_CONSOLEKIT']
  116. # # target_link_libraries([project_name, ckconnector_libraries])
  117. # # include_directories(ckconnector_include_dir)
  118. # else
  119. # # message('\tDBus Not Found')
  120. # endif
  121. # else
  122. # # message('\tConsoleKit Not Found')
  123. # # message('\tConsoleKit disabled')
  124. # endif
  125. # else
  126. # # message('\tConsoleKit disabled')
  127. # endif
  128. # # system librarys