Move test executable files produced by CMake to the base folder
authorIvan Maidanski <ivmai@mail.ru>
Sat, 15 Jun 2019 12:30:32 +0000 (15:30 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 15 Jun 2019 12:30:32 +0000 (15:30 +0300)
Issue #281 (bdwgc).

This is done by moving the content of cord/CMakeLists.txt and
tests/CMakeLists.txt files to the base CMakeLists.txt.

* CMakeLists.txt [build_tests && build_cord]: Move content from
cord/CMakeLists.txt.
* CMakeLists.txt [build_tests && build_cord] (cordtest, de): Add
"cord/" to .c files in add_executable.
* CMakeLists.txt [build_tests]: Move content from tests/CMakeLists.txt.
* CMakeLists.txt [build_tests] (gctest, hugetest, leaktest, middletest,
realloc_test, smashtest, tracetest, test_cpp, disclaim_bench,
disclaim_test, disclaim_weakmap_test, disclaim_weakmap_test): Add
"tests/" to .c and .cc files in add_executable.
* Makefile.am (EXTRA_DIST): Remove cord/CMakeLists.txt,
tests/CMakeLists.txt.
* doc/README.cmake: Update info about CMakeLists.txt files (there is
just one file now).
* cord/CMakeLists.txt: Remove file.
* tests/CMakeLists.txt: Likewise.

CMakeLists.txt
Makefile.am
cord/CMakeLists.txt [deleted file]
doc/README.cmake
tests/CMakeLists.txt [deleted file]

index 6e4b10a..d272b24 100644 (file)
@@ -264,9 +264,7 @@ set_target_properties(gc PROPERTIES
                       COMPILE_DEFINITIONS GC_NOT_DLL)
 #TODO TARGET_LINK_LIBRARIES(...  ...  ${LIBS})
 
-if (build_cord)
-  add_subdirectory(cord)
-endif()
+# TODO if build_cord then add_library(cord ...)
 
 if (install_headers)
   install(FILES include/gc.h
@@ -296,5 +294,75 @@ if (install_headers)
 endif()
 
 if (build_tests)
-  add_subdirectory(tests)
-endif()
+  add_definitions("-DGC_NOT_DLL")
+
+  if (build_cord)
+    add_executable(cordtest cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c
+                   cord/tests/cordtest.c)
+    target_link_libraries(cordtest PRIVATE gc)
+    add_test(NAME cordtest COMMAND cordtest)
+
+    if (WIN32)
+      add_executable(de cord/cordbscs.c cord/cordxtra.c
+                     cord/tests/de.c cord/tests/de_win.c)
+      set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE)
+      target_link_libraries(de PRIVATE gc gdi32)
+    endif()
+  endif(build_cord)
+
+  # Compile some tests as C++ to test extern "C" in header files.
+  if (enable_cplusplus)
+    set_source_files_properties(tests/leak_test.c tests/test.c
+                                PROPERTIES LANGUAGE CXX)
+  endif()
+
+  add_executable(gctest WIN32 tests/test.c)
+  target_link_libraries(gctest PRIVATE gc)
+  add_test(NAME gctest COMMAND gctest)
+
+  add_executable(hugetest tests/huge_test.c)
+  target_link_libraries(hugetest PRIVATE gc)
+  add_test(NAME hugetest COMMAND hugetest)
+
+  add_executable(leaktest tests/leak_test.c)
+  target_link_libraries(leaktest PRIVATE gc)
+  add_test(NAME leaktest COMMAND leaktest)
+
+  add_executable(middletest tests/middle.c)
+  target_link_libraries(middletest PRIVATE gc)
+  add_test(NAME middletest COMMAND middletest)
+
+  add_executable(realloc_test tests/realloc_test.c)
+  target_link_libraries(realloc_test PRIVATE gc)
+  add_test(NAME realloc_test COMMAND realloc_test)
+
+  add_executable(smashtest tests/smash_test.c)
+  target_link_libraries(smashtest PRIVATE gc)
+  add_test(NAME smashtest COMMAND smashtest)
+
+  if (enable_gc_debug)
+    add_executable(tracetest tests/trace_test.c)
+    target_link_libraries(tracetest PRIVATE gc)
+    add_test(NAME tracetest COMMAND tracetest)
+  endif()
+
+  if (enable_cplusplus)
+    # TODO add_executable(test_cpp tests/test_cpp.cc)
+    # target_link_libraries(test_cpp PRIVATE gc)
+    # add_test(NAME test_cpp COMMAND test_cpp)
+  endif()
+
+  if (enable_disclaim)
+    add_executable(disclaim_bench tests/disclaim_bench.c)
+    target_link_libraries(disclaim_bench PRIVATE gc)
+    add_test(NAME disclaim_bench COMMAND disclaim_bench)
+
+    add_executable(disclaim_test tests/disclaim_test.c)
+    target_link_libraries(disclaim_test PRIVATE gc)
+    add_test(NAME disclaim_test COMMAND disclaim_test)
+
+    add_executable(disclaim_weakmap_test tests/disclaim_weakmap_test.c)
+    target_link_libraries(disclaim_weakmap_test PRIVATE gc)
+    add_test(NAME disclaim_weakmap_test COMMAND disclaim_weakmap_test)
+  endif()
+endif(build_tests)
index 5de2657..fc77933 100644 (file)
@@ -198,8 +198,7 @@ EXTRA_DIST += README.QUICK
 # :GOTCHA: deliberately we do not include 'Makefile'
 EXTRA_DIST += BCC_MAKEFILE NT_MAKEFILE \
     OS2_MAKEFILE PCR-Makefile digimars.mak \
-    Makefile.direct SMakefile.amiga WCC_MAKEFILE autogen.sh \
-    CMakeLists.txt cord/CMakeLists.txt tests/CMakeLists.txt
+    Makefile.direct SMakefile.amiga WCC_MAKEFILE autogen.sh CMakeLists.txt
 
 # files used by makefiles other than Makefile.am
 #
diff --git a/cord/CMakeLists.txt b/cord/CMakeLists.txt
deleted file mode 100644 (file)
index 50290c9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2000-2010 by Hewlett-Packard Company.  All rights reserved.
-##
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-##
-# Permission is hereby granted to use or copy this program
-# for any purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is granted,
-# provided the above notices are retained, and a notice that the code was
-# modified is included with the above copyright notice.
-##
-
-# TODO add_library(cord ...)
-
-if (build_tests)
-  add_executable(cordtest cordbscs.c cordprnt.c cordxtra.c
-                 tests/cordtest.c)
-  set_target_properties(cordtest PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL)
-  target_link_libraries(cordtest PRIVATE gc)
-  add_test(NAME cordtest COMMAND cordtest)
-
-  if (WIN32)
-    add_executable(de cordbscs.c cordxtra.c
-                   tests/de.c tests/de_win.c)
-    set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE)
-    set_target_properties(de PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL)
-    target_link_libraries(de PRIVATE gc gdi32)
-  endif(WIN32)
-endif()
index 4c5894b..527ccda 100644 (file)
@@ -46,5 +46,5 @@ BUILD PROCESS
 INPUT
 -----
 
