<commit_before>project( osgTreeWidget )
cmake_minimum_required(VERSION 3.2)

# Allow all sub CMakeLists to use our custom distributed CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
  "${CMAKE_SOURCE_DIR}/misc/CMake"
  "${CMAKE_SOURCE_DIR}/misc/CMake/compiler"
)

include(findAndInstallDependencies)
include(setBuildMachineUser) #create definitions for whence the executable was built
include(compiler_setup)
include(InstallRequiredSystemLibraries)

# target build locations
set(RUNTIME_DIR bin)
set(PLUGIN_DIR ${RUNTIME_DIR}/plugins)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH    ${CMAKE_BINARY_DIR}/lib)

#set(OSG_DIR "C:/Users/Lee/Documents/src/osg/install340")
if (WIN32)
	set(OSG_DIR "$ENV{USERPROFILE}/sw") 
endif (WIN32)
find_package(OpenSceneGraph 3.0.1 COMPONENTS osg osgDB osgViewer osgGA osgUtil OpenThreads )
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})

#set(ENV{GDAL_DIR} "$ENV{USERPROFILE}/sw")
#find_package(GDAL REQUIRED)
#INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIR})

# Get the Qt stuff set up.
# if cmake cannot find Qt you can set Qt5_DIR or uncomment next line
if (WIN32)
	set(Qt5_DIR "C:/Qt/5.5/msvc2013_64/lib/cmake/Qt5" CACHE PATH "Qt cmake dir")
endif (WIN32)
find_package(Qt5 COMPONENTS Core Gui Widgets OpenGL REQUIRED)

# make all sources part of the build
file(GLOB product_SRCS
  "${CMAKE_CURRENT_LIST_DIR}/*cpp"
  "${CMAKE_CURRENT_LIST_DIR}/*h"
  "${CMAKE_CURRENT_LIST_DIR}/*qrc")

file(GLOB product_UIS "${CMAKE_CURRENT_LIST_DIR}/*ui") # Make all *.ui files part of the build

include_directories(${PROJECT_BINARY_DIR}) # necessary to pick up uic headers
include_directories(
    ${Qt5Core_INCLUDE_DIRS}
    ${Qt5Gui_INCLUDE_DIRS}
    ${Qt5Widgets_INCLUDE_DIRS}
    ${Qt5OpenGL_INCLUDE_DIRS}
    )

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
#set(CMAKE_AUTOUIC ON)
# this makes sure UI files are shown in the IDE
qt5_wrap_ui(UIS ${product_UIS})

if (WIN32)
    add_executable(osgTreeWidget WIN32 ${product_SRCS} ${UIS} )
else (WIN32)
    add_executable(osgTreeWidget       ${product_SRCS} ${UIS} )
endif (WIN32)
install(TARGETS osgTreeWidget
    BUNDLE DESTINATION . COMPONENT Runtime
    RUNTIME DESTINATION bin COMPONENT Runtime )
macro(target_link_windows_libraries EXEC_NAME)
        target_link_libraries(${ARGV})

	# get the list of libraries (without the executable)
	set(LIBLIST "${ARGV}")
	LIST(REMOVE_AT LIBLIST 0)
	
	# gather a list of places for fixup_bundle() to look
	foreach(LIB ${LIBLIST})
		if (NOT "${LIB}" STREQUAL "optimized" AND NOT "${LIB}" STREQUAL "debug")
			if ("${LIB}" MATCHES ".*::.*")
				# these are the Qt::ASDF and we need the location
				get_target_property(LOCATION ${LIB} LOCATION)
			else ()
				set(LOCATION "${LIB}")
			endif()
			get_filename_component(THEDIR "${LOCATION}" DIRECTORY)
			list(APPEND IMPORTANTDIRS "${THEDIR}")
			
			# if the location ends in "lib" chances are there is a "bin" where we might find DLLs
			get_filename_component(DIRNAME ${THEDIR} NAME)
			if ("${DIRNAME}" STREQUAL "lib")
				get_filename_component(DIRNAME ${THEDIR} DIRECTORY)
				list(APPEND IMPORTANTDIRS "${DIRNAME}/bin")
			endif()
		endif()
	endforeach()
	
	list(REMOVE_DUPLICATES IMPORTANTDIRS)

	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}")
	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}/bin")
	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}/lib")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/bin")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/lib")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}")


        string(REPLACE " " "_IwasaSPACE_" YADDA "${IMPORTANTDIRS}" )
        message(STATUS "Important >${YADDA}<")
        add_custom_command(TARGET ${EXEC_NAME} POST_BUILD COMMAND "${CMAKE_COMMAND}"
        -D APP="$<TARGET_FILE:${EXEC_NAME}>"
        -D LIBDIRS="${YADDA}"
        -P "${CMAKE_SOURCE_DIR}/misc/cmake/postBuildFixup.cmake")
endmacro(target_link_windows_libraries EXEC_NAME)

target_link_windows_libraries(osgTreeWidget
    Qt5::Core<commit_msg>trying to write a bundle file for each executable<commit_after>project( osgTreeWidget )
cmake_minimum_required(VERSION 3.2)

# Allow all sub CMakeLists to use our custom distributed CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
  "${CMAKE_SOURCE_DIR}/misc/CMake"
  "${CMAKE_SOURCE_DIR}/misc/CMake/compiler"
)

