diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-01-22 16:25:08 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2011-01-22 16:25:08 +0000 |
commit | cebbe1cd7fe8be10d51a1d8fc4007407b1ba77c7 (patch) | |
tree | e8fe44f46d58522b2f2148cb575cc89fc9ba6ad7 /app | |
parent | 738943804f2e4005e1948ed19e0d02e4cd1df431 (diff) | |
download | 2011-usi-cebbe1cd7fe8be10d51a1d8fc4007407b1ba77c7.tar.gz 2011-usi-cebbe1cd7fe8be10d51a1d8fc4007407b1ba77c7.tar.bz2 2011-usi-cebbe1cd7fe8be10d51a1d8fc4007407b1ba77c7.zip |
Première version du projet qui compile ! (utilise CMake)
git-svn-id: file:///var/svn/2011-usi/trunk@10 db941bf7-0cb3-4dda-9634-87faf64f93a7
Diffstat (limited to 'app')
-rw-r--r-- | app/v3_c/CMakeLists.txt | 28 | ||||
-rwxr-xr-x | app/v3_c/scripts/compil.sh | 6 | ||||
-rw-r--r-- | app/v3_c/src/CMakeLists.txt | 12 | ||||
-rw-r--r-- | app/v3_c/src/include/utils.h | 6 | ||||
-rw-r--r-- | app/v3_c/src/myhttpd.c | 21 | ||||
-rw-r--r-- | app/v3_c/src/myhttpd.h.in | 8 | ||||
-rw-r--r-- | app/v3_c/src/test/CMakeFiles/progress.marks | 1 | ||||
-rw-r--r-- | app/v3_c/src/test/CMakeLists.txt | 7 | ||||
-rwxr-xr-x | app/v3_c/src/test/testfunc_000_env.sh | 3 | ||||
-rw-r--r-- | app/v3_c/src/utils.c | 5 |
10 files changed, 97 insertions, 0 deletions
diff --git a/app/v3_c/CMakeLists.txt b/app/v3_c/CMakeLists.txt new file mode 100644 index 0000000..d20e952 --- /dev/null +++ b/app/v3_c/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required (VERSION 2.6) +project (MyHttpd C) + +# The version number. +set (MYHTTPD_VERSION_MAJOR 0) +set (MYHTTPD_VERSION_MINOR 1) + +set(TEST_SCRIPTS_PATH ${PROJECT_SOURCE_DIR}/src/test) + +# Include the directory itself as a path to include directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) +#set(INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include") +set(INCLUDE_DIRECTORIES src/include) +# add the binary tree to the search path for include files +# so that we will find netlem.h and netlem_ds.h +include_directories("${INCLUDE_DIRECTORIES}" "${PROJECT_BINARY_DIR}") + +add_definitions(-Wall -Wextra -pedantic -Werror -std=c99 -D_POSIX_SOURCE -g) +add_definitions(-pg) +set (CMAKE_EXE_LINKER_FLAGS -pg) + +add_subdirectory(src) +add_subdirectory(src/test) + +set(ENV{LC_ALL} C) + +enable_testing() +add_test(testfunc000_env ${TEST_SCRIPTS_PATH}/testfunc_000_env.sh) diff --git a/app/v3_c/scripts/compil.sh b/app/v3_c/scripts/compil.sh new file mode 100755 index 0000000..2c0f374 --- /dev/null +++ b/app/v3_c/scripts/compil.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +BASEPATH="$(dirname $0)/.." + +( cd "$BASEPATH/bin" && cmake ../ && make ) + diff --git a/app/v3_c/src/CMakeLists.txt b/app/v3_c/src/CMakeLists.txt new file mode 100644 index 0000000..2947cb3 --- /dev/null +++ b/app/v3_c/src/CMakeLists.txt @@ -0,0 +1,12 @@ +set(SRC_COMMON utils.c) + +# configure a header file to pass some of the CMake settings +# to the source code +configure_file ( + "myhttpd.h.in" + "${PROJECT_BINARY_DIR}/myhttpd.h" +) + +add_executable(myhttpd myhttpd.c ${SRC_COMMON} ) +#target_link_libraries(netlem SDL SDL_net SDL_image) + diff --git a/app/v3_c/src/include/utils.h b/app/v3_c/src/include/utils.h new file mode 100644 index 0000000..285f79b --- /dev/null +++ b/app/v3_c/src/include/utils.h @@ -0,0 +1,6 @@ +#ifndef UTILS_H +#define UTILS_H + +int tobedone(); + +#endif diff --git a/app/v3_c/src/myhttpd.c b/app/v3_c/src/myhttpd.c new file mode 100644 index 0000000..d662dd3 --- /dev/null +++ b/app/v3_c/src/myhttpd.c @@ -0,0 +1,21 @@ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#include "myhttpd.h" + +int main() { + //int res; + + int sockServ; + + sockServ = socket(AF_INET, SOCK_STREAM, 0); + if (sockServ -1) { perror("socket"); exit(1); } + + return 0; +} diff --git a/app/v3_c/src/myhttpd.h.in b/app/v3_c/src/myhttpd.h.in new file mode 100644 index 0000000..ab0a40a --- /dev/null +++ b/app/v3_c/src/myhttpd.h.in @@ -0,0 +1,8 @@ +#ifndef MYHTTPD_H +#define MYHTTPD_H + +#define MYHTTPD_VERSION_MAJOR @NetLemmings_VERSION_MAJOR@ +#define MYHTTPD_VERSION_MINOR @NetLemmings_VERSION_MINOR@ + +#endif + diff --git a/app/v3_c/src/test/CMakeFiles/progress.marks b/app/v3_c/src/test/CMakeFiles/progress.marks new file mode 100644 index 0000000..573541a --- /dev/null +++ b/app/v3_c/src/test/CMakeFiles/progress.marks @@ -0,0 +1 @@ +0 diff --git a/app/v3_c/src/test/CMakeLists.txt b/app/v3_c/src/test/CMakeLists.txt new file mode 100644 index 0000000..223d5a3 --- /dev/null +++ b/app/v3_c/src/test/CMakeLists.txt @@ -0,0 +1,7 @@ + +# Include the directory itself as a path to include directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +#add_executable(testfunc_001_lex WIN32 testfunc_001_lex.c ${PARSER_FILES} ) +#target_link_libraries(testfunc_004_buildterrain SDL_image) + diff --git a/app/v3_c/src/test/testfunc_000_env.sh b/app/v3_c/src/test/testfunc_000_env.sh new file mode 100755 index 0000000..c72bf50 --- /dev/null +++ b/app/v3_c/src/test/testfunc_000_env.sh @@ -0,0 +1,3 @@ +#!/bin/sh +env > /tmp/env + diff --git a/app/v3_c/src/utils.c b/app/v3_c/src/utils.c new file mode 100644 index 0000000..cabb464 --- /dev/null +++ b/app/v3_c/src/utils.c @@ -0,0 +1,5 @@ +#include "utils.h" + +int tobedone() { + return 0; +} |