<commit_before># Generate examples.
#
# This is boilerplate code for generating a set of executables, one per
# .cpp file in an "examples" subdirectory. These are intended to
# be installed with the library but we don't handle installation
# here. Unlike the similar boilerplate code in the "tests"
# directory (but like the "tests/adhoc" boilerplate), this does
# not generate CMake ADD_TEST commands so these will never run
# automatically.
#
# For IDEs that can deal with PROJECT_LABEL properties (at least
# Visual Studio) the projects for building each of these adhoc
# executables will be labeled "Example - TheExampleName" if a file
# TheExampleName.cpp is found in this directory.
#
# We check the BUILD_TESTING_{SHARED,STATIC} variables to determine
# whether to build dynamically linked, statically linked, or both
# versions of the executable.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(SimTKExamples)

SET(BUILD_TESTING_SHARED TRUE CACHE BOOL 
		"Build examples using dynamic SimTK libraries.")
SET(BUILD_TESTING_STATIC TRUE CACHE BOOL
		"Build examples using static SimTK libraries.")

SET(SimTK_SHARED_LIBS 
		optimized SimTKsimbody 
		optimized SimTKmath
		optimized SimTKcommon)
SET(SimTK_SHARED_LIBS_D
		debug SimTKsimbody_d 
		debug SimTKmath_d
		debug SimTKcommon_d)

SET(SimTK_STATIC_LIBS 
		optimized SimTKsimbody_static 
		optimized SimTKmath_static
		optimized SimTKcommon_static)
SET(SimTK_STATIC_LIBS_D
		debug SimTKsimbody_static_d 
		debug SimTKmath_static_d
		debug SimTKcommon_static_d)


# Lapack is only available as a shared, optimized library.
SET(SimTK_GENERAL_LIBS SimTKlapack)
IF(WIN32)
	SET(SimTK_GENERAL_LIBS ${SimTK_GENERAL_LIBS} pthreadVC2)
ELSEIF(APPLE)
ELSE() #Linux
	SET(SimTK_GENERAL_LIBS ${SimTK_GENERAL_LIBS} dl rt)
ENDIF()

SET(SimTK $ENV{SimTK_INSTALL_DIR} CACHE PATH
		"Directory where SimTK is installed, e.g. /usr/local/SimTK.")

IF(NOT SimTK)
	MESSAGE(FATAL_ERROR 
			"Expected SimTK_INSTALL_DIR environment var to be set.")
ENDIF(NOT SimTK)

INCLUDE_DIRECTORIES($ENV{SimTK_INSTALL_DIR}/include)
LINK_DIRECTORIES($ENV{SimTK_INSTALL_DIR}/lib)



