1
0
mirror of https://github.com/bk138/gromit-mpx.git synced 2021-05-25 12:43:10 +03:00

Add a first cut at a CMake build system – allows for use of CLion as IDE.

This commit is contained in:
Russel Winder
2016-11-13 08:10:09 +00:00
parent a3bd7ab802
commit ce065329e3
4 changed files with 127 additions and 0 deletions

7
.gitignore vendored
View File

@@ -15,3 +15,10 @@
/stamp-h1
Makefile
Makefile.in
/.idea/
/Build/
/cmake-build-debug/
*~
/Build_Release/
/Build_Debug/

68
CMakeLists.txt Normal file
View File

@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.0)
project(Gromit_MPX LANGUAGES C)
set(target_name gromit-mpx)
set(version 1.2)
set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")
configure_file(build-config.h_cmake_in build-config.h)
find_package(PkgConfig)
pkg_check_modules(gtk3 "gtk+-3.0 >= 2.99.3")
pkg_check_modules(appindicator3 "appindicator3-0.1 >= 0.4.92")
pkg_check_modules(xinput "xi >= 1.3")
pkg_check_modules(x11 x11)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${gtk3_INCLUDE_DIRS}
${appindicator3_INCLUDE_DIRS}
${xinput_INCLUDE_DIRS}
${x11_INCLUDE_DIRS}
)
link_directories(
${gtk3_LIBRARY_DIRS}
${appindicator3_LIBRARY_DIRS}
${xinput_LIBRARY_DIRS}
${x11_LIBRARY_DIRS}
)
set(sources
src/callbacks.c
src/callbacks.h
src/config.c
src/config.h
src/gromit-mpx.c
src/gromit-mpx.h
src/input.c
src/input.h
)
add_executable(${target_name} ${sources})
target_link_libraries(${target_name}
${gtk3_LIBRARIES}
${appindicator3_LIBRARIES}
${xinput_LIBRARIES}
${x11_LIBRARIES}
-lm
)
install(TARGETS ${target_name} RUNTIME DESTINATION bin)
install(FILES data/gromit-mpx.desktop DESTINATION share/applications)
install(FILES data/gromit-mpx.cfg DESTINATION etc/gromit-mpx)
install(FILES README.md AUTHORS ChangeLog NEWS DESTINATION share/doc/gromit-mpx)
install(FILES gromit-mpx.1 DESTINATION share/man/man1)
install(FILES data/gromit-mpx.png data/gromit-mpx.xpm DESTINATION share/pixmaps)
install(FILES data/gromit-mpx.svg DESTINATION share/icons/hicolor/scalable/apps)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

31
build-config.h_cmake_in Normal file
View File

@@ -0,0 +1,31 @@
#ifndef BUILD_CONFIG_h
#define BUILD_CONFIG_H
/* Name of package */
#define PACKAGE "gromit-mpx"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "Christian Beier <dontmind@freeshell.org>"
/* Define to the full name of this package. */
#define PACKAGE_NAME "gromit-mpx"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "gromit-mpx ${version}"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gromit-mpx"
/* Define to the home page for this package. */
#define PACKAGE_URL "https://github.com/bk138/gromit-mpx"
/* Define to the version of this package. */
#define PACKAGE_VERSION "${version}"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "${version}"
#endif /* BUILD_CONFIG_H */

21
cmake_uninstall.cmake.in Normal file
View File

@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)