meson.build 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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: ['libslimrs.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. cc.find_library('pthread'),
  47. cc.find_library('dl'),
  48. dependency('freetype2'),
  49. dependency('x11'),
  50. dependency('xmu'),
  51. dependency('xft'),
  52. dependency('xrandr'),
  53. dependency('JPEG'),
  54. dependency('PNG'),
  55. dependency('ZLIB'),
  56. dependency('fontconfig'),
  57. ]
  58. ck = dependency('libconsolekit', required: false)
  59. ck_conn = dependency('ck-connector', required: false)
  60. if ck.found() and ck_conn.found()
  61. deps += [ck, ck_conn]
  62. slim_srcs += ['Ck.cpp']
  63. else
  64. endif
  65. if use_pam
  66. common_srcs += ['PAM.cpp']
  67. # for now, only build slimlock if we are using PAM.
  68. build_slimlock = '1'
  69. endif
  70. # Build common library
  71. build_shared_libs = true
  72. if build_shared_libs
  73. # message(['STATUS', 'Enable shared library building'])
  74. libslim_lib = library('libslim', common_srcs, dependencies: deps, include_directories: [include_directories('.')])
  75. else
  76. # message(['STATUS', 'Disable shared library building'])
  77. libslim_lib = static_library('libslim', common_srcs, dependencies: deps)
  78. endif
  79. # if true
  80. # slimlock_exe = executable('slimlock', slimlock_srcs)
  81. # endif
  82. # #Set the custom CMake module directory where our include/lib finders are
  83. # cmake_module_path = '${CMAKE_SOURCE_DIR}/cmake/modules'
  84. # combine = find_program('combine.sh')
  85. # combined = custom_target(
  86. # 'combined',
  87. # input: [rusty, libslim_lib],
  88. # output: ['libcombined.a'],
  89. # command: [combine, '@INPUT@'],
  90. # )
  91. slim_exe = executable(
  92. 'slim',
  93. slim_srcs,
  94. dependencies: deps,
  95. include_directories: [include_directories('.')],
  96. link_with: [rusty, libslim_lib],
  97. )
  98. # # Fontconfig
  99. # fontconfig_dir = cmake_module_path
  100. # # PAM
  101. # if false
  102. # # message('\tPAM Enabled')
  103. # PAM_dep = dependency('PAM')
  104. # if 'PAM_FOUND'
  105. # # message('\tPAM Found')
  106. # slim_definitions = [slim_definitions, '-DUSE_PAM']
  107. # # target_link_libraries([project_name, pam_library])
  108. # # target_link_libraries(['slimlock', pam_library])
  109. # # include_directories(pam_include_dir)
  110. # else
  111. # # message('\tPAM Not Found')
  112. # endif
  113. # else
  114. # # message('\tPAM disabled')
  115. # endif
  116. # # ConsoleKit
  117. # use_consolekit = false
  118. # if use_consolekit
  119. # CkConnector_dep = dependency('CkConnector')
  120. # # message('\tConsoleKit Enabled')
  121. # if 'CKCONNECTOR_FOUND'
  122. # # message('\tConsoleKit Found')
  123. # # DBus check
  124. # DBus_dep = dependency('DBus')
  125. # if 'DBUS_FOUND'
  126. # # message('\tDBus Found')
  127. # # target_link_libraries([project_name, dbus_libraries])
  128. # # include_directories(dbus_arch_include_dir)
  129. # # include_directories(dbus_include_dir)
  130. # slim_definitions = [slim_definitions, '-DUSE_CONSOLEKIT']
  131. # # target_link_libraries([project_name, ckconnector_libraries])
  132. # # include_directories(ckconnector_include_dir)
  133. # else
  134. # # message('\tDBus Not Found')
  135. # endif
  136. # else
  137. # # message('\tConsoleKit Not Found')
  138. # # message('\tConsoleKit disabled')
  139. # endif
  140. # else
  141. # # message('\tConsoleKit disabled')
  142. # endif
  143. # # system librarys