Browse Source

Start to convert CMake-based build system to Meson-based one

Getty Ritter 4 years ago
parent
commit
4b72975f70
1 changed files with 131 additions and 0 deletions
  1. 131 0
      meson.build

+ 131 - 0
meson.build

@@ -0,0 +1,131 @@
+project(
+  'slim',
+  ['c', 'cpp'],
+  default_options : ['default_library=static'],
+)
+
+add_global_arguments('-Wall', language: 'cpp')
+add_global_arguments('-g', language: 'cpp')
+add_global_arguments('-O2', language: 'cpp')
+
+# Version
+slim_version_major = '1'
+slim_version_minor = '3'
+slim_version_patch = '6'
+slim_version = '${SLIM_VERSION_MAJOR}.${SLIM_VERSION_MINOR}.${SLIM_VERSION_PATCH}'
+add_global_arguments('-DVERSION=${slim_version}', language: 'cpp')
+cmake_install_prefix = ['/usr/local', 'CACHE', 'PATH', 'Installation Directory']
+pkgdatadir = '${CMAKE_INSTALL_PREFIX}/share/slim'
+sysconfdir = '/etc'
+libdir = '/lib'
+mandir = '${CMAKE_INSTALL_PREFIX}/share/man'
+slim_definitions = [
+  '-DHAVE_SHADOW',
+  '-DPACKAGE="slim"',
+  '-DVERSION="1.3.6"',
+  '-DPKGDATADIR="/usr/local/share/slim"',
+  '-DSYSCONFDIR="/etc"']
+add_global_arguments(slim_definitions, language: 'cpp')
+
+# Flags
+cmake_c_flags = '${CMAKE_C_FLAGS} -Wall -g -O2'
+cmake_cpp_flags = '${CMAKE_CPP_FLAGS} -Wall -g -O2'
+cmake_cxx_flags = '${CMAKE_CXX_FLAGS} -Wall -g -O2'
+# source
+slim_srcs = ['main.cpp', 'app.cpp', 'numlock.cpp', 'switchuser.cpp', 'png.c', 'jpeg.c']
+slimlock_srcs = 'slimlock.cpp'
+common_srcs = ['cfg.cpp', 'image.cpp', 'log.cpp', 'panel.cpp', 'util.cpp']
+use_pam = true
+
+cc = meson.get_compiler('cpp')
+deps = [
+  cc.find_library('m'),
+  cc.find_library('crypt'),
+  dependency('freetype2'),
+  dependency('X11'),
+  dependency('xmu'),
+  dependency('xft'),
+  dependency('xrandr'),
+  dependency('JPEG'),
+  dependency('PNG'),
+  dependency('ZLIB'),
+  dependency('fontconfig'),
+]
+
+ck = dependency('libconsolekit', required: false)
+ck_conn = dependency('ck-connector', required: false)
+if ck.found() and ck_conn.found()
+  deps += [ck, ck_conn]
+  slim_srcs += ['Ck.cpp']
+else
+endif
+
+if use_pam
+  common_srcs += ['PAM.cpp']
+  # for now, only build slimlock if we are using PAM.
+  build_slimlock = '1'
+endif
+# Build common library
+build_shared_libs = true
+if build_shared_libs
+  # message(['STATUS', 'Enable shared library building'])
+  libslim_lib = library('libslim', common_srcs, dependencies: deps, include_directories: [include_directories('.')])
+else
+  # message(['STATUS', 'Disable shared library building'])
+  libslim_lib = static_library('libslim', common_srcs, dependencies: deps)
+endif
+
+# if true
+#   slimlock_exe = executable('slimlock', slimlock_srcs)
+# endif
+# #Set the custom CMake module directory where our include/lib finders are
+# cmake_module_path = '${CMAKE_SOURCE_DIR}/cmake/modules'
+
+slim_exe = executable('slim', slim_srcs, dependencies: deps, include_directories: [include_directories('.')], link_with: libslim_lib)
+
+# # Fontconfig
+# fontconfig_dir = cmake_module_path
+# # PAM
+# if false
+#   # message('\tPAM Enabled')
+#   PAM_dep = dependency('PAM')
+#   if 'PAM_FOUND'
+#     # message('\tPAM Found')
+#     slim_definitions = [slim_definitions, '-DUSE_PAM']
+#     # target_link_libraries([project_name, pam_library])
+#     # target_link_libraries(['slimlock', pam_library])
+#     # include_directories(pam_include_dir)
+#   else
+#     # message('\tPAM Not Found')
+#   endif
+# else
+#   # message('\tPAM disabled')
+# endif
+# # ConsoleKit
+# use_consolekit = false
+# if use_consolekit
+#   CkConnector_dep = dependency('CkConnector')
+#   # message('\tConsoleKit Enabled')
+#   if 'CKCONNECTOR_FOUND'
+#     # message('\tConsoleKit Found')
+#     # DBus check
+#     DBus_dep = dependency('DBus')
+#     if 'DBUS_FOUND'
+#       # message('\tDBus Found')
+#       # target_link_libraries([project_name, dbus_libraries])
+#       # include_directories(dbus_arch_include_dir)
+#       # include_directories(dbus_include_dir)
+#       slim_definitions = [slim_definitions, '-DUSE_CONSOLEKIT']
+#       # target_link_libraries([project_name, ckconnector_libraries])
+#       # include_directories(ckconnector_include_dir)
+#     else
+#       # message('\tDBus Not Found')
+#     endif
+#   else
+#     # message('\tConsoleKit Not Found')
+#     # message('\tConsoleKit disabled')
+#   endif
+# else
+#   # message('\tConsoleKit disabled')
+# endif
+# # system librarys