From 6a33e1e3cddac31b762e4376e29c03ccf8f92107 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Aug 2015 21:02:46 -0400 Subject: Initial commit --- .gitignore | 11 +++++++++++ CMake/FindWLC.cmake | 20 ++++++++++++++++++++ CMake/FindXKBCommon.cmake | 19 +++++++++++++++++++ CMakeLists.txt | 39 +++++++++++++++++++++++++++++++++++++++ sway/main.c | 6 ++++++ 5 files changed, 95 insertions(+) create mode 100644 .gitignore create mode 100644 CMake/FindWLC.cmake create mode 100644 CMake/FindXKBCommon.cmake create mode 100644 CMakeLists.txt create mode 100644 sway/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b7b3266c --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +CMakeCache.txt +CMakeFiles +Makefile +cmake_install.cmake +install_manifest.txt +*.swp +*.o +bin/ +test/ +build/ +.lvimrc diff --git a/CMake/FindWLC.cmake b/CMake/FindWLC.cmake new file mode 100644 index 00000000..15b26ce7 --- /dev/null +++ b/CMake/FindWLC.cmake @@ -0,0 +1,20 @@ +# - Find wlc +# Find the wlc libraries +# +# This module defines the following variables: +# WLC_FOUND - True if wlc is found +# WLC_LIBRARIES - wlc libraries +# WLC_INCLUDE_DIRS - wlc include directories +# WLC_DEFINITIONS - Compiler switches required for using wlc +# + +find_package(PkgConfig) +pkg_check_modules(PC_WLC QUIET wlc) +find_path(WLC_INCLUDE_DIRS NAMES wlc/wlc.h HINTS ${PC_WLC_INCLUDE_DIRS}) +find_library(WLC_LIBRARIES NAMES wlc HINTS ${PC_WLC_LIBRARY_DIRS}) + +set(WLC_DEFINITIONS ${PC_WLC_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(wlc DEFAULT_MSG WLC_LIBRARIES WLC_INCLUDE_DIRS) +mark_as_advanced(WLC_LIBRARIES WLC_INCLUDE_DIRS) diff --git a/CMake/FindXKBCommon.cmake b/CMake/FindXKBCommon.cmake new file mode 100644 index 00000000..30ac503a --- /dev/null +++ b/CMake/FindXKBCommon.cmake @@ -0,0 +1,19 @@ +# - Find XKBCommon +# Once done, this will define +# +# XKBCOMMON_FOUND - System has XKBCommon +# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories +# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon +# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon + +find_package(PkgConfig) +pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) +find_path(XKBCOMMON_INCLUDE_DIRS NAMES xkbcommon/xkbcommon.h HINTS ${PC_XKBCOMMON_INCLUDE_DIRS}) +find_library(XKBCOMMON_LIBRARIES NAMES xkbcommon HINTS ${PC_XKBCOMMON_LIBRARY_DIRS}) + +set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS) +mark_as_advanced(XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS) + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..66879422 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8.5) +project(sway C) +set(CMAKE_C_FLAGS "-g") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/") +add_definitions("-Wall") +set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake) + +find_package(XKBCommon REQUIRED) + +if (UNIX) + find_library(DL_LIBRARY dl) + mark_as_advanced(DL_LIBRARY) + if (NOT DL_LIBRARY) + message(FATAL_ERROR "libdl is needed on unix systems") + endif () +endif (UNIX) + +FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) + +include_directories( + ${WLC_INCLUDE_DIRS} + sway/ +) + +add_executable(sway + ${sources} +) + +target_link_libraries(sway + ${WLC_LIBRARIES} + ${XKBCOMMON_LIBRARIES} + ${DL_LIBRARY} +) + +INSTALL( + TARGETS sway + RUNTIME DESTINATION bin +) diff --git a/sway/main.c b/sway/main.c new file mode 100644 index 00000000..e6a5b851 --- /dev/null +++ b/sway/main.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello world\n"); + return 0; +} -- cgit v1.2.3