Added source file groups in CMake files (for better organization of sources when opening SFML projects in IDEs)

This commit is contained in:
Laurent Gomila 2013-02-21 20:25:11 +01:00
parent 4fbefe7469
commit a40ef79a18
7 changed files with 63 additions and 33 deletions

View File

@ -205,6 +205,9 @@ macro(sfml_add_example target)
# parse the arguments # parse the arguments
sfml_parse_arguments(THIS "SOURCES;DEPENDS" "GUI_APP" ${ARGN}) sfml_parse_arguments(THIS "SOURCES;DEPENDS" "GUI_APP" ${ARGN})
# set a source group for the source files
source_group("" FILES ${THIS_SOURCES})
# create the target # create the target
if(THIS_GUI_APP AND WINDOWS) if(THIS_GUI_APP AND WINDOWS)
add_executable(${target} WIN32 ${THIS_SOURCES}) add_executable(${target} WIN32 ${THIS_SOURCES})

View File

@ -28,6 +28,7 @@ set(SRC
${SRCROOT}/SoundStream.cpp ${SRCROOT}/SoundStream.cpp
${INCROOT}/SoundStream.hpp ${INCROOT}/SoundStream.hpp
) )
source_group("" FILES ${SRC})
# let CMake know about our additional audio libraries paths (on Windows and OSX) # let CMake know about our additional audio libraries paths (on Windows and OSX)
if(WINDOWS) if(WINDOWS)

View File

@ -7,7 +7,6 @@ set(SRC
${INCROOT}/BlendMode.hpp ${INCROOT}/BlendMode.hpp
${SRCROOT}/Color.cpp ${SRCROOT}/Color.cpp
${INCROOT}/Color.hpp ${INCROOT}/Color.hpp
${INCROOT}/Drawable.hpp
${INCROOT}/Export.hpp ${INCROOT}/Export.hpp
${SRCROOT}/Font.cpp ${SRCROOT}/Font.cpp
${INCROOT}/Font.hpp ${INCROOT}/Font.hpp
@ -25,30 +24,12 @@ set(SRC
${INCROOT}/RenderStates.hpp ${INCROOT}/RenderStates.hpp
${SRCROOT}/RenderTexture.cpp ${SRCROOT}/RenderTexture.cpp
${INCROOT}/RenderTexture.hpp ${INCROOT}/RenderTexture.hpp
${SRCROOT}/RenderTextureImpl.cpp
${SRCROOT}/RenderTextureImpl.hpp
${SRCROOT}/RenderTextureImplFBO.cpp
${SRCROOT}/RenderTextureImplFBO.hpp
${SRCROOT}/RenderTextureImplDefault.cpp
${SRCROOT}/RenderTextureImplDefault.hpp
${SRCROOT}/RenderTarget.cpp ${SRCROOT}/RenderTarget.cpp
${INCROOT}/RenderTarget.hpp ${INCROOT}/RenderTarget.hpp
${SRCROOT}/RenderWindow.cpp ${SRCROOT}/RenderWindow.cpp
${INCROOT}/RenderWindow.hpp ${INCROOT}/RenderWindow.hpp
${SRCROOT}/Shader.cpp ${SRCROOT}/Shader.cpp
${INCROOT}/Shader.hpp ${INCROOT}/Shader.hpp
${SRCROOT}/Shape.cpp
${INCROOT}/Shape.hpp
${SRCROOT}/CircleShape.cpp
${INCROOT}/CircleShape.hpp
${SRCROOT}/RectangleShape.cpp
${INCROOT}/RectangleShape.hpp
${SRCROOT}/ConvexShape.cpp
${INCROOT}/ConvexShape.hpp
${SRCROOT}/Sprite.cpp
${INCROOT}/Sprite.hpp
${SRCROOT}/Text.cpp
${INCROOT}/Text.hpp
${SRCROOT}/Texture.cpp ${SRCROOT}/Texture.cpp
${INCROOT}/Texture.hpp ${INCROOT}/Texture.hpp
${SRCROOT}/TextureSaver.cpp ${SRCROOT}/TextureSaver.cpp
@ -61,11 +42,46 @@ set(SRC
${INCROOT}/View.hpp ${INCROOT}/View.hpp
${SRCROOT}/Vertex.cpp ${SRCROOT}/Vertex.cpp
${INCROOT}/Vertex.hpp ${INCROOT}/Vertex.hpp
)
source_group("" FILES ${SRC})
# drawables sources
set(DRAWABLES_SRC
${INCROOT}/Drawable.hpp
${SRCROOT}/Shape.cpp
${INCROOT}/Shape.hpp
${SRCROOT}/CircleShape.cpp
${INCROOT}/CircleShape.hpp
${SRCROOT}/RectangleShape.cpp
${INCROOT}/RectangleShape.hpp
${SRCROOT}/ConvexShape.cpp
${INCROOT}/ConvexShape.hpp
${SRCROOT}/Sprite.cpp
${INCROOT}/Sprite.hpp
${SRCROOT}/Text.cpp
${INCROOT}/Text.hpp
${SRCROOT}/VertexArray.cpp ${SRCROOT}/VertexArray.cpp
${INCROOT}/VertexArray.hpp ${INCROOT}/VertexArray.hpp
)
source_group("drawables" FILES ${DRAWABLES_SRC})
# render-texture sources
set(RENDER_TEXTURE_SRC
${SRCROOT}/RenderTextureImpl.cpp
${SRCROOT}/RenderTextureImpl.hpp
${SRCROOT}/RenderTextureImplFBO.cpp
${SRCROOT}/RenderTextureImplFBO.hpp
${SRCROOT}/RenderTextureImplDefault.cpp
${SRCROOT}/RenderTextureImplDefault.hpp
)
source_group("render texture" FILES ${RENDER_TEXTURE_SRC})
# stb_image sources
set(STB_SRC
${SRCROOT}/stb_image/stb_image.h ${SRCROOT}/stb_image/stb_image.h
${SRCROOT}/stb_image/stb_image_write.h ${SRCROOT}/stb_image/stb_image_write.h
) )
source_group("stb_image" FILES ${STB_SRC})
# let CMake know about our additional graphics libraries paths (on Windows and OSX) # let CMake know about our additional graphics libraries paths (on Windows and OSX)
if(WINDOWS OR MACOSX) if(WINDOWS OR MACOSX)
@ -114,6 +130,6 @@ endif()
# define the sfml-graphics target # define the sfml-graphics target
sfml_add_library(sfml-graphics sfml_add_library(sfml-graphics
SOURCES ${SRC} SOURCES ${SRC} ${DRAWABLES_SRC} ${RENDER_TEXTURE_SRC} ${STB_SRC}
DEPENDS sfml-window sfml-system DEPENDS sfml-window sfml-system
EXTERNAL_LIBS ${GRAPHICS_EXT_LIBS}) EXTERNAL_LIBS ${GRAPHICS_EXT_LIBS})

View File

@ -1,6 +1,12 @@
# sources
set(SRC
${PROJECT_SOURCE_DIR}/src/SFML/Main/SFML_Main.cpp
)
source_group("" FILES ${SRC})
# define the sfml-main target # define the sfml-main target
add_library(sfml-main STATIC ${PROJECT_SOURCE_DIR}/src/SFML/Main/SFML_Main.cpp) add_library(sfml-main STATIC ${SRC})
# set the debug suffix # set the debug suffix
set_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d) set_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d)

