Permalink
Browse files

Use CMake for automating the build process

With subsequent directory structure reorganization.
  • Loading branch information...
1 parent 81cc7e4 commit 0331c1a00ad05928184db0ffd80b41f38d67a721 @cyrus-and committed Jul 19, 2012
View
@@ -1,2 +1 @@
-/phpfs
-*.o
+/build-*/
View
@@ -1,31 +1,17 @@
-.PHONY: clean mount umount reload
-CFLAGS=-g -Wall -DDEBUG `pkg-config --cflags fuse` -DFUSE_USE_VERSION=29
-LDFLAGS=-lfuse -lcurl
+release debug: build
-# EXE ]-------------------------------------------------------------------------
+release: BUILD_DIR=./build-release/
+release: BUILD_TYPE=Release
-phpfs: main.o phpfs.o net.o $(patsubst %.c,%.o,$(wildcard fuse_api/*.c))
+debug: BUILD_DIR=./build-debug/
+debug: BUILD_TYPE=Debug
-# OBJECTS ]---------------------------------------------------------------------
-
-# generated by: gcc -D_FILE_OFFSET_BITS=64 -MM *.c
-main.o: main.c phpfs.h debug.h net.h
-net.o: net.c phpfs.h debug.h net.h
-phpfs.o: phpfs.c phpfs.h debug.h net.h fuse_api/fuse_api.h
-
-# UTILS ]-----------------------------------------------------------------------
+build:
+ rm -fr $(BUILD_DIR)
+ mkdir -p $(BUILD_DIR)
+ cd $(BUILD_DIR) && cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ../src/ && make
clean:
- find -name '*.o' -delete
- rm -f ./phpfs
-
-# TEST ]------------------------------------------------------------------------
-
-mount:
- test -d /tmp/phpfs || mkdir /tmp/phpfs/
- ./phpfs 'http://localhost/phpfs/phpfs.php' /tmp/phpfs/
-
-umount:
- fusermount -u /tmp/phpfs/
+ rm -fr ./build-release/ ./build-debug/
-reload: umount mount
+.PHONY: build build-release build-debug clean
View
@@ -0,0 +1,16 @@
+cmake_minimum_required( VERSION 2.8 )
+find_package( PkgConfig )
+
+project( phpfs )
+
+file( GLOB fuse_api fuse_api/*.c )
+file( GLOB core *.c )
+add_executable( phpfs ${core} ${fuse_api} )
+
+add_definitions( -Wall )
+
+find_package( CURL )
+pkg_check_modules( FUSE REQUIRED fuse )
+add_definitions( ${FUSE_CFLAGS} -DFUSE_USE_VERSION=29 )
+
+target_link_libraries( phpfs ${CURL_LIBRARY} ${FUSE_LIBRARIES} )
@@ -1,7 +1,7 @@
#ifndef _PHPFS_DEBUG_H
#define _PHPFS_DEBUG_H
-#ifdef DEBUG
+#ifndef NDEBUG
#include <stdio.h>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
View
File renamed without changes.
@@ -18,7 +18,7 @@ int phpfs_fuse_start( struct phpfs *phpfs , char *mounting_point )
argc = 0;
argv[ argc++ ] = "phpfs";
argv[ argc++ ] = "-s"; /* single thread */
-#ifdef DEBUG
+#ifndef NDEBUG
argv[ argc++ ] = "-d"; /* debug and core dump */
#endif
argv[ argc++ ] = mounting_point;
File renamed without changes.
File renamed without changes.

0 comments on commit 0331c1a

Please sign in to comment.