include(findAndInstallDependencies)
include(setBuildMachineUser) #create definitions for whence the executable was built
include(compiler_setup)
include(InstallRequiredSystemLibraries)

# target build locations
set(RUNTIME_DIR bin)
set(PLUGIN_DIR ${RUNTIME_DIR}/plugins)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH    ${CMAKE_BINARY_DIR}/lib)

#set(OSG_DIR "C:/Users/Lee/Documents/src/osg/install340")
if (WIN32)
	set(OSG_DIR "$ENV{USERPROFILE}/sw") 
endif (WIN32)
find_package(OpenSceneGraph 3.0.1 COMPONENTS osg osgDB osgViewer osgGA osgUtil OpenThreads )
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})

#set(ENV{GDAL_DIR} "$ENV{USERPROFILE}/sw")
#find_package(GDAL REQUIRED)
#INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIR})

# Get the Qt stuff set up.
# if cmake cannot find Qt you can set Qt5_DIR or uncomment next line
if (WIN32)
	set(Qt5_DIR "C:/Qt/5.5/msvc2013_64/lib/cmake/Qt5" CACHE PATH "Qt cmake dir")
endif (WIN32)
find_package(Qt5 COMPONENTS Core Gui Widgets OpenGL REQUIRED)

# make all sources part of the build
file(GLOB product_SRCS
  "${CMAKE_CURRENT_LIST_DIR}/*cpp"
  "${CMAKE_CURRENT_LIST_DIR}/*h"
  "${CMAKE_CURRENT_LIST_DIR}/*qrc")

file(GLOB product_UIS "${CMAKE_CURRENT_LIST_DIR}/*ui") # Make all *.ui files part of the build

include_directories(${PROJECT_BINARY_DIR}) # necessary to pick up uic headers
include_directories(
    ${Qt5Core_INCLUDE_DIRS}
    ${Qt5Gui_INCLUDE_DIRS}
    ${Qt5Widgets_INCLUDE_DIRS}
    ${Qt5OpenGL_INCLUDE_DIRS}
    )

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
#set(CMAKE_AUTOUIC ON)
# this makes sure UI files are shown in the IDE
qt5_wrap_ui(UIS ${product_UIS})

if (WIN32)
    add_executable(osgTreeWidget WIN32 ${product_SRCS} ${UIS} )
else (WIN32)
    add_executable(osgTreeWidget       ${product_SRCS} ${UIS} )
endif (WIN32)
install(TARGETS osgTreeWidget
    BUNDLE DESTINATION . COMPONENT Runtime
    RUNTIME DESTINATION bin COMPONENT Runtime )
macro(target_link_windows_libraries EXEC_NAME)
        target_link_libraries(${ARGV})

	# get the list of libraries (without the executable)
	set(LIBLIST "${ARGV}")
	LIST(REMOVE_AT LIBLIST 0)
	
	# gather a list of places for fixup_bundle() to look
	foreach(LIB ${LIBLIST})
		if (NOT "${LIB}" STREQUAL "optimized" AND NOT "${LIB}" STREQUAL "debug")
			if ("${LIB}" MATCHES ".*::.*")
				# these are the Qt::ASDF and we need the location
				get_target_property(LOCATION ${LIB} LOCATION)
			else ()
				set(LOCATION "${LIB}")
			endif()
			get_filename_component(THEDIR "${LOCATION}" DIRECTORY)
			list(APPEND IMPORTANTDIRS "${THEDIR}")
			
			# if the location ends in "lib" chances are there is a "bin" where we might find DLLs
			get_filename_component(DIRNAME ${THEDIR} NAME)
			if ("${DIRNAME}" STREQUAL "lib")
				get_filename_component(DIRNAME ${THEDIR} DIRECTORY)
				list(APPEND IMPORTANTDIRS "${DIRNAME}/bin")
			endif()
		endif()
	endforeach()
	
	list(REMOVE_DUPLICATES IMPORTANTDIRS)

	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}")
	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}/bin")
	list(APPEND IMPORTANTDIRS "${CMAKE_INSTALL_PREFIX}/lib")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/bin")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/lib")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}")
	list(APPEND IMPORTANTDIRS "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}")

        set(APP $<TARGET_FILE:${EXEC_NAME}>)
message(STATUS "$<TARGET_FILE:${EXEC_NAME}>")
        file(WRITE ${CMAKE_BINARY_DIR}/bin/${EXEC_NAME}_FIXUP.cmake "include(BundleUtilities)\nfixup_bundle(\"${APP}\" \"\" \"${IMPORTANTDIRS}\" )")
        string(REPLACE " " "_IwasaSPACE_" YADDA "${IMPORTANTDIRS}" )
        message(STATUS "Important >${YADDA}<")
        add_custom_command(TARGET ${EXEC_NAME} POST_BUILD COMMAND "${CMAKE_COMMAND}"
        -D APP="${APP}"
        -D LIBDIRS="${YADDA}"
        -P "${CMAKE_SOURCE_DIR}/misc/cmake/postBuildFixup.cmake")
endmacro(target_link_windows_libraries EXEC_NAME)

target_link_windows_libraries(osgTreeWidget
    Qt5::Core
{'fraction_non_alphanumeric': 0.12096586951474345, 'fraction_numerical': 0.009983747387973066, 'mean_word_length': 5.848171701112878, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2917208', 'n_tokens_mistral': 3397, 'n_tokens_neox': 3133, 'n_words': 665}