View File

@ -42,6 +42,8 @@ else()
) )
endif() endif()
source_group("" FILES ${SRC})
# build the list of external libraries to link # build the list of external libraries to link
set(NETWORK_EXT_LIBS) set(NETWORK_EXT_LIBS)
if(WINDOWS) if(WINDOWS)

View File

@ -34,11 +34,11 @@ set(SRC
${INCROOT}/Vector3.hpp ${INCROOT}/Vector3.hpp
${INCROOT}/Vector3.inl ${INCROOT}/Vector3.inl
) )
source_group("" FILES ${SRC})
# add platform specific sources # add platform specific sources
if(WINDOWS) if(WINDOWS)
set(SRC set(PLATFORM_SRC
${SRC}
${SRCROOT}/Win32/ClockImpl.cpp ${SRCROOT}/Win32/ClockImpl.cpp
${SRCROOT}/Win32/ClockImpl.hpp ${SRCROOT}/Win32/ClockImpl.hpp
${SRCROOT}/Win32/MutexImpl.cpp ${SRCROOT}/Win32/MutexImpl.cpp
@ -50,9 +50,9 @@ if(WINDOWS)
${SRCROOT}/Win32/ThreadLocalImpl.cpp ${SRCROOT}/Win32/ThreadLocalImpl.cpp
${SRCROOT}/Win32/ThreadLocalImpl.hpp ${SRCROOT}/Win32/ThreadLocalImpl.hpp
) )
source_group("windows" FILES ${PLATFORM_SRC})
else() else()
set(SRC set(PLATFORM_SRC
${SRC}
${SRCROOT}/Unix/ClockImpl.cpp ${SRCROOT}/Unix/ClockImpl.cpp
${SRCROOT}/Unix/ClockImpl.hpp ${SRCROOT}/Unix/ClockImpl.hpp
${SRCROOT}/Unix/MutexImpl.cpp ${SRCROOT}/Unix/MutexImpl.cpp
@ -64,6 +64,7 @@ else()
${SRCROOT}/Unix/ThreadLocalImpl.cpp ${SRCROOT}/Unix/ThreadLocalImpl.cpp
${SRCROOT}/Unix/ThreadLocalImpl.hpp ${SRCROOT}/Unix/ThreadLocalImpl.hpp
) )
source_group("unix" FILES ${PLATFORM_SRC})
endif() endif()
# build the list of external libraries to link # build the list of external libraries to link
@ -77,5 +78,5 @@ endif()
# define the sfml-system target # define the sfml-system target
sfml_add_library(sfml-system sfml_add_library(sfml-system
SOURCES ${SRC} SOURCES ${SRC} ${PLATFORM_SRC}
EXTERNAL_LIBS ${SYSTEM_EXT_LIBS}) EXTERNAL_LIBS ${SYSTEM_EXT_LIBS})

