Skip to content

Commit

Permalink
Added source file groups in CMake files (for better organization of s…
Browse files Browse the repository at this point in the history
…ources when opening SFML projects in IDEs)
  • Loading branch information
LaurentGomila committed Feb 21, 2013
1 parent 4fbefe7 commit a40ef79
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 33 deletions.
3 changes: 3 additions & 0 deletions cmake/Macros.cmake
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/SFML/Audio/CMakeLists.txt
Expand Up @@ -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)
Expand Down
56 changes: 36 additions & 20 deletions src/SFML/Graphics/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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})
8 changes: 7 additions & 1 deletion src/SFML/Main/CMakeLists.txt
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/SFML/Network/CMakeLists.txt
Expand Up @@ -42,6 +42,8 @@ else()
)
endif()

source_group("" FILES ${SRC})

# build the list of external libraries to link
set(NETWORK_EXT_LIBS)
if(WINDOWS)
Expand Down
11 changes: 6 additions & 5 deletions src/SFML/System/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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})
15 changes: 8 additions & 7 deletions src/SFML/Window/CMakeLists.txt
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -97,6 +97,7 @@ else() # MACOSX
${SRCROOT}/OSX/AutoreleasePoolWrapper.h
${SRCROOT}/OSX/AutoreleasePoolWrapper.mm
)
source_group("mac" FILES ${PLATFORM_SRC})
endif()

# find external libraries
Expand All @@ -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.