<commit_before>#
# Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
# Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
# Copyright (c) 1998 by <NAME>.  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.
##

#
#  get cmake and run:
#    cmake -G "Visual Studio 8 2005"
#  in the same dir as this file
#  this will generate gc.sln
#

SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

PROJECT(gc)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE
                 -DALL_INTERIOR_POINTERS")

IF(APPLE)
    SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE)
ENDIF(APPLE)

#LIBATOMIC #TODO
#ADD_LIBRARY(atomic_ops STATIC )
#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING)


#LIBGC

INCLUDE_DIRECTORIES(include)
INCLUDE_DIRECTORIES(libatomic_ops/src)

SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c
        mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c
        new_hblk.c dbg_mlc.c malloc.c stubborn.c dyn_load.c
        typd_mlc.c ptr_chck.c gc_cpp.cc mallocx.c checksums.c
        thread_local_alloc.c)
SET(LIBS)
OPTION(enable_threads "TODO" NO)
IF(enable_threads)
        FIND_PACKAGE(Threads REQUIRED)
        MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" )
        INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR})
        SET(LIBS ${LIBS} ${Threads_LIBRARIES})
ENDIF(enable_threads)

OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO)

#IF(Threads_FOUND)
#       ADD_DEFINITIONS("")
#ELSE
#       MESSAGE("Parallel mark requires enable_threads ON" )
#ENDIF(Threads_FOUND)

IF(enable_parallel_mark)
ENDIF(enable_parallel_mark)

OPTION(enable_cplusplus "install C++ support" NO)

SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field.Use lowercase

STRING(TOLOWER ${_HOST} HOST)
MESSAGE("HOST = ${HOST}")

#Thread Detection. Relying on cmake for lib an includes.
#TODO check cmake detection
IF(CMAKE_USE_PTHREADS_INIT)
        SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c)
        IF( "HOST" MATCHES x86-.*-linux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86_64-.*-linux.*|alpha-.*-linux.*|sparc.*-.*-linux.*)
                ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
                MESSAGE("Explicit GC_INIT() calls may be required.")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-linux.*)
                ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-aix.*)
                ADD_DEFINITIONS("-DGC_AIX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-hpux11.*)
                MESSAGE("Only HP/UX 11 POSIX threads are supported.")
                ADD_DEFINITIONS("-DGC_HPUX_THREADS")
                ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                MESSAGE("Explicit GC_INIT() calls may be required.")
                ADD_DEFINITIONS("-D_REENTRANT") #TODO
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-hpux10.*)
                MESSAGE("Only HP/UX 11 POSIX threads are supported.")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-openbsd.*)
                ADD_DEFINITIONS("-DGC_OPENBSD_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-freebsd.*)
                MESSAGE("FreeBSD does not yet fully support threads with Boehm GC.")
                ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-kfreebsd.*-gnu)
                ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                ADD_DEFINITIONS(THREAD_LOCAL_ALLOC")
                ADD_DEFINITIONS(USE_COMPILER_TLS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-gnu.*)
                ADD_DEFINITIONS("-DGC_GNU_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-netbsd.*)
                MESSAGE("Only on NetBSD 2.0 or later.")
                ADD_DEFINITIONS("-DGC_NETBSD_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                ADD_DEFINITIONS("-D_PTHREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-solaris.*)
                ADD_DEFINITIONS("-DGC_SOLARIS_THREADS")
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
#TODO
#       if test "$GCC" != yes; then
#          CFLAGS="$CFLAGS -O"
#          need_atomic_ops_asm=true
#        fi

        ENDIF()
        IF ( "HOST" MATCHES .*-.*-irix.*)
                ADD_DEFINITIONS("-DGC_IRIX_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-cygwin.*)
                ADD_DEFINITIONS("-DGC_THREADS")
                IF (${enable_parallel_mark})<commit_msg>Fix bwd-gc CMakeLists.txt<commit_after>#
# Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
# Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
# Copyright (c) 1998 by <NAME>.  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.
##

#
#  get cmake and run:
#    cmake -G "Visual Studio 8 2005"
#  in the same dir as this file
#  this will generate gc.sln
#

SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

PROJECT(gc)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE
                 -DALL_INTERIOR_POINTERS")

IF(APPLE)
    SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE)
ENDIF(APPLE)

#LIBATOMIC #TODO
#ADD_LIBRARY(atomic_ops STATIC )
#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING)


#LIBGC

INCLUDE_DIRECTORIES(include)
INCLUDE_DIRECTORIES(libatomic_ops/src)

SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c
        mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c
        new_hblk.c dbg_mlc.c malloc.c stubborn.c dyn_load.c
        typd_mlc.c ptr_chck.c gc_cpp.cc mallocx.c checksums.c
        thread_local_alloc.c)
SET(LIBS)
OPTION(enable_threads "TODO" NO)
IF(enable_threads)
        FIND_PACKAGE(Threads REQUIRED)
        MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" )
        INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR})
        SET(LIBS ${LIBS} ${Threads_LIBRARIES})