View File

@ -33,11 +33,11 @@ set(SRC
${SRCROOT}/WindowImpl.hpp ${SRCROOT}/WindowImpl.hpp
${INCROOT}/WindowStyle.hpp ${INCROOT}/WindowStyle.hpp
) )
source_group("" FILES ${SRC})
# add platform specific sources # add platform specific sources
if(WINDOWS) if(WINDOWS)
set(SRC set(PLATFORM_SRC
${SRC}
${SRCROOT}/Win32/WglContext.cpp ${SRCROOT}/Win32/WglContext.cpp
${SRCROOT}/Win32/WglContext.hpp ${SRCROOT}/Win32/WglContext.hpp
${SRCROOT}/Win32/InputImpl.cpp ${SRCROOT}/Win32/InputImpl.cpp
@ -48,9 +48,9 @@ if(WINDOWS)
${SRCROOT}/Win32/WindowImplWin32.cpp ${SRCROOT}/Win32/WindowImplWin32.cpp
${SRCROOT}/Win32/WindowImplWin32.hpp ${SRCROOT}/Win32/WindowImplWin32.hpp
) )
source_group("windows" FILES ${PLATFORM_SRC})
elseif(LINUX) elseif(LINUX)
set(SRC set(PLATFORM_SRC
${SRC}
${SRCROOT}/Linux/Display.cpp ${SRCROOT}/Linux/Display.cpp
${SRCROOT}/Linux/Display.hpp ${SRCROOT}/Linux/Display.hpp
${SRCROOT}/Linux/GlxContext.cpp ${SRCROOT}/Linux/GlxContext.cpp
@ -63,9 +63,9 @@ elseif(LINUX)
${SRCROOT}/Linux/WindowImplX11.cpp ${SRCROOT}/Linux/WindowImplX11.cpp
${SRCROOT}/Linux/WindowImplX11.hpp ${SRCROOT}/Linux/WindowImplX11.hpp
) )
source_group("linux" FILES ${PLATFORM_SRC})
else() # MACOSX else() # MACOSX
set(SRC set(PLATFORM_SRC
${SRC}
${SRCROOT}/OSX/cpp_objc_conversion.h ${SRCROOT}/OSX/cpp_objc_conversion.h
${SRCROOT}/OSX/cpp_objc_conversion.mm ${SRCROOT}/OSX/cpp_objc_conversion.mm
${SRCROOT}/OSX/cg_sf_conversion.hpp ${SRCROOT}/OSX/cg_sf_conversion.hpp
@ -97,6 +97,7 @@ else() # MACOSX
${SRCROOT}/OSX/AutoreleasePoolWrapper.h ${SRCROOT}/OSX/AutoreleasePoolWrapper.h
${SRCROOT}/OSX/AutoreleasePoolWrapper.mm ${SRCROOT}/OSX/AutoreleasePoolWrapper.mm
) )
source_group("mac" FILES ${PLATFORM_SRC})
endif() endif()
# find external libraries # find external libraries
@ -122,6 +123,6 @@ endif()
# define the sfml-window target # define the sfml-window target
sfml_add_library(sfml-window sfml_add_library(sfml-window
SOURCES ${SRC} SOURCES ${SRC} ${PLATFORM_SRC}
DEPENDS sfml-system DEPENDS sfml-system
EXTERNAL_LIBS ${WINDOW_EXT_LIBS}) EXTERNAL_LIBS ${WINDOW_EXT_LIBS})