2 # VoglProj QtCreator cmake source tag file.
5 cmake_minimum_required(VERSION 2.8)
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)
12 "${CMAKE_CURRENT_SOURCE_DIR}/../src"
13 "${CMAKE_CURRENT_SOURCE_DIR}/../bin"
14 "${CMAKE_CURRENT_SOURCE_DIR}/../glspec")
16 message("VOGL_DIR is ${VOGL_DIR}")
17 message("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
19 add_definitions("-DVOGL_USE_LINUX_API=1")
20 add_definitions("-DSDL_VIDEO_DRIVER_X11=1")
21 add_definitions("-DSDL_VIDEO_DRIVER_X11_DYNAMIC")
23 # Create list of vogl directories plus extensions.
25 foreach(dir ${VOGL_DIR})
26 foreach(ext ${EXTLIST})
27 list(APPEND GLOBSPEC ${dir}/${ext})
31 message("globspec is ${GLOBSPEC}")
33 # Search for all the files.
34 file(GLOB_RECURSE vogl_srcs
39 # Macro to remove files based on regex pattern.
40 macro(RemoveSrcFiles pat)
42 foreach(file ${vogl_srcs})
43 if(file MATCHES ${pat})
45 list(APPEND result ${file})
48 set(vogl_srcs ${result})
51 # Remove all files under .git and .hg directories.
52 RemoveSrcFiles("/[.]git/")
53 RemoveSrcFiles("/[.]hg/")
55 #RemoveSrcFiles("/src/OGLSuperBible/")
56 #RemoveSrcFiles("/src/OGLSamples_GTruc/")
59 # Spew out all files we've found.
62 foreach(file ${vogl_srcs})
64 math(EXPR count "${count} + 1")
65 GET_FILENAME_COMPONENT(dir_path ${file} PATH)
66 SET(dir_list ${dir_list} ${dir_path})
69 list(REMOVE_DUPLICATES dir_list)
70 include_directories(${dir_list})
72 message("${count} files added.\n")
74 add_executable(VoglProj ${vogl_srcs})
75 set_target_properties(VoglProj PROPERTIES LINKER_LANGUAGE CXX)