[geos-commits] r4036 - in trunk: . cmake/modules include src tests tests/unit

svn_geos at osgeo.org svn_geos at osgeo.org
Wed Nov 26 06:58:36 PST 2014


Author: mloskot
Date: 2014-11-26 06:58:35 -0800 (Wed, 26 Nov 2014)
New Revision: 4036

Added:
   trunk/cmake/modules/GenerateSourceGroups.cmake
Modified:
   trunk/CMakeLists.txt
   trunk/include/CMakeLists.txt
   trunk/src/CMakeLists.txt
   trunk/tests/CMakeLists.txt
   trunk/tests/unit/CMakeLists.txt
Log:
Add GenerateSourceGroups macro.
Attempt to generate source_group for IDEs reflecting folders structure.
No functional changes to build configuration included.

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2014-11-12 16:42:32 UTC (rev 4035)
+++ trunk/CMakeLists.txt	2014-11-26 14:58:35 UTC (rev 4036)
@@ -323,6 +323,7 @@
 #################################################################################
 # Configure subdirectories
 #################################################################################
+include(GenerateSourceGroups)
 
 add_subdirectory(include)
 add_subdirectory(src)

Added: trunk/cmake/modules/GenerateSourceGroups.cmake
===================================================================
--- trunk/cmake/modules/GenerateSourceGroups.cmake	                        (rev 0)
+++ trunk/cmake/modules/GenerateSourceGroups.cmake	2014-11-26 14:58:35 UTC (rev 4036)
@@ -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()
\ No newline at end of file

Modified: trunk/include/CMakeLists.txt
===================================================================
--- trunk/include/CMakeLists.txt	2014-11-12 16:42:32 UTC (rev 4035)
+++ trunk/include/CMakeLists.txt	2014-11-26 14:58:35 UTC (rev 4036)
@@ -50,3 +50,8 @@
   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)

Modified: trunk/src/CMakeLists.txt
===================================================================
--- trunk/src/CMakeLists.txt	2014-11-12 16:42:32 UTC (rev 4035)
+++ trunk/src/CMakeLists.txt	2014-11-26 14:58:35 UTC (rev 4036)
@@ -99,97 +99,4 @@
 #################################################################################
 # 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)

Modified: trunk/tests/CMakeLists.txt
===================================================================
--- trunk/tests/CMakeLists.txt	2014-11-12 16:42:32 UTC (rev 4035)
+++ trunk/tests/CMakeLists.txt	2014-11-26 14:58:35 UTC (rev 4036)
@@ -14,5 +14,6 @@
 add_subdirectory(unit)
 add_subdirectory(xmltester)
 add_subdirectory(bigtest)
+# TODO: add other test programs
 
-# TODO: add other test programs
\ No newline at end of file
+

Modified: trunk/tests/unit/CMakeLists.txt
===================================================================
--- trunk/tests/unit/CMakeLists.txt	2014-11-12 16:42:32 UTC (rev 4035)
+++ trunk/tests/unit/CMakeLists.txt	2014-11-26 14:58:35 UTC (rev 4036)
@@ -34,3 +34,8 @@
 endif()
 
 message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")
+
+#################################################################################
+# Group source files for IDE source explorers (e.g. Visual Studio)
+#################################################################################
+GenerateSourceGroups(tests/unit)
\ No newline at end of file



More information about the geos-commits mailing list