Commit 041bfadc authored by atl Upstream's avatar atl Upstream Committed by Eisenhauer, Greg
Browse files

atl 2018-10-25 (a3494837)

Code extracted from:

    https://github.com/GTkorvo/atl.git

at commit a34948373a5d17d95c094ae34a32b7691aee56fd (master).

Upstream Shortlog
-----------------

Chuck Atkins (2):
      c7cb54c2 Add missing header
      7dd994a9 Cleanup package configs for CMake 3.0

Greg Eisenhauer (4):
      b277c94f Add protection to #include of unistd.h
      94637a70 avoid include of sys/param.h if MSC
      593c9b9a Add atexit() handler that deallocates global atom server
      a3494837 make sure we only do one atexit
parent 097e7df9
Loading
Loading
Loading
Loading
+21 −23
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.0)

project(ATL C)
set(ATL_VERSION_MAJOR 2)
set(ATL_VERSION_MINOR 2)
set(ATL_VERSION_PATCH 1)
set(ATL_VERSION
  ${ATL_VERSION_MAJOR}.${ATL_VERSION_MINOR}.${ATL_VERSION_PATCH})
project(ATL VERSION 2.2.1 LANGUAGES C)

# Some boilerplate to setup nice output directories
set(CMAKE_INSTALL_BINDIR bin CACHE STRING "Installation runtime subdirectory")
@@ -95,23 +90,17 @@ mark_as_advanced(ATL_ATOM_SERVER_HOST)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/config.h)

# Set up include-directories
include_directories(
  "${PROJECT_SOURCE_DIR}"   # to find foo/foo.h
  "${PROJECT_BINARY_DIR}")  # to find foo/config.h
 
set(ATL_LIBRARY_PREFIX "" CACHE STRING
  "Prefix to prepend to the output library name")
mark_as_advanced(ATL_LIBRARY_PREFIX)

add_library(atl atom.c attr.c lookup3.c tclHash.c)
add_library(atl::atl ALIAS atl)
set_target_properties(atl PROPERTIES
  OUTPUT_NAME ${ATL_LIBRARY_PREFIX}atl
  VERSION ${ATL_VERSION}
  SOVERSION ${ATL_VERSION_MAJOR}
  PUBLIC_HEADER atl.h)
add_library(atl::atl ALIAS atl)

target_include_directories(atl PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
@@ -174,24 +163,33 @@ if(BUILD_TESTING)
endif()

# Setup packaging and configs
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  "${PROJECT_BINARY_DIR}/atl-config-version.cmake"
  COMPATIBILITY SameMajorVersion)
configure_file(
  atl-config.cmake.in
  "${PROJECT_BINARY_DIR}/atl-config.cmake"
  @ONLY)
 
# Add all targets to the build-tree export set
export(TARGETS atl NAMESPACE atl::
  FILE "${PROJECT_BINARY_DIR}/atl-targets.cmake")
configure_file(atl-config.cmake.in
  "${PROJECT_BINARY_DIR}/atl-config.cmake" @ONLY)
configure_file(atl-config-version.cmake.in
  "${PROJECT_BINARY_DIR}/atl-config-version.cmake" @ONLY)
 
# Install the atl-config.cmake and atl-config-version.cmake
install(FILES
install(
  FILES
    "${PROJECT_BINARY_DIR}/atl-config.cmake"
    "${PROJECT_BINARY_DIR}/atl-config-version.cmake"
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
  COMPONENT dev)
 
# Install the export set for use with the install-tree
install(EXPORT atl-targets NAMESPACE atl::
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT dev)
install(
  EXPORT atl-targets
  NAMESPACE atl::
  DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
  COMPONENT dev)

set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/atl.supp)

atl-config-version.cmake.in

deleted100644 → 0
+0 −15
Original line number Diff line number Diff line
set(PACKAGE_VERSION_MAJOR @ATL_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @ATL_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @ATL_VERSION_PATCH@)
set(PACKAGE_VERSION @ATL_VERSION@)

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
   PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
  if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
    set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()
+1 −13
Original line number Diff line number Diff line
# - Config file for the Atl package
#
# It defines the following variables
#  ATL_INCLUDE_DIRS - include directories for Atl
#  ATL_LIBRARIES    - libraries to link against
#
# And the following imported targets:
#   atl::atl
#

include("${CMAKE_CURRENT_LIST_DIR}/atl-config-version.cmake")

include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)

if(NOT TARGET atl::atl)
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ extern
atom_server
init_atom_server (atom_cache_type cache_style);

extern void
free_atom_server(atom_server as);

extern
char *
get_server_id (atom_server as);
+20 −0
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@
#    include <malloc.h>
#  endif
#  include <stdio.h>
#ifdef HAVE_UNISTD_H
#  include <unistd.h>
#endif
#  include <errno.h>
#  include <sys/types.h>
#  ifndef HAVE_WINDOWS_H
@@ -573,6 +575,24 @@ preload_in_use_atoms(atom_server as)
	(void) atom_from_string(as, in_use_values[i++]);
    }
}

void
free_atom_server(atom_server as)
{
  Tcl_HashSearch search;
  Tcl_HashEntry * entry = Tcl_FirstHashEntry(&as->string_hash_table, &search);
  while (entry) {
    send_get_atom_msg_ptr stored;
    stored = Tcl_GetHashValue(entry);
    free(stored->atom_string);
    free(stored);
    entry = Tcl_NextHashEntry(&search);
  }
  Tcl_DeleteHashTable(&as->string_hash_table);
  Tcl_DeleteHashTable(&as->value_hash_table);
  free(as);
}

atom_server
init_atom_server(cache_style)
atom_cache_type cache_style;
Loading