-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
176 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
IndentWidth: '4' | ||
ColumnLimit: '120' | ||
IndentCaseLabels: 'true' | ||
... |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ACTIVATE=/mnt/scratch/kaminski/conda/bin/activate | ||
if [[ -e "${ACTIVATE}" ]]; then | ||
source /mnt/scratch/kaminski/conda/bin/activate clang | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
fail_fast: false | ||
repos: | ||
- repo: https://github.com/pocc/pre-commit-hooks | ||
rev: v1.3.5 | ||
hooks: | ||
- id: clang-format | ||
exclude: _clingodl.c | ||
args: ["-i"] | ||
- id: clang-tidy | ||
exclude: _clingodl.c | ||
args: ["-fix"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,76 @@ | ||
find_library(GPERFTOOLS_PROFILER NAMES profiler) | ||
# Try to find gperftools | ||
# Once done, this will define | ||
# | ||
# Gperftools_FOUND - system has Profiler | ||
# GPERFTOOLS_INCLUDE_DIR - the Profiler include directories | ||
# Tcmalloc_INCLUDE_DIR - where to find Tcmalloc.h | ||
# GPERFTOOLS_TCMALLOC_LIBRARY - link it to use tcmalloc | ||
# GPERFTOOLS_TCMALLOC_MINIMAL_LIBRARY - link it to use tcmalloc_minimal | ||
# GPERFTOOLS_PROFILER_LIBRARY - link it to use Profiler | ||
# TCMALLOC_VERSION_STRING | ||
# TCMALLOC_VERSION_MAJOR | ||
# TCMALLOC_VERSION_MINOR | ||
# TCMALLOC_VERSION_PATCH | ||
|
||
find_path(GPERFTOOLS_INCLUDE NAMES gperftools/profiler.h) | ||
find_path(GPERFTOOLS_INCLUDE_DIR gperftools/profiler.h | ||
HINTS $ENV{GPERF_ROOT}/include) | ||
find_path(Tcmalloc_INCLUDE_DIR gperftools/tcmalloc.h | ||
HINTS $ENV{GPERF_ROOT}/include) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Gperftools DEFAULT_MSG GPERFTOOLS_PROFILER GPERFTOOLS_INCLUDE) | ||
if(Tcmalloc_INCLUDE_DIR AND EXISTS "${Tcmalloc_INCLUDE_DIR}/gperftools/tcmalloc.h") | ||
foreach(ver "MAJOR" "MINOR" "PATCH") | ||
file(STRINGS "${Tcmalloc_INCLUDE_DIR}/gperftools/tcmalloc.h" TC_VER_${ver}_LINE | ||
REGEX "^#define[ \t]+TC_VERSION_${ver}[ \t]+[^ \t]+$") | ||
string(REGEX REPLACE "^#define[ \t]+TC_VERSION_${ver}[ \t]+(\".)?([0-9]*)\"?$" | ||
"\\2" TCMALLOC_VERSION_${ver} "${TC_VER_${ver}_LINE}") | ||
unset(TC_VER_${ver}_LINE) | ||
endforeach() | ||
set(TCMALLOC_VERSION_STRING "${TCMALLOC_VERSION_MAJOR}.${TCMALLOC_VERSION_MINOR}") | ||
if(NOT TCMALLOC_VERSION_PATCH STREQUAL "") | ||
set(TCMALLOC_VERSION_STRING "${TCMALLOC_VERSION_STRING}.${TCMALLOC_VERSION_PATCH}") | ||
endif() | ||
endif() | ||
|
||
foreach(component tcmalloc tcmalloc_minimal profiler) | ||
string(TOUPPER ${component} COMPONENT) | ||
find_library(GPERFTOOLS_${COMPONENT}_LIBRARY ${component} | ||
HINTS $ENV{GPERF_ROOT}/lib) | ||
list(APPEND GPERFTOOLS_LIBRARIES GPERFTOOLS_${COMPONENT}_LIBRARY) | ||
endforeach() | ||
|
||
set(GPERFTOOLS_INCLUDE_DIRS ${GMPXX_INCLUDE}) | ||
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_PROFILER}) | ||
set(_Gperftools_FIND_REQUIRED_VARS "GPERFTOOLS_INCLUDE_DIR") | ||
if(Gperftools_FIND_COMPONENTS) | ||
foreach(component ${Gperftools_FIND_COMPONENTS}) | ||
string(TOUPPER ${component} COMPONENT) | ||
list(APPEND _Gperftools_FIND_REQUIRED_VARS "GPERFTOOLS_${COMPONENT}_LIBRARY") | ||
endforeach() | ||
else() | ||
list(APPEND _Gperftools_FIND_REQUIRED_VARS "GPERFTOOLS_LIBRARIES") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Gperftools | ||
FOUND_VAR Gperftools_FOUND | ||
REQUIRED_VARS ${_Gperftools_FIND_REQUIRED_VARS} | ||
VERSION_VAR TCMALLOC_VERSION_STRING) | ||
|
||
add_library(Gperftools::Gperftools INTERFACE IMPORTED) | ||
set_property(TARGET Gperftools::Gperftools PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIRS}") | ||
set_property(TARGET Gperftools::Gperftools PROPERTY INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_LIBRARIES}") | ||
mark_as_advanced(${GPERFTOOLS_LIBRARIES} GPERFTOOLS_INCLUDE_DIR) | ||
|
||
mark_as_advanced(GPERFTOOLS_PROFILER GPERFTOOLS_INCLUDE GPERFTOOLS_INCLUDE_DIRS GPERFTOOLS_LIBRARIES) | ||
if(Gperftools_FOUND) | ||
foreach(Component Tcmalloc Tcmalloc_minimal Profiler) | ||
if(NOT (TARGET Gperftools::${Component})) | ||
string(TOUPPER ${Component} COMPONENT) | ||
add_library(Gperftools::${Component} UNKNOWN IMPORTED) | ||
set_target_properties(Gperftools::${Component} PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}" | ||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" | ||
IMPORTED_LOCATION "${GPERFTOOLS_${COMPONENT}_LIBRARY}") | ||
endif() | ||
endforeach() | ||
foreach(Component Tcmalloc Tcmalloc_minimal) | ||
if(NOT (TARGET Gperftools::${Component})) | ||
set_target_properties(Gperftools::${Component} PROPERTIES | ||
INTERFACE_COMPILE_OPTIONS "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") | ||
endif() | ||
endforeach() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,61 @@ | ||
try: | ||
from setuptools.sysconfig import get_python_lib, get_config_vars | ||
except ImportError: | ||
from distutils.sysconfig import get_python_lib, get_config_vars | ||
import sys | ||
from argparse import ArgumentParser | ||
|
||
if sys.argv[1] == "prefix": | ||
print(get_python_lib(True, False, sys.argv[2] if len(sys.argv) > 2 else None)) | ||
elif sys.argv[1] == "suffix": | ||
SO, SOABI, EXT_SUFFIX = get_config_vars("SO", "SOABI", "EXT_SUFFIX") | ||
if EXT_SUFFIX is not None: | ||
ext = EXT_SUFFIX | ||
elif SOABI is not None: | ||
ext = ''.join('.', SOABI, SO) | ||
else: | ||
ext = SO | ||
print(ext) | ||
if sys.version_info >= (3, 11): | ||
NEW_STYLE = True | ||
from sysconfig import get_config_var, get_config_vars, get_preferred_scheme, get_path | ||
else: | ||
NEW_STYLE = False | ||
from site import USER_SITE | ||
try: | ||
from setuptools.sysconfig import get_python_lib, get_config_vars | ||
except ImportError: | ||
from distutils.sysconfig import get_python_lib, get_config_vars | ||
|
||
parser = ArgumentParser() | ||
if sys.version_info >= (3, 7): | ||
subparser = parser.add_subparsers(required=True, dest="action") | ||
else: | ||
subparser = parser.add_subparsers(dest="action") | ||
|
||
prefix_parser = subparser.add_parser("target") | ||
prefix_group = prefix_parser.add_mutually_exclusive_group() | ||
prefix_group.add_argument("--user", action='store_true', help='get user prefix') | ||
prefix_group.add_argument("--prefix", type=str, help='prepend prefix') | ||
|
||
prefix_parser = subparser.add_parser("suffix") | ||
|
||
result = parser.parse_args() | ||
|
||
if NEW_STYLE: | ||
if result.action == "target": | ||
if result.user: | ||
scheme = get_preferred_scheme("user") | ||
else: | ||
scheme = get_preferred_scheme("prefix") | ||
if result.prefix is not None: | ||
cvars = get_config_vars() | ||
cvars["base"] = result.prefix | ||
cvars["platbase"] = result.prefix | ||
platlib = get_path("platlib", scheme, cvars) | ||
else: | ||
platlib = get_path("platlib", scheme) | ||
print(platlib) | ||
elif result.action == "suffix": | ||
print(get_config_var('EXT_SUFFIX')) | ||
else: | ||
# TODO: remove once python 3.10 is eol | ||
if result.action == "target": | ||
if result.user: | ||
print(USER_SITE) | ||
else: | ||
print(get_python_lib(True, False, result.prefix)) | ||
elif result.action == "suffix": | ||
SO, SOABI, EXT_SUFFIX = get_config_vars("SO", "SOABI", "EXT_SUFFIX") | ||
if EXT_SUFFIX is not None: | ||
ext = EXT_SUFFIX | ||
elif SOABI is not None: | ||
ext = ''.join('.', SOABI, SO) | ||
else: | ||
ext = SO | ||
print(ext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters