-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CMake] Modernize CMake integration #281
Conversation
Codecov Report
@@ Coverage Diff @@
## master #281 +/- ##
=========================================
+ Coverage 71.07% 71.17% +0.1%
=========================================
Files 54 54
Lines 9051 9052 +1
=========================================
+ Hits 6433 6443 +10
+ Misses 2618 2609 -9
Continue to review full report at Codecov.
|
OK, looking into it now. Seems to be good. |
lower-case seems to be more common |
How about moving cord-specific part to Cmakefile in cord? |
Sounds reasonable, but it would be good if you could do that as a separate effort to avoid blocking this pull-request. Generally, I would even suggest to deactivate the build of cord by default. My guess is that only a negligible fraction of gc users would be interested in a highly specialized string handling library. |
OK.
For now, I'm not going to deactivate it, though I agree that it is of little usage. Currently it is on primarily for gc testing. |
I will review and merge your patch in 2-3 days |
I've solved the conflicts with |
I will reply to your questions later. What's wrong with https://ci.appveyor.com/project/ivmai/bdwgc/build/job/j1450qvf94bqjary ? |
I'm not too familiar with how testing works, but it looks like the tests are not linking I'll update the |
Issue #281 (bdwgc). * CMakeLists.txt (CMAKE_LEGACY_CYGWIN_WIN32): Remove (do not set). * CMakeLists.txt (VERSION): Change cmake_minimum_required from 2.6 to 3.1.
(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.
I'm continuing review of your 2 patches in this PR. |
…-install-targets
This pull request introduces 11 alerts when merging af50acc into 2b70037 - view on LGTM.com new alerts:
Comment posted by LGTM.com |
I noticed that one of the CI tests fails with the following error:
It is liking to the old binary names
on Windows. |
What does it mean "install tests"? Why do we need an option for it? |
It is ON by default, if it is set to OFF then it skips building the tests. It is useful in vcpkg so that only the library is installed without any other extra binary (like cord for example). |
Review is still in progress. Is it OK if I rename install_test, install_cord to build_test/cord ? |
Issue #281 (bdwgc). * CMakeLists.txt (enable_sigrt_signals): Add option (default to OFF). * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && enable_sigrt_signals]: Define GC_USESIGRT_SIGNALS macro.
Issue #281 (bdwgc). build_cord and build_tests options are introduced in the CMake script. * CMakeLists.txt (build_cord): Add option (on by default); add comment. * CMakeLists.txt (build_tests): Add option (off by default). * CMakeLists.txt (cord): Specify add_subdirectory only if build_cord. * CMakeLists.txt (tests): Specify add_subdirectory only if build_tests. * cord/CMakeLists.txt: Skip cordtest and de tests unless build_tests.
…-install-targets
I mentioned in #275, that if you run
But other than that, this PR works on macOS with that flag |
Issue #281 (bdwgc). Now, "cmake --target install" copies the public header files (to the installation destination) unless -Dinstall_headers=OFF is passed to cmake. * CMakeLists.txt (install_headers): New option (on by default). * CMakeLists.txt [install_headers] (include/gc.h, include/gc_backptr.h, include/gc_config_macros.h, include/gc_gcj.h, include/gc_inline.h, include/gc_mark.h, include/gc_pthread_redirects.h, include/gc_tiny_fl.h, include/gc_typed.h, include/gc_version.h, include/javaxfc.h, include/leak_detector.h): Specify install to "include/gc" folder. * CMakeLists.txt [install_headers && enable_cplusplus] (include/gc_allocator.h, include/gc_cpp.h): Likewise. * CMakeLists.txt [install_headers && enable_disclaim] (include/gc_disclaim.h): Likewise. * CMakeLists.txt [install_headers] (include/extra/gc.h): Specify install to "include" folder. * CMakeLists.txt [install_headers && enable_cplusplus] (include/extra/gc_cpp.h): Likewise.
Issue #281 (bdwgc). * CMakeLists.txt (enable_single_obj_compilation): New option (off by default). * CMakeLists.txt [enable_single_obj_compilation] (SRC): Override value to extra/gc.c. * CMakeLists.txt [enable_single_obj_compilation && CMAKE_USE_PTHREADS_INIT]: Define GC_PTHREAD_START_STANDALONE macro. * CMakeLists.txt [enable_single_obj_compilation && CMAKE_USE_PTHREADS_INIT] (SRC): Append pthread_start.c (in addition to extra/gc.c).
…-install-targets
I have an issue with tests execution when shared library is built (at least on Windows): the tests are created and executed in tests folder while the library is created in base folder, so the tests fail because the library is not found.
Ideal way is 2 but I failed to do it; neither way 3. It could be fixed with way 1 but I'd like to keep tests/CMakeLists.txt. Do you know how to fix it in way 2 or 3? |
Issue #281 (bdwgc). * CMakeLists.txt (enable_cplusplus): Move option to above project command. * CMakeLists.txt [!enable_cplusplus] (project): Specify C as the only project language.
Issue #281 (bdwgc). Now only gc-lib is produced. * CMakeLists.txt (gcmt-dll): Remove add_library command.
Can you use |
Issue #281 (bdwgc). Also specify that libgc.a is used privately in test executables. * CMakeLists.txt (gc-lib): Rename library to gc in add_library and set_target_properties. * cord/CMakeLists.txt [build_tests] (cordtest, de): Rename gc-lib to gc and add PRIVATE in target_link_libraries. * tests/CMakeLists.txt (gctest, hugetest, leaktest, middletest, realloc_test, smashtest): Likewise. * tests/CMakeLists.txt [enable_gc_debug] (tracetest): Likewise. * tests/CMakeLists.txt [enable_disclaim] (disclaim_bench, disclaim_test, disclaim_weakmap_test): Likewise.
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.
Issue #281 (bdwgc). * CMakeLists.txt [enable_cplusplus] (test_cpp): Uncomment add_executable, target_link_libraries, add_test; remove TODO.
Sorry, I haven't had time to look into the issues. |
In progress. I'll finish this week |
Issue #281 (bdwgc). * CMakeLists.txt (BUILD_SHARED_LIBS): Document option and set default to ON. * CMakeLists.txt: Remove commented out ADD_LIBRARY for atomic_ops. * CMakeLists.txt [BUILD_SHARED_LIBS] (SRC): Override to extra/gc.c. * CMakeLists.txt [BUILD_SHARED_LIBS] (GC_DLL): Define macro. * CMakeLists.txt [!BUILD_SHARED_LIBS] (GC_NOT_DLL): Define macro not only for tests but also for gc library. * CMakeLists.txt (gc): Remove STATIC in add_library specification.
Issue #281 (bdwgc). * CMakeLists.txt [build_cord] (CORD_SRC): Set variable. * CMakeLists.txt [build_cord] (cord): Specify add_library and target_link_libraries; remove TODO. * CMakeLists.txt [install_headers && build_cord] (cord/cord.h, cord/cord_pos.h, cord/ec.h): Specify install. * CMakeLists.txt [build_tests && build_cord] (cordtest, de): Do not compile cord/cordbscs.c, cord/cordprnt.c, cord/cordxtra.c; add cord to target_link_libraries specification.
Issue #281 (bdwgc). This matches the behavior of the Automake-based build script. * CMakeLists.txt [enable_cplusplus] (SRC): Do not add gc_cpp.cc. * CMakeLists.txt [enable_cplusplus] (gccpp): Specify add_library and target_link_libraries. * CMakeLists.txt [build_tests && enable_cplusplus] (test_cpp): Add gccpp to target_link_libraries.
Issue #281 (bdwgc). * CMakeLists.txt [build_cord] (cord): Specify install(TARGETS). * CMakeLists.txt (gc): Likewise. * CMakeLists.txt [enable_cplusplus] (gccpp): Likewise.
Why do we need target_include_directories ? I have pushed all the rest of the changes your requested. Please check it. |
Issue #281 (bdwgc). * CMakeLists.txt (enable_werror): New option (OFF by default). * CMakeLists.txt: Specify add_compile_options to report all warnings; add TODO about pedantic. * CMakeLists.txt [enable_werror]: Specify add_compile_options to treat all warnings as errors. * CMakeLists.txt [enable_werror && APPLE]: Specify add_compile_options to ignore deprecated declarations, e.g. _dyld_bind_fully_image_containing_address.
Related PR: microsoft/vcpkg#20580 (update package to v8.2.0) |
Hi @ivmai
I'm a maintainer for vcpkg.
A vcpkg contributor (@NNemec) and I are trying to port
bdwgc
to vcpkg, see: microsoft/vcpkg#6405.While doing so, I've made some changes to the
CMakeLists.txt
file.The goal is to match the output of the CMake build to the files distributed in the Debian package (which, I assume is what most downstream consumers use).
Using vcpkg`s CI, I can confirm that this results in successful builds for:
The existing
CMakeLists.txt
only produced succesful builds for Windows 32- and 64-bit.Both the existing version and the modified version fail to build correctly on Mac OS X, but that's something that can be added in a future PR.
Note: this only produces C++ libraries.