annotate maintainers_add_the_linux_kbuilddir_finder.patch @ 49:0c55f24c6b3d

Add a series of patch related to the build systme
author Louis Opter <louis@lse.epitech.net>
date Sun, 15 Jan 2012 21:36:15 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
1 # HG changeset patch
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
2 # Parent 6682d6e4330ef0429c41af6dcbe0362ff15d9841
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
3 maintainers: add a CMake finder for the Linux build tree and only build the e1000 sample if it is found
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
4
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
5 diff --git a/CMakeLists.txt b/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
6 --- a/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
7 +++ b/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
8 @@ -29,12 +29,17 @@
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
9
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
10 FIND_PACKAGE(LATEX)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
11 FIND_PACKAGE(CodeWorker REQUIRED)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
12 +FIND_PACKAGE(LinuxKBuildDir)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
13
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
14 INCLUDE(AddFileDependencies)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
15 INCLUDE(FileCopy)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
16 INCLUDE(RathaxesCopyLatexClasses)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
17 INCLUDE(UseRathaxes)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
18
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
19 +IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
20 + MESSAGE(STATUS "No valid Linux build tree found, kernel modules will not be built")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
21 +ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
22 +
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
23 # Global definitions ###########################################################
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
24
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
25 ENABLE_TESTING()
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
26 diff --git a/maintainers/CMakeScripts/FindLinuxKBuildDir.cmake b/maintainers/CMakeScripts/FindLinuxKBuildDir.cmake
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
27 new file mode 100644
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
28 --- /dev/null
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
29 +++ b/maintainers/CMakeScripts/FindLinuxKBuildDir.cmake
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
30 @@ -0,0 +1,41 @@
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
31 +# Check if the kernel build directory exists
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
32 +#
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
33 +# This finder will seek for the usual /lib/modules/`uname -r`/build/
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
34 +# directory. Obviously, this is Linux specific.
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
35 +#
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
36 +# You can specify an alternate build directory by using the environment
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
37 +# variable LINUX_KBUILD_DIR.
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
38 +#
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
39 +# This is necessary to build Linux kernel modules!
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
40 +#
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
41 +# Usage: FIND_PACKAGE(LinuxKBuildDir [REQUIRED])
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
42 +#
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
43 +# This will set the variable LINUX_KBUILD_DIR with the path to the KBuild
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
44 +# directory, if it is found.
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
45 +
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
46 +IF (NOT LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
47 + IF ($ENV{LINUX_KBUILD_DIR})
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
48 + SET(KDIR $ENV{LINUX_KBUILD_DIR})
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
49 + ELSE ($ENV{LINUX_KBUILD_DIR})
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
50 + SET(KDIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build/")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
51 + ENDIF ($ENV{LINUX_KBUILD_DIR})
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
52 +
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
53 + IF (IS_DIRECTORY "${KDIR}")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
54 + FIND_FILE(LINUX_KBUILD_DIR_MAKEFILE "Makefile"
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
55 + PATHS "${KDIR}"
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
56 + # Restrict the search to this directory only:
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
57 + NO_DEFAULT_PATH
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
58 + NO_CMAKE_ENVIRONMENT_PATH
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
59 + NO_CMAKE_PATH
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
60 + NO_SYSTEM_ENVIRONMENT_PATH
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
61 + NO_CMAKE_SYSTEM_PATH)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
62 + # Check if it looks legit:
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
63 + IF (LINUX_KBUILD_DIR_MAKEFILE)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
64 + SET(LINUX_KBUILD_DIR "${KDIR}" CACHE PATH "Path to the Linux KBuild directory (usually /lib/modules/`uname -r`/build/)")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
65 + ENDIF (LINUX_KBUILD_DIR_MAKEFILE)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
66 + ENDIF (IS_DIRECTORY "${KDIR}")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
67 +ENDIF (NOT LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
68 +
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
69 +INCLUDE(FindPackageHandleStandardArgs)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
70 +
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
71 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LinuxKBuildDir DEFAULT_MSG LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
72 diff --git a/rathaxes/samples/e1000/CMakeLists.txt b/rathaxes/samples/e1000/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
73 --- a/rathaxes/samples/e1000/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
74 +++ b/rathaxes/samples/e1000/CMakeLists.txt
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
75 @@ -2,10 +2,6 @@
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
76 RTI log.rti lkm.rti pci.rti socket.rti ethernet.rti e1000.rti
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
77 BLT log.blt lkm.blt pci.blt socket.blt ethernet.blt e1000.blt)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
78
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
79 -# We can't name lkm since it's already used as the target name to generate the
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
80 -# source (with ADD_RATHAXES_SOURCES).
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
81 -
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
82 -# does not work atm
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
83 -IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
84 - ADD_RATHAXES_LKM(e1000 e1000_src)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
85 -ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
86 +IF (LINUX_KBUILD_DIR)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
87 + ADD_RATHAXES_LKM(e1000 e1000_src)
0c55f24c6b3d Add a series of patch related to the build systme
Louis Opter <louis@lse.epitech.net>
parents:
diff changeset
88 +ENDIF (LINUX_KBUILD_DIR)