meson.build 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. cc = meson.get_compiler('cpp')
  37. deps = [
  38. cc.find_library('m'),
  39. cc.find_library('crypt'),
  40. dependency('freetype2'),
  41. dependency('X11'),
  42. dependency('xmu'),
  43. dependency('xft'),
  44. dependency('xrandr'),
  45. dependency('JPEG'),
  46. dependency('PNG'),
  47. dependency('ZLIB'),
  48. dependency('fontconfig'),
  49. ]
  50. ck = dependency('libconsolekit', required: false)
  51. ck_conn = dependency('ck-connector', required: false)
  52. if ck.found() and ck_conn.found()
  53. deps += [ck, ck_conn]
  54. slim_srcs += ['Ck.cpp']
  55. else
  56. endif
  57. if use_pam
  58. common_srcs += ['PAM.cpp']
  59. # for now, only build slimlock if we are using PAM.
  60. build_slimlock = '1'
  61. endif
  62. # Build common library
  63. build_shared_libs = true
  64. if build_shared_libs
  65. # message(['STATUS', 'Enable shared library building'])
  66. libslim_lib = library('libslim', common_srcs, dependencies: deps, include_directories: [include_directories('.')])
  67. else
  68. # message(['STATUS', 'Disable shared library building'])
  69. libslim_lib = static_library('libslim', common_srcs, dependencies: deps)
  70. endif
  71. # if true
  72. # slimlock_exe = executable('slimlock', slimlock_srcs)
  73. # endif
  74. # #Set the custom CMake module directory where our include/lib finders are
  75. # cmake_module_path = '${CMAKE_SOURCE_DIR}/cmake/modules'
  76. slim_exe = executable('slim', slim_srcs, dependencies: deps, include_directories: [include_directories('.')], link_with: libslim_lib)
  77. # # Fontconfig
  78. # fontconfig_dir = cmake_module_path
  79. # # PAM
  80. # if false
  81. # # message('\tPAM Enabled')
  82. # PAM_dep = dependency('PAM')
  83. # if 'PAM_FOUND'
  84. # # message('\tPAM Found')
  85. # slim_definitions = [slim_definitions, '-DUSE_PAM']
  86. # # target_link_libraries([project_name, pam_library])
  87. # # target_link_libraries(['slimlock', pam_library])
  88. # # include_directories(pam_include_dir)
  89. # else
  90. # # message('\tPAM Not Found')
  91. # endif
  92. # else
  93. # # message('\tPAM disabled')
  94. # endif
  95. # # ConsoleKit
  96. # use_consolekit = false
  97. # if use_consolekit
  98. # CkConnector_dep = dependency('CkConnector')
  99. # # message('\tConsoleKit Enabled')
  100. # if 'CKCONNECTOR_FOUND'
  101. # # message('\tConsoleKit Found')
  102. # # DBus check
  103. # DBus_dep = dependency('DBus')
  104. # if 'DBUS_FOUND'
  105. # # message('\tDBus Found')
  106. # # target_link_libraries([project_name, dbus_libraries])
  107. # # include_directories(dbus_arch_include_dir)
  108. # # include_directories(dbus_include_dir)
  109. # slim_definitions = [slim_definitions, '-DUSE_CONSOLEKIT']
  110. # # target_link_libraries([project_name, ckconnector_libraries])
  111. # # include_directories(ckconnector_include_dir)
  112. # else
  113. # # message('\tDBus Not Found')
  114. # endif
  115. # else
  116. # # message('\tConsoleKit Not Found')
  117. # # message('\tConsoleKit disabled')
  118. # endif
  119. # else
  120. # # message('\tConsoleKit disabled')
  121. # endif
  122. # # system librarys