ENDIF(enable_threads)

OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO)

#IF(Threads_FOUND)
#       ADD_DEFINITIONS("")
#ELSE
#       MESSAGE("Parallel mark requires enable_threads ON" )
#ENDIF(Threads_FOUND)

IF(enable_parallel_mark)
ENDIF(enable_parallel_mark)

OPTION(enable_cplusplus "install C++ support" NO)

SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field.Use lowercase

STRING(TOLOWER ${_HOST} HOST)
MESSAGE("HOST = ${HOST}")

#Thread Detection. Relying on cmake for lib an includes.
#TODO check cmake detection
IF(CMAKE_USE_PTHREADS_INIT)
        SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c)
        IF( "HOST" MATCHES x86-.*-linux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86_64-.*-linux.*|alpha-.*-linux.*|sparc.*-.*-linux.*)
                ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
                MESSAGE("Explicit GC_INIT() calls may be required.")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-linux.*)
                ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-aix.*)
                ADD_DEFINITIONS("-DGC_AIX_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-hpux11.*)
                MESSAGE("Only HP/UX 11 POSIX threads are supported.")
                ADD_DEFINITIONS("-DGC_HPUX_THREADS")
                ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                MESSAGE("Explicit GC_INIT() calls may be required.")
                ADD_DEFINITIONS("-D_REENTRANT") #TODO
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-hpux10.*)
                MESSAGE("Only HP/UX 11 POSIX threads are supported.")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-openbsd.*)
                ADD_DEFINITIONS("-DGC_OPENBSD_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-freebsd.*)
                MESSAGE("FreeBSD does not yet fully support threads with Boehm GC.")
                ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-kfreebsd.*-gnu)
                ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                IF (${enable_parallel_mark})
                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                ENDIF()
                ADD_DEFINITIONS("THREAD_LOCAL_ALLOC")
                ADD_DEFINITIONS("USE_COMPILER_TLS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-gnu.*)
                ADD_DEFINITIONS("-DGC_GNU_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-netbsd.*)
                MESSAGE("Only on NetBSD 2.0 or later.")
                ADD_DEFINITIONS("-DGC_NETBSD_THREADS")
                ADD_DEFINITIONS("-D_REENTRANT")
                ADD_DEFINITIONS("-D_PTHREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-solaris.*)
                ADD_DEFINITIONS("-DGC_SOLARIS_THREADS")
                ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
#TODO
#       if test "$GCC" != yes; then
#          CFLAGS="$CFLAGS -O"
#          need_atomic_ops_asm=true
#        fi

        ENDIF()
        IF ( "HOST" MATCHES .*-.*-irix.*)
                ADD_DEFINITIONS("-DGC_IRIX_THREADS")
        ENDIF()
        IF ( "HOST" MATCHES .*-.*-cygwin.*)
                ADD_DEFINITIONS("-DGC_THREADS")
                IF (${enable_parallel_mark})
{'fraction_non_alphanumeric': 0.11516476126429052, 'fraction_numerical': 0.011768661735036988, 'mean_word_length': 2.4574251671025866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6942936', 'n_tokens_mistral': 4393, 'n_tokens_neox': 3973, 'n_words': 857}