Mercurial > projects > qtd
annotate CMakeLists.txt @ 11:28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
author | SokoL_SD |
---|---|
date | Thu, 14 May 2009 13:42:02 +0000 |
parents | 390725da0980 |
children | 74465e760fde |
rev | line source |
---|---|
4 | 1 cmake_minimum_required(VERSION 2.6) |
1 | 2 PROJECT(qtd CXX C) |
3 FIND_PACKAGE(Qt4 REQUIRED) | |
4 | |
7 | 5 ##-------------------------------------------- |
6 ## Settings. | |
7 ##-------------------------------------------- | |
8 | |
5 | 9 include_directories(${QT_INCLUDES} include ${CMAKE_CURRENT_BINARY_DIR}/include) |
1 | 10 |
7 | 11 ## Options. |
4 | 12 option(BUILD_QT_OPENGL "Build QtOpenGL" "ON") |
13 option(BUILD_EXAMPLES "Build examples" "ON") | |
9 | 14 option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF") |
4 | 15 |
7 | 16 ## Packages list. |
17 set(packages_big Core Gui) | |
4 | 18 if(BUILD_QT_OPENGL) |
7 | 19 set(packages_big ${packages_big} OpenGL) |
4 | 20 endif(BUILD_QT_OPENGL) |
21 | |
22 set(packages) | |
23 foreach(package ${packages_big}) | |
24 string(TOLOWER ${package} package) | |
25 set(packages ${packages} ${package}) | |
26 endforeach(package ${packages_big}) | |
27 | |
7 | 28 ## Find D compiler and parsing its version. |
4 | 29 find_program(DC dmd ldc) |
30 if (DC) | |
31 exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output) | |
32 string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}") | |
33 if (dmd_version) | |
34 set(D_IS_MARS true) | |
35 set(D_COMPILER_NAME "Digital Mars D Compiler") | |
36 string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}") | |
37 string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}") | |
38 else (dmd_version) | |
39 string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}") | |
40 if (is_ldc) | |
41 exec_program(${DC} ARGS "--version" OUTPUT_VARIABLE d_output) | |
11
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
42 string(REGEX MATCH "based on DMD v[0-9]\\.[0-9]+" ldc_version "${d_output}") |
4 | 43 set(D_IS_LLVM true) |
44 if(ldc_version) | |
45 set(D_IS_LLVM true) | |
46 set(D_COMPILER_NAME "LLVM-based D Compiler") | |
11
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
47 string(REGEX REPLACE "based on DMD v([0-9])\\.[0-9]+" "\\1" D_VERSION "${ldc_version}") |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
48 string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${ldc_version}") |
4 | 49 else(ldc_version) |
50 message(FATAL_ERROR "LDC compiler was found, but the version can not be processed") | |
51 endif(ldc_version) | |
52 else (is_ldc) | |
53 message(FATAL_ERROR "D compliler not founded") | |
54 endif(is_ldc) | |
55 endif(dmd_version) | |
56 message(STATUS "D compiler founded -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}") | |
57 else (DC) | |
58 message(FATAL_ERROR "D compliler not founded") | |
59 endif (DC) | |
60 | |
7 | 61 if(D_IS_MARS) |
9 | 62 option(SINGLE_D_OBJECT "Build all d sources to one object file" "ON") |
7 | 63 elseif(D_IS_LLVM) |
9 | 64 option(SINGLE_D_OBJECT "Build all d sources to one object file" "OFF") |
65 if(SINGLE_D_OBJECT) | |
66 set(D_FLAGS ${D_FLAGS} -singleobj) | |
67 endif(SINGLE_D_OBJECT) | |
7 | 68 endif(D_IS_MARS) |
69 | |
4 | 70 # Check D compiler version |
71 if(D_VERSION EQUAL "1") | |
72 if (D_FRONTEND LESS "041") | |
73 message(STATUS "Minimum required version of D compiler is 1.041 (or compiler based on this version)") | |
74 endif(D_FRONTEND LESS "041") | |
75 set(D_TARGET d1-tango) | |
9 | 76 #set(D_FLAGS ${D_FLAGS} -I${CMAKE_SOURCE_DIR}/qtd/d1) |
4 | 77 elseif(D_VERSION EQUAL "2") |
78 set(D_TARGET ) ## TODO: hm... I don`t known this parameter for D2 ^( | |
9 | 79 #set(D_FLAGS ${D_FLAGS} -I${CMAKE_SOURCE_DIR}/qtd/d2) |
4 | 80 endif(D_VERSION EQUAL "1") |
81 | |
82 # Debug and release flags. | |
83 if (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | |
84 #set(CMAKE_BUILD_TYPE Debug) | |
85 #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) | |
86 #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) | |
87 add_definitions(-DDEBUG) | |
9 | 88 set(D_FLAGS ${D_FLAGS} -g -gc -debug) |
4 | 89 else (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) |
90 #set(CMAKE_BUILD_TYPE Release) | |
91 add_definitions(-UNO_DEBUG) | |
9 | 92 set(D_FLAGS ${D_FLAGS} -O -release -inline) |
4 | 93 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) |
94 set(D_FLAGS ${D_FLAGS} -L/subsystem:windows) | |
95 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
96 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | |
97 set(D_FLAGS ${D_FLAGS} -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR}) | |
10 | 98 if(D_IS_MARS AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) |
99 else(D_IS_MARS AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
7 | 100 set(D_FLAGS ${D_FLAGS} -L-L${CMAKE_BINARY_DIR}/lib) |
10 | 101 endif(D_IS_MARS AND ${CMAKE_SYSTEM_NAME} STREQUAL Windows) |
102 | |
9 | 103 # System specifc settings. |
4 | 104 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) |
105 set(implib implib) | |
106 find_program(IMPLIB ${implib}) | |
107 if (NOT IMPLIB) | |
108 message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") | |
109 endif (NOT IMPLIB) | |
110 set(D_OBJECT_SUFFIX .obj) | |
111 if(D_IS_MARS) | |
112 set(D_LIB_SUFFIX .lib) | |
113 set(D_LIB_PREFIX ) | |
114 elseif(D_IS_LDC) | |
115 set(D_LIB_SUFFIX .a) | |
116 set(D_LIB_PREFIX lib) | |
117 endif(D_IS_MARS) | |
118 set(GEN_OPT ${GEN_OPT} --cpp_shared) | |
119 add_definitions(-DCPP_SHARED) | |
7 | 120 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") |
4 | 121 elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux) |
122 set(D_LIB_SUFFIX .a) | |
123 set(D_LIB_PREFIX lib) | |
124 set(D_OBJECT_SUFFIX .o) | |
125 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
126 | |
127 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./) | |
128 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET}) | |
129 | |
7 | 130 ##-------------------------------------------- |
131 ## Macroses and functions. | |
132 ##-------------------------------------------- | |
4 | 133 |
7 | 134 ## Make native path. |
135 ## Usage: | |
136 ## set(path c:/file_path/file_name.cpp) | |
137 ## make_native_path(path) | |
138 ## message(STATUS ${path}) | |
139 ## Output: | |
140 ## -- "c:\file_path\file_name.cpp" | |
141 ## Command "file(TO_NATIVE_PATH ...)" is wrong on Windows | |
142 macro(MAKE_NATIVE_PATH pathname) | |
143 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
144 # An extra \\ escape is necessary to get a \ through CMake's processing. | |
145 string(REPLACE "/" "\\" ${pathname} "${${pathname}}") | |
146 # Enclose with UNESCAPED quotes. This means we need to escape our | |
147 # quotes once here, i.e. with \" | |
148 set(${pathname} \"${${pathname}}\") | |
149 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
150 endmacro(MAKE_NATIVE_PATH) | |
151 | |
152 ## Remove unnecessary travel to the object file. | |
153 ## path -- path to object file. | |
154 ## Example: | |
155 ## set(path ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/target.dir/main.d.obj) | |
156 ## obj_path(path) | |
157 ## message(STATUS ${path}) | |
158 ## Example output: | |
159 ## -- CMakeFiles/target.dir/main.d.obj | |
4 | 160 macro(OBJ_PATH path) |
9 | 161 set(test) |
4 | 162 string(REGEX MATCH "${CMAKE_CURRENT_BINARY_DIR}/.*" test "${${path}}") |
163 if(NOT ${test} EQUAL "") | |
164 string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" first) | |
165 string(LENGTH "${${path}}" last) | |
166 math(EXPR first "${first} + 1") | |
167 math(EXPR len "${last} - ${first}") | |
168 string(SUBSTRING "${${path}}" ${first} ${len} ${path}) | |
169 else(NOT ${test} EQUAL "") | |
170 string(REGEX MATCH "${CMAKE_CURRENT_SOURCE_DIR}/.*" test "${${path}}") | |
171 if(NOT ${test} EQUAL "") | |
172 string(LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" first) | |
173 string(LENGTH "${${path}}" last) | |
174 math(EXPR first "${first} + 1") | |
175 math(EXPR len "${last} - ${first}") | |
176 string(SUBSTRING "${${path}}" ${first} ${len} ${path}) | |
177 endif(NOT ${test} EQUAL "") | |
178 endif(NOT ${test} EQUAL "") | |
179 endmacro(OBJ_PATH) | |
180 | |
7 | 181 |
182 ## Compile d files. | |
183 ## target -- name of a new target. | |
184 ## objects_list -- created object files. | |
185 ## params -- sources files. | |
4 | 186 macro(compile_d_files target objects_list) |
9 | 187 set(${objects_list}) |
4 | 188 set(tmp_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir) |
189 file(MAKE_DIRECTORY ${tmp_dir}) | |
9 | 190 if(NOT SINGLE_D_OBJECT) |
7 | 191 foreach (d_source_p ${ARGN}) |
192 ## TODO: why find_file command work wrong? | |
193 find_file(d_source_p ${d_source_p} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} | |
194 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) | |
195 set (d_source ${d_source_p}) | |
196 obj_path(d_source) | |
4 | 197 set(d_obj ${tmp_dir}/${d_source}${D_OBJECT_SUFFIX}) |
7 | 198 set(${objects_list} ${${objects_list}} ${d_obj}) |
4 | 199 get_filename_component(path ${d_obj} PATH) |
200 file(MAKE_DIRECTORY ${path}) | |
201 set(d_obj_out ${d_obj}) | |
7 | 202 obj_path(d_obj_out) |
4 | 203 add_custom_command(OUTPUT "${d_obj}" |
204 COMMAND "${DC}" | |
7 | 205 ARGS ${D_FLAGS} -c ${d_source_p} -of${d_obj} |
4 | 206 COMMENT "Building ${d_obj_out}" |
7 | 207 DEPENDS ${d_source_p} |
208 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
4 | 209 ) |
7 | 210 endforeach(d_source_p) |
9 | 211 else(NOT SINGLE_D_OBJECT) |
4 | 212 set(${objects_list} ${tmp_dir}/${target}${D_OBJECT_SUFFIX}) |
213 set(d_obj_out ${${objects_list}}) | |
7 | 214 obj_path(d_obj_out) |
4 | 215 set(parameters_list_file ${tmp_dir}/parameters) |
7 | 216 set(parameters ${D_FLAGS} -c ${ARGN} -of${${objects_list}}) |
217 file(REMOVE ${parameters_list_file}) | |
218 foreach(arg ${parameters}) | |
219 file(APPEND ${parameters_list_file} "${arg}\n") | |
220 endforeach(arg) | |
4 | 221 add_custom_command(OUTPUT "${${objects_list}}" |
222 COMMAND "${DC}" | |
223 ARGS @${parameters_list_file} | |
224 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
225 DEPENDS ${ARGN} | |
226 COMMENT "" | |
227 ) | |
9 | 228 endif(NOT SINGLE_D_OBJECT) |
7 | 229 add_custom_target(${target} DEPENDS "${${objects_list}}") |
4 | 230 endmacro(compile_d_files objects_list) |
231 | |
7 | 232 ## Build example macro. |
233 ## name -- example name. | |
234 ## Options: | |
235 ## PACKAGES -- list of packages to link to exaple (for example, QtCore QtGui QtOpenGL). | |
236 ## Default value is "QtCore QtGui". | |
237 ## params -- sources d files. | |
238 ## Usage: | |
239 ## build_example(ExampleName PACKAGES QtCore QtGui QtXml main.d another_d_file.d) | |
4 | 240 macro(build_example name) |
9 | 241 set(is_sources) |
242 set(is_libs) | |
4 | 243 set(qtd_libs ${core_lib_param} ${gui_lib_param}) |
244 foreach(param ${ARGN}) | |
245 if(is_libs) | |
246 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" param_package "${param}") | |
247 if(${param_package} STREQUAL ${param}) | |
9 | 248 set(is_libs) |
4 | 249 set(is_sources 1) |
250 else(${param_package} STREQUAL ${param}) | |
9 | 251 set(is_founded) |
4 | 252 foreach(package_big ${packages_big}) |
253 string(TOLOWER ${package_big} package) | |
254 if(${param_package} STREQUAL ${package_big}) | |
255 set(qtd_libs ${qtd_libs} ${${package}_lib_param}) | |
256 set(is_founded 1) | |
257 break(package_big ${packages_big}) | |
258 endif(${param_package} STREQUAL ${package_big}) | |
259 endforeach(package_big ${packages_big}) | |
260 if(NOT is_founded) | |
261 message(STATUS "Module ${param_package} not founded for example ${name}") | |
262 return(build_example name) | |
263 endif(NOT is_founded) | |
264 endif(${param_package} STREQUAL ${param}) | |
265 endif(is_libs) | |
266 if(NOT is_libs) | |
267 if(NOT is_sources) | |
268 if(${param} STREQUAL PACKAGES) | |
269 set(is_libs 1) | |
270 set(qtd_libs) | |
271 else(${param} STREQUAL PACKAGES) | |
272 set(is_sources 1) | |
273 endif(${param} STREQUAL PACKAGES) | |
274 endif(NOT is_sources) | |
275 if(is_sources) | |
276 set(sources ${sources} ${param}) | |
277 endif(is_sources) | |
278 endif(NOT is_libs) | |
279 endforeach(param ${ARGN}) | |
280 compile_d_files(${name}_dobjs objects ${sources} ) | |
281 set(output ${CMAKE_CURRENT_BINARY_DIR}/${name}${CMAKE_EXECUTABLE_SUFFIX}) | |
282 set(output_native ${output}) | |
7 | 283 make_native_path(output_native) |
284 ## Bug fix: Reverse libs for ldc. | |
285 if(D_IS_LLVM) | |
286 set(qtd_libs_tmp ${qtd_libs}) | |
9 | 287 set(qtd_libs) |
7 | 288 foreach(libs ${qtd_libs_tmp}) |
289 set(qtd_libs ${libs} ${qtd_libs}) | |
290 endforeach(libs ${qtd_libs_tmp}) | |
291 endif(D_IS_LLVM) | |
4 | 292 add_custom_command(OUTPUT "${output}" |
293 COMMAND "${DC}" | |
294 ARGS ${D_FLAGS} ${libs_path} ${qtd_libs} ${objects} | |
295 -of${output_native} | |
296 DEPENDS ${objects} | |
297 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
298 COMMENT "Building example ${name}" | |
299 ) | |
300 add_custom_target(example_${name} ALL DEPENDS "${output}") | |
301 add_dependencies(example_${name} allpackages) | |
302 endmacro(build_example sources) | |
303 | |
7 | 304 ##-------------------------------------------- |
305 ## Build library. | |
306 ##-------------------------------------------- | |
307 add_subdirectory(generator) | |
308 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | |
309 add_custom_target(allpackages ALL) | |
310 link_directories(${CMAKE_BINARY_DIR}/CMakeFiles) | |
311 | |
312 foreach(package_big ${packages_big}) | |
313 string(TOLOWER ${package_big} package) | |
314 ## Loading settings for package. | |
9 | 315 set(d_objs) |
316 set(cpp_objs) | |
317 set(d_sources) | |
318 set(cpp_sources) | |
319 set(lib_name) | |
320 set(link_cpp) | |
321 set(link_d) | |
322 set(cpp_files) | |
323 set(d_files) | |
324 set(classes) | |
325 set(d_generated_files) | |
326 set(link_example) | |
7 | 327 include (${CMAKE_SOURCE_DIR}/build/${package}.txt) |
328 | |
329 ## Loading package sources list. | |
330 foreach(d_source ${d_files}) | |
331 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d) | |
332 endforeach(d_source) | |
333 foreach(d_source ${d_generated_files}) | |
334 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d) | |
335 endforeach(d_source) | |
336 foreach (cpp_source ${cpp_files}) | |
337 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp) | |
338 endforeach(cpp_source) | |
339 set(classes ArrayOps ${classes}) | |
340 foreach(class ${classes}) | |
341 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) | |
9 | 342 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp) |
343 add_sources_for_generating(${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp) | |
344 add_sources_for_generating(${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) | |
7 | 345 endforeach(class) |
346 | |
347 ## Link CPP library. | |
348 set(lib_name ${D_LIB_PREFIX}qtd${package}${D_LIB_SUFFIX}) | |
349 add_library(cpp_${package} SHARED ${cpp_sources}) | |
350 | |
351 ## Link D library. | |
352 compile_d_files(${package}_dobjs objects ${d_sources}) | |
353 set(d_objs ${d_objs} ${objects}) | |
354 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
355 set_property(TARGET cpp_${package} PROPERTY RUNTIME_OUTPUT_DIRECTORY lib) | |
356 set_property(TARGET cpp_${package} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) | |
357 target_link_libraries(cpp_${package} ${link_cpp} ) | |
358 set(cpp_lib ${CMAKE_BINARY_DIR}/lib/libcpp_${package}.dll) | |
359 set(cpp_lib_native ${cpp_lib}) | |
360 make_native_path(cpp_lib_native) | |
361 set(d_implib ${CMAKE_BINARY_DIR}/CMakeFiles/${package}.dir/cpp_${package}.lib) | |
362 set(d_implib_native ${d_implib}) | |
363 make_native_path(d_implib_native) | |
364 add_custom_command( | |
365 OUTPUT "${d_implib}" | |
366 COMMAND "${IMPLIB}" | |
367 ARGS /system /PAGESIZE:32 ${d_implib_native} ${cpp_lib_native} | |
368 DEPENDS "cpp_${package}" | |
369 COMMENT "Creating implib ${lib_name}" | |
370 ) | |
371 add_custom_command( | |
372 OUTPUT "${lib_name}" | |
373 COMMAND "${DC}" | |
374 ARGS -lib ${d_objs} ${d_implib} -oflib/${lib_name} | |
375 DEPENDS ${d_objs} ${d_implib} | |
376 COMMENT "Linking ${lib_name}" | |
377 ) | |
378 else(${CMAKE_SYSTEM_NAME} STREQUAL Linux) | |
379 set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) | |
380 foreach(cpp_source ${cpp_sources}) | |
381 set(cpp_source ${cpp_source}) | |
382 obj_path(cpp_source) | |
383 set(cpp_objs ${cpp_objs} CMakeFiles/cpp_${package}.dir/${cpp_source}.o) | |
384 endforeach(cpp_source) | |
385 add_custom_command( | |
386 OUTPUT "${lib_name}" | |
387 COMMAND "${CMAKE_AR}" | |
388 ARGS rcs lib/${lib_name} ${d_objs} ${cpp_objs} | |
389 DEPENDS ${d_objs} cpp_${package} | |
390 COMMENT "Linking ${lib_name}" | |
391 ) | |
392 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
393 | |
394 ## Dependences. | |
395 add_dependencies(cpp_${package} dgen) | |
396 add_custom_target(${package} DEPENDS ${lib_name}) | |
397 foreach(depend ${depends}) | |
398 add_dependencies(cpp_${package} cpp_${depend}) | |
399 add_dependencies(${package} ${depend}) | |
400 endforeach(depend ${depends}) | |
401 add_dependencies(allpackages ${package}) | |
402 set(depends ${depends} ${package}) | |
403 | |
404 ## Paths for QtD libs. Needed by examples. | |
405 if(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) | |
406 set(libs_path ${CMAKE_BINARY_DIR}/lib/qtd${package}.lib) | |
407 make_native_path(libs_path) | |
408 set(${package}_lib_param -L+${libs_path}) | |
409 foreach(link ${link_example}) | |
410 set(link ${CMAKE_SOURCE_DIR}/lib/${link}.lib) | |
411 make_native_path(link) | |
412 set(link -L+${link}) | |
413 set(${package}_lib_param ${${package}_lib_param} ${link}) | |
414 endforeach(link ${link_example}) | |
415 else (${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) | |
416 set(${package}_lib_param -L-lqtd${package} -L-lQt${package_big}) | |
417 foreach(link ${link_example}) | |
418 set(${package}_lib_param ${${package}_lib_param} ${link}) | |
419 endforeach(link ${link_example}) | |
420 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows AND D_IS_MARS) | |
9 | 421 |
11
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
422 set(regexp_str "(${CMAKE_BINARY_DIR}|${CMAKE_SOURCE_DIR})/([A-Za-z0-9\\-_\\\\/]+)[/]+([A-Za-z0-9\\-_\\\\]+).d") |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
423 foreach(source ${d_sources}) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
424 # find_file(source ${source} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
425 # ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
426 string(REGEX REPLACE ${regexp_str} "\\2" inc_path "${source}") |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
427 string(REGEX REPLACE ${regexp_str} "\\3" file_name "${source}") |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
428 set(interface_file_path ${CMAKE_BINARY_DIR}/include/${inc_path}) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
429 set(interface_file "${interface_file_path}/${file_name}.di") |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
430 if(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
431 add_custom_command(OUTPUT "${interface_file}" |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
432 COMMAND "${DC}" |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
433 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
434 COMMENT "Generating header for ${source}" |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
435 DEPENDS ${source} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
436 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
437 ) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
438 else(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
439 add_custom_command(OUTPUT "${interface_file}" |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
440 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
441 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
442 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
443 COMMENT "" |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
444 DEPENDS ${source} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
445 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
446 ) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
447 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
448 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di) |
28c9f8f8f34b
Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents:
10
diff
changeset
|
449 endforeach(source) |
9 | 450 endforeach(package_big ${packages_big}) |
451 # add_custom_target(generate_headers DEPENDS ${interfaces_list}) | |
7 | 452 |
453 ##-------------------------------------------- | |
454 ## Build other parts of the QtD. | |
455 ##-------------------------------------------- | |
456 if(BUILD_EXAMPLES) | |
4 | 457 add_subdirectory(demos) |
458 add_subdirectory(examples) | |
7 | 459 endif(BUILD_EXAMPLES) |