Mercurial > archived > louis > epitech > mq > rathaxes
comparison maintainers_refactor_the_build_system_to_allow_standalone_rathaxes_projects_with_cmake.patch @ 51:b109c72d897b
Start a series to fix a bit the build system
author | Louis Opter <louis@lse.epitech.net> |
---|---|
date | Sun, 22 Jan 2012 18:31:23 +0100 |
parents | maintainers_update_the_binaries_installed_with_make_install.patch@1cf60e316d19 |
children | 0ca794649028 |
comparison
equal
deleted
inserted
replaced
50:a85a52baff8a | 51:b109c72d897b |
---|---|
1 # HG changeset patch | |
2 # Parent 656d49c6f011212578c0a29e49c4d1566b8ad16e | |
3 maintainers: make UseRathaxes.cmake usable in standalone projects | |
4 | |
5 - UseRathaxes now does more Rathaxes related things (like search for | |
6 Codeworker); | |
7 - Currently used by the examples; | |
8 - Should make the first steps guide really usable now. | |
9 | |
10 diff --git a/CMakeLists.txt b/CMakeLists.txt | |
11 --- a/CMakeLists.txt | |
12 +++ b/CMakeLists.txt | |
13 @@ -27,27 +27,17 @@ | |
14 | |
15 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts) | |
16 | |
17 +INCLUDE(UseRathaxes) | |
18 FIND_PACKAGE(LATEX) | |
19 -FIND_PACKAGE(CodeWorker REQUIRED) | |
20 -FIND_PACKAGE(LinuxKBuildDir) | |
21 | |
22 INCLUDE(AddFileDependencies) | |
23 INCLUDE(FileCopy) | |
24 INCLUDE(RathaxesCopyLatexClasses) | |
25 -INCLUDE(UseRathaxes) | |
26 - | |
27 -IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT LINUX_KBUILD_DIR) | |
28 - MESSAGE(STATUS "No valid Linux build tree found, kernel modules will not be built") | |
29 -ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT LINUX_KBUILD_DIR) | |
30 | |
31 # Global definitions ########################################################### | |
32 | |
33 ENABLE_TESTING() | |
34 | |
35 -IF (CMAKE_COMPILER_IS_GNUCC) | |
36 - SET(CMAKE_C_FLAGS "-pipe -Wextra -Wall -std=c99") | |
37 -ENDIF (CMAKE_COMPILER_IS_GNUCC) | |
38 - | |
39 # Subdirectories ############################################################### | |
40 | |
41 IF (PDFLATEX_COMPILER AND PS2PDF_CONVERTER) | |
42 diff --git a/maintainers/CMakeLists.txt b/maintainers/CMakeLists.txt | |
43 --- a/maintainers/CMakeLists.txt | |
44 +++ b/maintainers/CMakeLists.txt | |
45 @@ -10,6 +10,6 @@ | |
46 INSTALL(PROGRAMS ${CODEWORKER_BINARY_PATH} | |
47 DESTINATION lib/rathaxes/) | |
48 | |
49 -# Generate the install rules for the rathaxes binaries: | |
50 +# Generate the install rules for the rathaxes binaries | |
51 | |
52 ADD_SUBDIRECTORY(bin) | |
53 diff --git a/maintainers/CMakeScripts/FindCodeWorker.cmake b/maintainers/CMakeScripts/FindCodeWorker.cmake | |
54 --- a/maintainers/CMakeScripts/FindCodeWorker.cmake | |
55 +++ b/maintainers/CMakeScripts/FindCodeWorker.cmake | |
56 @@ -18,7 +18,11 @@ | |
57 NAMES | |
58 codeworker | |
59 PATHS | |
60 - $ENV{CODEWORKER_DIR}) | |
61 + $ENV{CODEWORKER_DIR} | |
62 + $ENV{RATHAXES_PATH}/lib/ | |
63 + ${CMAKE_SYSTEM_LIBRARY_PATH} | |
64 + PATH_SUFFIXES | |
65 + rathaxes) | |
66 | |
67 # Else try to download it: | |
68 IF (NOT CODEWORKER_BINARY_PATH) | |
69 diff --git a/maintainers/CMakeScripts/UseRathaxes.cmake b/maintainers/CMakeScripts/UseRathaxes.cmake | |
70 --- a/maintainers/CMakeScripts/UseRathaxes.cmake | |
71 +++ b/maintainers/CMakeScripts/UseRathaxes.cmake | |
72 @@ -1,3 +1,5 @@ | |
73 +# Functions #################################################################### | |
74 + | |
75 FUNCTION(_RTX_PARSE_OPTIONS ARGS RTI_OUT BLT_OUT SYSTEM_OUT) | |
76 SET(OPTIONS "RTI" "BLT" "SYSTEM") | |
77 SET(FILE_LISTS ${RTI_OUT} ${BLT_OUT} ${SYSTEM_OUT}) | |
78 @@ -188,7 +190,7 @@ | |
79 # Generate the Linux Makefile to build a Linux kernel module | |
80 SET(MODULE_MAKEFILE "${MODULE_BUILD_DIR}/Makefile") | |
81 SET(LKM_OBJECTS "${RATHAXES_SOURCE}_${SYSTEM}.o") | |
82 - CONFIGURE_FILE("${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/Templates/MakefileLKM.in" | |
83 + CONFIGURE_FILE("${CMAKE_CURRENT_LIST_DIR}/Templates/MakefileLKM.in" | |
84 "${MODULE_MAKEFILE}") | |
85 | |
86 SET(KERNEL_OBJECT_NAME "${RATHAXES_SOURCE}_${SYSTEM}.ko") | |
87 @@ -216,11 +218,11 @@ | |
88 # Generate the Windows Makefile to build a Windows kernel module | |
89 SET(MODULE_SOURCES "${MODULE_BUILD_DIR}/sources") | |
90 SET(LKM_SOURCES "${RATHAXES_SOURCE}_${SYSTEM}.c") | |
91 - CONFIGURE_FILE("${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/Templates/sources.in" | |
92 + CONFIGURE_FILE("${CMAKE_CURRENT_LIST_DIR}/Templates/sources.in" | |
93 "${MODULE_SOURCES}") | |
94 | |
95 SET(WINDOWS_MAKEFILE | |
96 - "${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/Templates/Windows_Makefile") | |
97 + "${CMAKE_CURRENT_LIST_DIR}/Templates/Windows_Makefile") | |
98 | |
99 SET(KERNEL_OBJECT_NAME "${RATHAXES_SOURCE}_${SYSTEM}.sys") | |
100 ADD_CUSTOM_COMMAND(OUTPUT "${KERNEL_OBJECT_NAME}" | |
101 @@ -237,3 +239,24 @@ | |
102 MESSAGE(STATUS "Don't know how to build kernel modules for ${SYSTEM} (yet)") | |
103 ENDIF (${SYSTEM} MATCHES "Linux") | |
104 ENDFUNCTION(ADD_RATHAXES_LKM NAME RATHAXES_SOURCE) | |
105 + | |
106 +# Code ######################################################################### | |
107 + | |
108 +# Find additional dependencies: | |
109 + | |
110 +FIND_PACKAGE(CodeWorker REQUIRED) | |
111 + | |
112 +# Only do this on Linux, as far as I know nobody compiles Linux from another OS. | |
113 +IF (CMAKE_SYSTEM_NAME MATCHES "Linux") | |
114 + FIND_PACKAGE(LinuxKBuildDir) | |
115 + IF (LINUX_KBUILD_DIR) | |
116 + MESSAGE(STATUS "No valid Linux build tree found, Linux kernel modules will not be built") | |
117 + ENDIF (LINUX_KBUILD_DIR) | |
118 +ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux") | |
119 + | |
120 +# Set some compiler options: | |
121 + | |
122 +# Set some sane flags that should be used in every project made with Rathaxes | |
123 +IF (CMAKE_COMPILER_IS_GNUCC) | |
124 + SET(CMAKE_C_FLAGS "-pipe -Wextra -Wall -std=c99") | |
125 +ENDIF (CMAKE_COMPILER_IS_GNUCC) | |
126 diff --git a/maintainers/bin/rathaxes.bat b/maintainers/bin/rathaxes.bat | |
127 --- a/maintainers/bin/rathaxes.bat | |
128 +++ b/maintainers/bin/rathaxes.bat | |
129 @@ -1,6 +1,3 @@ | |
130 @echo off | |
131 | |
132 -rem We have to explicitely give the path of the script as the first argument on | |
133 -rem Windows. | |
134 - | |
135 %CODEWORKER% --quiet %INCLUDE_PATHS% -script %COMPILER_PATH%/rathaxes.cws -args %COMPILER_PATH%/rathaxes.cws %LOCAL_CACHE_PATH% %* | |
136 diff --git a/maintainers/bin/rathaxesvars.bat.in b/maintainers/bin/rathaxesvars.bat.in | |
137 --- a/maintainers/bin/rathaxesvars.bat.in | |
138 +++ b/maintainers/bin/rathaxesvars.bat.in | |
139 @@ -2,6 +2,11 @@ | |
140 | |
141 echo -- Setting up the Rathaxes environment | |
142 | |
143 +rem This variable is simply used as a shortcut to the Rathaxes install | |
144 +rem directory (since we never know where it can be on Windows). Useful to | |
145 +rem specify some paths in the documentation. This is also used by the | |
146 +rem FindCodeWorker CMake finder. | |
147 +set RATHAXES_PATH="%CD%" | |
148 set CNORM_PATH="%CD%@CNORM_PATH@" | |
149 set COMPILER_PATH="%CD%@COMPILER_PATH@" | |
150 set LOCAL_CACHE_PATH="%LOCALAPPDATA%\\Rathaxes\\cache\\" | |
151 diff --git a/rathaxes/CMakeLists.txt b/rathaxes/CMakeLists.txt | |
152 --- a/rathaxes/CMakeLists.txt | |
153 +++ b/rathaxes/CMakeLists.txt | |
154 @@ -26,4 +26,21 @@ | |
155 | |
156 INSTALL(DIRECTORY compiler DESTINATION lib/rathaxes | |
157 PATTERN compiler/tests EXCLUDE) | |
158 -INSTALL(DIRECTORY samples DESTINATION share/doc/rathaxes) | |
159 +INSTALL(DIRECTORY samples DESTINATION share/doc/rathaxes | |
160 + PATTERN "SamplesCMakeLists.txt" EXCLUDE) | |
161 + | |
162 +# Install rules for the "standalone" build system to generate the examples: | |
163 + | |
164 +# Top-level CMakeLists.txt | |
165 +INSTALL(FILES samples/SamplesCMakeLists.txt | |
166 + DESTINATION share/doc/rathaxes/samples | |
167 + RENAME CMakeLists.txt) | |
168 +# CMakeScripts | |
169 +INSTALL(FILES | |
170 + ${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/UseRathaxes.cmake | |
171 + ${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/FindCodeWorker.cmake | |
172 + ${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/FindLinuxKBuildDir.cmake | |
173 + DESTINATION share/doc/rathaxes/samples/CMakeScripts/) | |
174 +# Templates used by the CMakeScripts | |
175 +INSTALL(DIRECTORY ${RATHAXES_SOURCE_DIR}/maintainers/CMakeScripts/Templates | |
176 + DESTINATION share/doc/rathaxes/samples/CMakeScripts/Template/) | |
177 diff --git a/rathaxes/samples/SamplesCMakeLists.txt b/rathaxes/samples/SamplesCMakeLists.txt | |
178 new file mode 100644 | |
179 --- /dev/null | |
180 +++ b/rathaxes/samples/SamplesCMakeLists.txt | |
181 @@ -0,0 +1,12 @@ | |
182 +PROJECT(RTX_SAMPLES C) | |
183 + | |
184 +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) | |
185 + | |
186 +INCLUDE(CMakeScripts/UseRathaxes) | |
187 + | |
188 +ENABLE_TESTING() | |
189 + | |
190 +ADD_SUBDIRECTORY(helloworld) | |
191 +ADD_SUBDIRECTORY(syntax) | |
192 +ADD_SUBDIRECTORY(e1000) | |
193 +ADD_SUBDIRECTORY(windows_minimal_lkm) |