]> git.cworth.org Git - vogl/blob - qtcreator/CMakeLists.txt
Make voglgen accept specdir as option
[vogl] / qtcreator / CMakeLists.txt
1 #
2 # VoglProj QtCreator cmake source tag file.
3 #
4 project(VoglProj)
5 cmake_minimum_required(VERSION 2.8)
6
7 # List of file extensions that we search for.
8 set(EXTLIST *.i *.sh *.inl *.inc *.txt *.vs *.vp *.frag *.vert *.py *.m *.c* *.h* *.S *.ui)
9
10 # Vogl directories.
11 set(VOGL_DIR 
12     "${CMAKE_CURRENT_SOURCE_DIR}/../src"
13     "${CMAKE_CURRENT_SOURCE_DIR}/../bin"
14     "${CMAKE_CURRENT_SOURCE_DIR}/../glspec")
15
16 message("VOGL_DIR is ${VOGL_DIR}")
17 message("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
18
19 add_definitions("-DVOGL_USE_LINUX_API=1")
20 add_definitions("-DSDL_VIDEO_DRIVER_X11=1")
21 add_definitions("-DSDL_VIDEO_DRIVER_X11_DYNAMIC")
22
23 # Create list of vogl directories plus extensions.
24 set(GLOBSPEC)
25 foreach(dir ${VOGL_DIR})
26     foreach(ext ${EXTLIST})
27         list(APPEND GLOBSPEC ${dir}/${ext})
28     endforeach()
29 endforeach()
30
31 message("globspec is ${GLOBSPEC}")
32
33 # Search for all the files.
34 file(GLOB_RECURSE vogl_srcs
35     ${VOGL_DIR}
36     ${GLOBSPEC}
37     )
38
39 # Macro to remove files based on regex pattern.
40 macro(RemoveSrcFiles pat)
41     set(result)
42     foreach(file ${vogl_srcs})
43         if(file MATCHES ${pat})
44         else()
45             list(APPEND result ${file})
46         endif()
47     endforeach()
48     set(vogl_srcs ${result})
49 endmacro()
50
51 # Remove all files under .git and .hg directories.
52 RemoveSrcFiles("/[.]git/")
53 RemoveSrcFiles("/[.]hg/")
54
55 #RemoveSrcFiles("/src/OGLSuperBible/")
56 #RemoveSrcFiles("/src/OGLSamples_GTruc/")
57 #RemoveSrcFiles(".~")
58
59 # Spew out all files we've found.
60 set(dir_list "")
61 set(count 0)
62 foreach(file ${vogl_srcs})
63     message("${file}")
64     math(EXPR count "${count} + 1")
65     GET_FILENAME_COMPONENT(dir_path ${file} PATH)
66     SET(dir_list ${dir_list} ${dir_path})
67 endforeach()
68
69 list(REMOVE_DUPLICATES dir_list)
70 include_directories(${dir_list})
71
72 message("${count} files added.\n")
73
74 add_executable(VoglProj ${vogl_srcs})
75 set_target_properties(VoglProj PROPERTIES LINKER_LANGUAGE CXX)
76