Group all options near the top of CMake script
authorVictor Romero <romerosanchezv@gmail.com>
Thu, 30 May 2019 22:05:25 +0000 (01:05 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 30 May 2019 22:06:39 +0000 (01:06 +0300)
(code refactoring)

Issue #281 (bdwgc).

* CMakeLists.txt (option): Group all items together close to the
beginning of the file; reorder items to match that of configure.

CMakeLists.txt

index 6b6c58d..4c78b6a 100644 (file)
@@ -27,6 +27,26 @@ include(CTest)
 
 cmake_minimum_required(VERSION 3.1)
 
+option(enable_threads "TODO" OFF) #TODO Support it
+option(enable_parallel_mark "Parallelize marking and free list construction" ON)
+option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON)
+option(enable_threads_discovery "Enable threads discovery in GC" ON)
+#TODO Support OPTION(enable_cplusplus "install C++ support" OFF)
+option(enable_gcj_support "Support for gcj" ON)
+option(enable_gc_debug "Support for pointer back-tracing" OFF)
+option(enable_java_finalization "Support for java finalization" ON)
+option(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON)
+option(enable_redirect_malloc "Redirect malloc and friends to GC routines" OFF)
+option(enable_disclaim "Support alternative finalization interface" ON)
+option(enable_large_config "Optimize for large heap or root set" OFF)
+option(enable_gc_assertions "Enable collector-internal assertion checking" OFF)
+option(enable_mmap "Use mmap instead of sbrk to expand the heap" OFF)
+option(enable_munmap "Return page to the OS if empty for N collections" ON)
+option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON)
+option(enable_register_main_static_data "Perform the initial guess of data root sets" ON)
+option(enable_checksums "Report erroneously cleared dirty bits" OFF)
+option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
+
 add_definitions("-D_CRT_SECURE_NO_DEPRECATE")
 add_definitions("-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION")
 
@@ -53,7 +73,6 @@ set(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c
         mallocx.c)
 set(LIBS)
 
-option(enable_threads "TODO" OFF)
 if (enable_threads)
   find_package(Threads REQUIRED)
   message("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" )
@@ -61,17 +80,12 @@ if (enable_threads)
   set(LIBS ${LIBS} ${Threads_LIBRARIES})
 endif()
 
-option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
-option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON)
-option(enable_parallel_mark "Parallelize marking and free list construction" ON)
-
 #IF(Threads_FOUND)
 #       ADD_DEFINITIONS("")
 #ELSE
 #       MESSAGE("Parallel mark requires enable_threads ON" )
 #ENDIF(Threads_FOUND)
 
-#OPTION(enable_cplusplus "install C++ support" ON)
 set(SRC ${SRC} gc_cpp.cc)
 
 set(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM})
@@ -142,7 +156,6 @@ if (CMAKE_USE_WIN32_THREADS_INIT)
   set(SRC ${SRC} win32_threads.c)
 endif(CMAKE_USE_WIN32_THREADS_INIT)
 
-option(enable_gcj_support "Support for gcj" ON)
 if (enable_gcj_support)
   add_definitions("-DGC_GCJ_SUPPORT")
   if (enable_threads)
@@ -151,23 +164,19 @@ if (enable_gcj_support)
   set(SRC ${SRC} gcj_mlc.c)
 endif(enable_gcj_support)
 
-option(enable_disclaim "Support alternative finalization interface" ON)
 if (enable_disclaim)
   add_definitions("-DENABLE_DISCLAIM")
   set(SRC ${SRC} fnlz_mlc.c)
 endif()
 
-option(enable_java_finalization "Support for java finalization" ON)
 if (enable_java_finalization)
   add_definitions("-DJAVA_FINALIZATION")
 endif()
 
-option(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON)
 if (enable_atomic_uncollectable)
   add_definitions("-DGC_ATOMIC_UNCOLLECTABLE")
 endif()
 
-option(enable_gc_debug "Support for pointer back-tracing" OFF)
 if (enable_gc_debug)
   add_definitions("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS")
   if (HOST MATCHES ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*)
@@ -181,7 +190,6 @@ if (enable_gc_debug)
   endif()
 endif(enable_gc_debug)
 
-option(enable_redirect_malloc "Redirect malloc and friends to GC routines" OFF)
 if (enable_redirect_malloc)
   if (enable_gc_debug)
     add_definitions("-DREDIRECT_MALLOC=GC_debug_malloc_replacement")
@@ -193,41 +201,32 @@ if (enable_redirect_malloc)
   add_definitions("-DGC_USE_DLOPEN_WRAP")
 endif(enable_redirect_malloc)
 
-option(enable_mmap "Use mmap instead of sbrk to expand the heap" OFF)
-
-option(enable_munmap "Return page to the OS if empty for N collections" ON)
 if (enable_munmap)
   add_definitions("-DUSE_MMAP -DUSE_MUNMAP")
 elseif (enable_mmap)
   add_definitions("-DUSE_MMAP")
 endif()
 
-option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON)
 if (NOT enable_dynamic_loading)
   add_definitions("-DIGNORE_DYNAMIC_LOADING")
 endif()
 
-option(enable_register_main_static_data "Perform the initial guess of data root sets" ON)
 if (NOT enable_register_main_static_data)
   add_definitions("-DGC_DONT_REGISTER_MAIN_STATIC_DATA")
 endif()
 
-option(enable_large_config "Optimize for large heap or root set" OFF)
 if (enable_large_config)
   add_definitions("-DLARGE_CONFIG")
 endif()
 
-option(enable_gc_assertions "Enable collector-internal assertion checking" OFF)
 if (enable_gc_assertions)
   add_definitions("-DGC_ASSERTIONS")
 endif()
 
-option(enable_threads_discovery "Enable threads discovery in GC" ON)
 if (NOT enable_threads_discovery)
   add_definitions("-DGC_NO_THREADS_DISCOVERY")
 endif()
 
-option(enable_checksums "Report erroneously cleared dirty bits" OFF)
 if (enable_checksums)
   if (enable_munmap OR enable_threads)
     message("CHECKSUMS not compatible with USE_MUNMAP or threads")