Skip to content

Commit

Permalink
Add GenerateSourceGroups macro.
Browse files Browse the repository at this point in the history
Attempt to generate source_group for IDEs reflecting folders structure.
No functional changes to build configuration included.

git-svn-id: http://svn.osgeo.org/geos/trunk@4036 5242fede-7e19-0410-aef8-94bd7d2200fb
  • Loading branch information
mloskot committed Nov 26, 2014
1 parent ff061d7 commit ab1cf8a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 95 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ endif()
#################################################################################
# Configure subdirectories
#################################################################################
include(GenerateSourceGroups)

add_subdirectory(include)
add_subdirectory(src)
Expand Down
17 changes: 17 additions & 0 deletions cmake/modules/GenerateSourceGroups.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Macro generates tree of IDE source groups based on folders structure
# Source: http://www.cmake.org/pipermail/cmake/2013-November/056332.html
#
macro(GenerateSourceGroups curdir)
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
GenerateSourceGroups(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
# I would like to call the src root folder in a different name, only in visual studio (not mandatory requirement)
string(REPLACE "src" "Source Files" groupname ${groupname})
source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endmacro()
5 changes: 5 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
install(CODE
"execute_process(COMMAND ln -sfh Versions/Current/Headers \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/GEOS.framework/Headers\")")
endif()

#################################################################################
# Group source files for IDE source explorers (e.g. Visual Studio)
#################################################################################
GenerateSourceGroups(include)
95 changes: 1 addition & 94 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,97 +99,4 @@ endif()
#################################################################################
# Group source files for IDE source explorers (e.g. Visual Studio)
#################################################################################

file(GLOB top_HEADERS ${CMAKE_SOURCE_DIR}/include/*.h)
source_group("Header Files" FILES ${top_HEADERS})
file(GLOB geos_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/*.h)
source_group("Header Files\\geos" FILES ${geos_HEADERS})
### geos/algorithm
file(GLOB geos_algorithm_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/algorithm/*.h)
source_group("Header Files\\geos\\algorithm" FILES ${geos_algorithm_HEADERS})
file(GLOB geos_algorithm_distance_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/algorithm/distance/*.h)
source_group("Header Files\\geos\\algorithm\\distance" FILES ${geos_algorithm_distance_HEADERS})
file(GLOB geos_algorithm_locate_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/algorithm/locate/*.h)
source_group("Header Files\\geos\\algorithm\\locate" FILES ${geos_algorithm_locate_HEADERS})
### geos/geom
file(GLOB geos_geom_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/geom/*.h)
source_group("Header Files\\geos\\geom" FILES ${geos_geom_HEADERS})
file(GLOB geos_geom_prep_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/geom/prep/*.h)
source_group("Header Files\\geos\\geom\\prep" FILES ${geos_geom_prep_HEADERS})
file(GLOB geos_geom_util_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/geom/util/*.h)
source_group("Header Files\\geos\\geom\\util" FILES ${geos_geom_util_HEADERS})
### geos/geomgraph
file(GLOB geos_geomgraph_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/geomgraph/*.h)
source_group("Header Files\\geos\\geomgraph" FILES ${geos_geomgraph_HEADERS})
file(GLOB geos_geomgraph_index_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/geomgraph/index/*.h)
source_group("Header Files\\geos\\geomgraph\\index" FILES ${geos_geomgraph_index_HEADERS})
### geos/index
file(GLOB geos_index_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/*.h)
source_group("Header Files\\geos\\index" FILES ${geos_index_HEADERS})
file(GLOB geos_index_bintree_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/bintree/*.h)
source_group("Header Files\\geos\\index\\bintree" FILES ${geos_index_bintree_HEADERS})
file(GLOB geos_index_chain_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/chain/*.h)
source_group("Header Files\\geos\\index\\chain" FILES ${geos_index_chain_HEADERS})
file(GLOB geos_index_intervalrtree_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/intervalrtree/*.h)
source_group("Header Files\\geos\\index\\intervalrtree" FILES ${geos_index_intervalrtree_HEADERS})
file(GLOB geos_index_quadtree_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/quadtree/*.h)
source_group("Header Files\\geos\\index\\quadtree" FILES ${geos_index_quadtree_HEADERS})
file(GLOB geos_index_strtree_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/strtree/*.h)
source_group("Header Files\\geos\\index\\strtree" FILES ${geos_index_strtree_HEADERS})
file(GLOB geos_index_sweepline_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/index/sweepline/*.h)
source_group("Header Files\\geos\\index\\sweepline" FILES ${geos_index_sweepline_HEADERS})
### geos/io
file(GLOB geos_io_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/io/*.h)
source_group("Header Files\\geos\\io" FILES ${geos_io_HEADERS})
### geos/linearref
file(GLOB geos_linearref_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/linearref/*.h)
source_group("Header Files\\geos\\linearref" FILES ${geos_linearref_HEADERS})
### geos/noding
file(GLOB geos_noding_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/noding/*.h)
source_group("Header Files\\geos\\noding" FILES ${geos_noding_HEADERS})
file(GLOB geos_noding_snapround_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/noding/snapround/*.h)
source_group("Header Files\\geos\\noding\\snapround" FILES ${geos_noding_snapround_HEADERS})
### geos/operation
file(GLOB geos_operation_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/*.h)
source_group("Header Files\\geos\\operation" FILES ${geos_operation_HEADERS})
file(GLOB geos_operation_buffer_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/buffer/*.h)
source_group("Header Files\\geos\\operation\\buffer" FILES ${geos_operation_buffer_HEADERS})
file(GLOB geos_operation_distance_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/distance/*.h)
source_group("Header Files\\geos\\operation\\distance" FILES ${geos_operation_distance_HEADERS})
file(GLOB geos_operation_linemerge_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/linemerge/*.h)
source_group("Header Files\\geos\\operation\\linemerge" FILES ${geos_operation_linemerge_HEADERS})
file(GLOB geos_operation_overlay_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/overlay/*.h)
source_group("Header Files\\geos\\operation\\overlay" FILES ${geos_operation_overlay_HEADERS})
file(GLOB geos_operation_overlay_snap_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/overlay/snap/*.h)
source_group("Header Files\\geos\\operation\\overlay\\snap" FILES ${geos_operation_overlay_snap_HEADERS})
file(GLOB geos_operation_overlay_validate_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/overlay/validate/*.h)
source_group("Header Files\\geos\\operation\\overlay\\validate" FILES ${geos_operation_overlay_validate_HEADERS})
file(GLOB geos_operation_polygonize_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/polygonize/*.h)
source_group("Header Files\\geos\\operation\\polygonize" FILES ${geos_operation_polygonize_HEADERS})
file(GLOB geos_operation_predicate_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/predicate/*.h)
source_group("Header Files\\geos\\operation\\predicate" FILES ${geos_operation_predicate_HEADERS})
file(GLOB geos_operation_relate_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/relate/*.h)
source_group("Header Files\\geos\\operation\\relate" FILES ${geos_operation_relate_HEADERS})
file(GLOB geos_operation_sharedpaths_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/sharedpaths/*.h)
source_group("Header Files\\geos\\operation\\sharedpaths" FILES ${geos_operation_sharedpaths_HEADERS})
file(GLOB geos_operation_union_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/union/*.h)
source_group("Header Files\\geos\\operation\\union" FILES ${geos_operation_union_HEADERS})
file(GLOB geos_operation_union_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/union/*.h)
source_group("Header Files\\geos\\operation\\union" FILES ${geos_operation_union_HEADERS})
file(GLOB geos_operation_valid_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/operation/valid/*.h)
source_group("Header Files\\geos\\operation\\valid" FILES ${geos_operation_valid_HEADERS})
### geos/planargraph
file(GLOB geos_planargraph_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/planargraph/*.h)
source_group("Header Files\\geos\\planargraph" FILES ${geos_planargraph_HEADERS})
file(GLOB geos_planargraph_algorithm_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/planargraph/algorithm/*.h)
source_group("Header Files\\geos\\planargraph\\algorithm" FILES ${geos_planargraph_algorithm_HEADERS})
### geso/precision
file(GLOB geos_precision_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/precision/*.h)
source_group("Header Files\\geos\\precision" FILES ${geos_precision_HEADERS})
### geso/simplify
file(GLOB geos_simplify_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/simplify/*.h)
source_group("Header Files\\geos\\simplify" FILES ${geos_simplify_HEADERS})
### geso/util
file(GLOB geos_util_HEADERS ${CMAKE_SOURCE_DIR}/include/geos/util/*.h)
source_group("Header Files\\geos\\util" FILES ${geos_util_HEADERS})

GenerateSourceGroups(src)
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
add_subdirectory(unit)
add_subdirectory(xmltester)
add_subdirectory(bigtest)
# TODO: add other test programs


# TODO: add other test programs
5 changes: 5 additions & 0 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ if(GEOS_ENABLE_TESTS)
endif()

message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")

#################################################################################
# Group source files for IDE source explorers (e.g. Visual Studio)
#################################################################################
GenerateSourceGroups(tests/unit)

0 comments on commit ab1cf8a

Please sign in to comment.