Permalink
Browse files

Added source file groups in CMake files (for better organization of s…

…ources when opening SFML projects in IDEs)
  • Loading branch information...
1 parent 4fbefe7 commit a40ef79a18b16fe47ce7eecb7a8d8f6b42b9e5d0 @LaurentGomila LaurentGomila committed Feb 21, 2013
View
@@ -205,6 +205,9 @@ macro(sfml_add_example target)
# parse the arguments
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
if(THIS_GUI_APP AND WINDOWS)
add_executable(${target} WIN32 ${THIS_SOURCES})
@@ -28,6 +28,7 @@ set(SRC
${SRCROOT}/SoundStream.cpp
${INCROOT}/SoundStream.hpp
)
+source_group("" FILES ${SRC})
# let CMake know about our additional audio libraries paths (on Windows and OSX)
if(WINDOWS)
@@ -7,7 +7,6 @@ set(SRC
${INCROOT}/BlendMode.hpp
${SRCROOT}/Color.cpp
${INCROOT}/Color.hpp
- ${INCROOT}/Drawable.hpp
${INCROOT}/Export.hpp
${SRCROOT}/Font.cpp
${INCROOT}/Font.hpp
@@ -25,30 +24,12 @@ set(SRC
${INCROOT}/RenderStates.hpp
${SRCROOT}/RenderTexture.cpp
${INCROOT}/RenderTexture.hpp
- ${SRCROOT}/RenderTextureImpl.cpp
- ${SRCROOT}/RenderTextureImpl.hpp
- ${SRCROOT}/RenderTextureImplFBO.cpp
- ${SRCROOT}/RenderTextureImplFBO.hpp
- ${SRCROOT}/RenderTextureImplDefault.cpp
- ${SRCROOT}/RenderTextureImplDefault.hpp
${SRCROOT}/RenderTarget.cpp
${INCROOT}/RenderTarget.hpp
${SRCROOT}/RenderWindow.cpp
${INCROOT}/RenderWindow.hpp
${SRCROOT}/Shader.cpp
${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
${INCROOT}/Texture.hpp
${SRCROOT}/TextureSaver.cpp
@@ -61,11 +42,46 @@ set(SRC
${INCROOT}/View.hpp
${SRCROOT}/Vertex.cpp
${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
${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_write.h
)
+source_group("stb_image" FILES ${STB_SRC})
# let CMake know about our additional graphics libraries paths (on Windows and OSX)
if(WINDOWS OR MACOSX)
@@ -114,6 +130,6 @@ endif()
# define the sfml-graphics target
sfml_add_library(sfml-graphics
- SOURCES ${SRC}
+ SOURCES ${SRC} ${DRAWABLES_SRC} ${RENDER_TEXTURE_SRC} ${STB_SRC}
DEPENDS sfml-window sfml-system
EXTERNAL_LIBS ${GRAPHICS_EXT_LIBS})
@@ -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
-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_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d)
@@ -42,6 +42,8 @@ else()
)
endif()
+source_group("" FILES ${SRC})
+
# build the list of external libraries to link
set(NETWORK_EXT_LIBS)
if(WINDOWS)
@@ -34,11 +34,11 @@ set(SRC
${INCROOT}/Vector3.hpp
${INCROOT}/Vector3.inl
)
+source_group("" FILES ${SRC})
# add platform specific sources
if(WINDOWS)
- set(SRC
- ${SRC}
+ set(PLATFORM_SRC
${SRCROOT}/Win32/ClockImpl.cpp
${SRCROOT}/Win32/ClockImpl.hpp
${SRCROOT}/Win32/MutexImpl.cpp
@@ -50,9 +50,9 @@ if(WINDOWS)
${SRCROOT}/Win32/ThreadLocalImpl.cpp
${SRCROOT}/Win32/ThreadLocalImpl.hpp
)
+ source_group("windows" FILES ${PLATFORM_SRC})
else()
- set(SRC
- ${SRC}
+ set(PLATFORM_SRC
${SRCROOT}/Unix/ClockImpl.cpp
${SRCROOT}/Unix/ClockImpl.hpp
${SRCROOT}/Unix/MutexImpl.cpp
@@ -64,6 +64,7 @@ else()
${SRCROOT}/Unix/ThreadLocalImpl.cpp
${SRCROOT}/Unix/ThreadLocalImpl.hpp
)
+ source_group("unix" FILES ${PLATFORM_SRC})
endif()
# build the list of external libraries to link
@@ -77,5 +78,5 @@ endif()
# define the sfml-system target
sfml_add_library(sfml-system
- SOURCES ${SRC}
+ SOURCES ${SRC} ${PLATFORM_SRC}
EXTERNAL_LIBS ${SYSTEM_EXT_LIBS})
@@ -33,11 +33,11 @@ set(SRC
${SRCROOT}/WindowImpl.hpp
${INCROOT}/WindowStyle.hpp
)
+source_group("" FILES ${SRC})
# add platform specific sources
if(WINDOWS)
- set(SRC
- ${SRC}
+ set(PLATFORM_SRC
${SRCROOT}/Win32/WglContext.cpp
${SRCROOT}/Win32/WglContext.hpp
${SRCROOT}/Win32/InputImpl.cpp
@@ -48,9 +48,9 @@ if(WINDOWS)
${SRCROOT}/Win32/WindowImplWin32.cpp
${SRCROOT}/Win32/WindowImplWin32.hpp
)
+ source_group("windows" FILES ${PLATFORM_SRC})
elseif(LINUX)
- set(SRC
- ${SRC}
+ set(PLATFORM_SRC
${SRCROOT}/Linux/Display.cpp
${SRCROOT}/Linux/Display.hpp
${SRCROOT}/Linux/GlxContext.cpp
@@ -63,9 +63,9 @@ elseif(LINUX)
${SRCROOT}/Linux/WindowImplX11.cpp
${SRCROOT}/Linux/WindowImplX11.hpp
)
+ source_group("linux" FILES ${PLATFORM_SRC})
else() # MACOSX
- set(SRC
- ${SRC}
+ set(PLATFORM_SRC
${SRCROOT}/OSX/cpp_objc_conversion.h
${SRCROOT}/OSX/cpp_objc_conversion.mm
${SRCROOT}/OSX/cg_sf_conversion.hpp
@@ -97,6 +97,7 @@ else() # MACOSX
${SRCROOT}/OSX/AutoreleasePoolWrapper.h
${SRCROOT}/OSX/AutoreleasePoolWrapper.mm
)
+ source_group("mac" FILES ${PLATFORM_SRC})
endif()
# find external libraries
@@ -122,6 +123,6 @@ endif()
# define the sfml-window target
sfml_add_library(sfml-window
- SOURCES ${SRC}
+ SOURCES ${SRC} ${PLATFORM_SRC}
DEPENDS sfml-system
EXTERNAL_LIBS ${WINDOW_EXT_LIBS})

0 comments on commit a40ef79

Please sign in to comment.