FILE(GLOB EXAMPLES "*.cpp")
FOREACH(EX_PROG ${EXAMPLES})
    GET_FILENAME_COMPONENT(EX_ROOT ${EX_PROG} NAME_WE)

    IF (BUILD_TESTING_SHARED)
        # Link with shared library
        ADD_EXECUTABLE(${EX_ROOT} ${EX_PROG})
        SET_TARGET_PROPERTIES(${EX_ROOT}
		PROPERTIES
	      PROJECT_LABEL "Example - ${EX_ROOT}")
        TARGET_LINK_LIBRARIES(${EX_ROOT} 
				${SimTK_SHARED_LIBS_D}
				${SimTK_SHARED_LIBS}
				${SimTK_GENERAL_LIBS})
    ENDIF (BUILD_TESTING_SHARED)

    IF (BUILD_TESTING_STATIC)
        # Link with static library
        SET(EX_STATIC ${EX_ROOT}Static)
        ADD_EXECUTABLE(${EX_STATIC} ${EX_PROG})
        SET_TARGET_PROPERTIES(${EX_STATIC}
		PROPERTIES
		COMPILE_FLAGS "-DSimTK_USE_STATIC_LIBRARIES"
		PROJECT_LABEL "Example - ${EX_STATIC}")
        TARGET_LINK_LIBRARIES(${EX_STATIC}
				${SimTK_STATIC_LIBS_D}<commit_msg>Fix example-building CMakeLists.txt to build only 32 bit binaries on Mac; don't build static by default.<commit_after># Generate examples.
#
# This is boilerplate code for generating a set of executables, one per
# .cpp file in an "examples" subdirectory. These are intended to
# be installed with the library but we don't handle installation
# here. Unlike the similar boilerplate code in the "tests"
# directory (but like the "tests/adhoc" boilerplate), this does
# not generate CMake ADD_TEST commands so these will never run
# automatically.
#
# For IDEs that can deal with PROJECT_LABEL properties (at least
# Visual Studio) the projects for building each of these adhoc
# executables will be labeled "Example - TheExampleName" if a file
# TheExampleName.cpp is found in this directory.
#
# We check the BUILD_TESTING_{SHARED,STATIC} variables to determine
# whether to build dynamically linked, statically linked, or both
# versions of the executable.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(SimTKExamples)

SET(BUILD_TESTING_SHARED TRUE CACHE BOOL 
		"Build examples using dynamic SimTK libraries.")
SET(BUILD_TESTING_STATIC FALSE CACHE BOOL
		"Build examples using static SimTK libraries.")

SET(SimTK_SHARED_LIBS 
		optimized SimTKsimbody 
		optimized SimTKmath
		optimized SimTKcommon)
SET(SimTK_SHARED_LIBS_D
		debug SimTKsimbody_d 
		debug SimTKmath_d
		debug SimTKcommon_d)

SET(SimTK_STATIC_LIBS 
		optimized SimTKsimbody_static 
		optimized SimTKmath_static
		optimized SimTKcommon_static)
SET(SimTK_STATIC_LIBS_D
		debug SimTKsimbody_static_d 
		debug SimTKmath_static_d
		debug SimTKcommon_static_d)


# Lapack is only available as a shared, optimized library.
SET(SimTK_GENERAL_LIBS SimTKlapack)
IF(WIN32)
	SET(SimTK_GENERAL_LIBS ${SimTK_GENERAL_LIBS} pthreadVC2)
ELSEIF(APPLE)
ELSE() #Linux
	SET(SimTK_GENERAL_LIBS ${SimTK_GENERAL_LIBS} dl rt)
ENDIF()

SET(SimTK $ENV{SimTK_INSTALL_DIR} CACHE PATH
		"Directory where SimTK is installed, e.g. /usr/local/SimTK.")

IF(NOT SimTK)
	MESSAGE(FATAL_ERROR 
			"Expected SimTK_INSTALL_DIR environment var to be set.")
ENDIF(NOT SimTK)

INCLUDE_DIRECTORIES($ENV{SimTK_INSTALL_DIR}/include)
LINK_DIRECTORIES($ENV{SimTK_INSTALL_DIR}/lib)

# On Mac, build 32 bit binaries.
IF(APPLE)
    SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "The processor architectures to build for" FORCE)
ENDIF(APPLE)

FILE(GLOB EXAMPLES "*.cpp")
FOREACH(EX_PROG ${EXAMPLES})
    GET_FILENAME_COMPONENT(EX_ROOT ${EX_PROG} NAME_WE)

    IF (BUILD_TESTING_SHARED)
        # Link with shared library
        ADD_EXECUTABLE(${EX_ROOT} ${EX_PROG})
        SET_TARGET_PROPERTIES(${EX_ROOT}
		PROPERTIES
	      PROJECT_LABEL "Example - ${EX_ROOT}")
        TARGET_LINK_LIBRARIES(${EX_ROOT} 
				${SimTK_SHARED_LIBS_D}
				${SimTK_SHARED_LIBS}
				${SimTK_GENERAL_LIBS})
    ENDIF (BUILD_TESTING_SHARED)

    IF (BUILD_TESTING_STATIC)
        # Link with static library
        SET(EX_STATIC ${EX_ROOT}Static)
        ADD_EXECUTABLE(${EX_STATIC} ${EX_PROG})
        SET_TARGET_PROPERTIES(${EX_STATIC}
		PROPERTIES
		COMPILE_FLAGS "-DSimTK_USE_STATIC_LIBRARIES"
		PROJECT_LABEL "Example - ${EX_STATIC}")
        TARGET_LINK_LIBRARIES(${EX_STATIC}
				${SimTK_STATIC_LIBS_D}
{'fraction_non_alphanumeric': 0.07561252636702905, 'fraction_numerical': 0.0027583968846341066, 'mean_word_length': 5.013658536585366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6331566', 'n_tokens_mistral': 2379, 'n_tokens_neox': 2111, 'n_words': 559}