I've switched to using QtCreator 3.0 as my main editor. I'm really liking it (and FakeVim!), but one big issue we've run into is projects. What files are loaded, what defines are set, files not listed in our makefiles (.sh), listing include files in our makefiles just so they're in the project, etc. It also likes to blast .user files where you open your makefile and now we're dealing with getting mercurial or git to ignore those, etc.
I wrote the below which just finds everything under our vogl project directory with specified extensions. It also takes some patterns to remove files after the fact (possibly someone can tell me a more optimal way of doing this?).
Next I'm going to figure out how to get QtCreator to parse ninja build output. (Grumble, grumble. :)
In any case, throwing it up here in case someone might find it useful...
#
# VoglProj QtCreator cmake file.
#
# Do the following in the directory above your vogl enlistment:
#
# ln -s vogl/bin/qtcreator/CMakeLists.txt
#
# Then open it up with QtCreator and you should be off and running.
#
project(VoglProj)
cmake_minimum_required(VERSION 2.8)
# List of file extensions that we search for.
set(EXTLIST *.i *.sh *.inl *.inc *.txt *.vs *.vp *.frag *.vert *.py *.m *.c* *.h* *.S)
# Vogl directory.
set(VOGL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vogl")
if(NOT EXISTS "${VOGL_DIR}/")
message("\nERROR: ${VOGL_DIR} does not exist. Please put this script one level up from your vogl enlistement.\n")
message(FATAL_ERROR "Exiting...")
endif()
# Create list of vogl directorie plus extensions.
set(GLOBSPEC)
foreach(ext ${EXTLIST})
list(APPEND GLOBSPEC ${VOGL_DIR}/${ext})
endforeach()
# Search for all the files.
file(GLOB_RECURSE vogl_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${GLOBSPEC}
)
# Macro to remove files based on regex pattern.
macro(RemoveSrcFiles pat)
set(result)
foreach(file ${vogl_srcs})
if(file MATCHES ${pat})
else()
list(APPEND result ${file})
endif()
endforeach()
set(vogl_srcs ${result})
endmacro()
# Remove all files under .git and .hg directories.
RemoveSrcFiles("/[.]git/")
RemoveSrcFiles("/[.]hg/")
# Spew out all files we've found.
set(count 0)
foreach(file ${vogl_srcs})
message("${file}")
math(EXPR count "${count} + 1")
endforeach()
message("${count} files added.\n")
add_executable(VoglProj ${vogl_srcs})
set_target_properties(VoglProj PROPERTIES LINKER_LANGUAGE C)
This comment has been removed by the author.
ReplyDelete