-The main input to cmake are the CMakeLists.txt files in each directory.  For
+The main input to cmake is CMakeLists.txt file in the GC root directory.  For
 help, go to cmake.org.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
deleted file mode 100644 (file)
index 33bc370..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
-# Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
-# Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
-# Copyright (c) 2000-2010 by Hewlett-Packard Company.  All rights reserved.
-##
-# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-# OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
-##
-# Permission is hereby granted to use or copy this program
-# for any purpose,  provided the above notices are retained on all copies.
-# Permission to modify the code and to distribute modified code is granted,
-# provided the above notices are retained, and a notice that the code was
-# modified is included with the above copyright notice.
-##
-
-add_definitions("-DGC_NOT_DLL")
-
-# Compile some tests as C++ to test extern "C" in header files.
-if (enable_cplusplus)
-  set_source_files_properties(leak_test.c test.c
-                              PROPERTIES LANGUAGE CXX)
-endif()
-
-add_executable(gctest WIN32 test.c)
-target_link_libraries(gctest PRIVATE gc)
-add_test(NAME gctest COMMAND gctest)
-
-add_executable(hugetest huge_test.c)
-target_link_libraries(hugetest PRIVATE gc)
-add_test(NAME hugetest COMMAND hugetest)
-
-add_executable(leaktest leak_test.c)
-target_link_libraries(leaktest PRIVATE gc)
-add_test(NAME leaktest COMMAND leaktest)
-
-add_executable(middletest middle.c)
-target_link_libraries(middletest PRIVATE gc)
-add_test(NAME middletest COMMAND middletest)
-
-add_executable(realloc_test realloc_test.c)
-target_link_libraries(realloc_test PRIVATE gc)
-add_test(NAME realloc_test COMMAND realloc_test)
-
-add_executable(smashtest smash_test.c)
-target_link_libraries(smashtest PRIVATE gc)
-add_test(NAME smashtest COMMAND smashtest)
-
-if (enable_gc_debug)
-  add_executable(tracetest trace_test.c)
-  target_link_libraries(tracetest PRIVATE gc)
-  add_test(NAME tracetest COMMAND tracetest)
-endif()
-
-if (enable_cplusplus)
-  # TODO add_executable(test_cpp test_cpp.cc)
-  # target_link_libraries(test_cpp PRIVATE gc)
-  # add_test(NAME test_cpp COMMAND test_cpp)
-endif()
-
-if (enable_disclaim)
-  add_executable(disclaim_bench disclaim_bench.c)
-  target_link_libraries(disclaim_bench PRIVATE gc)
-  add_test(NAME disclaim_bench COMMAND disclaim_bench)
-
-  add_executable(disclaim_test disclaim_test.c)
-  target_link_libraries(disclaim_test PRIVATE gc)
-  add_test(NAME disclaim_test COMMAND disclaim_test)
-
-  add_executable(disclaim_weakmap_test disclaim_weakmap_test.c)
-  target_link_libraries(disclaim_weakmap_test PRIVATE gc)
-  add_test(NAME disclaim_weakmap_test COMMAND disclaim_weakmap_test)
-endif()