Skip to content

Commit

Permalink
Merge pull request #3 from Thoemi09/DEV_CMAKE
Browse files Browse the repository at this point in the history
Use GNUInstallDirs more consistently + minor fix for clang-19
  • Loading branch information
Wentzell authored Oct 22, 2024
2 parents ff2af3e + 0da7c45 commit 5a789ba
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions share/clair.modulefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ setenv CPP2PY_ROOT $root
setenv CPP2PY_VERSION $version
setenv CPP2PY_GIT_HASH $git_hash

prepend-path PATH $root/bin
prepend-path CPLUS_INCLUDE_PATH $root/include
prepend-path LIBRARY_PATH $root/lib
prepend-path PATH @CMAKE_INSTALL_FULL_BINDIR@
prepend-path CPLUS_INCLUDE_PATH @CMAKE_INSTALL_FULL_INCLUDEDIR@
prepend-path LIBRARY_PATH @CMAKE_INSTALL_FULL_LIBDIR@
prepend-path PYTHONPATH $root/@PYTHON_LIB_DEST_ROOT@
prepend-path CMAKE_PREFIX_PATH $root/lib/cmake/cpp2py
prepend-path CMAKE_PREFIX_PATH @CMAKE_INSTALL_FULL_LIBDIR@/cmake/clair
6 changes: 3 additions & 3 deletions share/clairvars.sh.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Source this in your environment.

export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_FULL_INCLUDEDIR@:$CPLUS_INCLUDE_PATH
export PATH=@CMAKE_INSTALL_FULL_BINDIR@:$PATH
export LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$LIBRARY_PATH
export LD_LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$DYLD_LIBRARY_PATH
export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@PYTHON_LIB_DEST_ROOT@:$PYTHONPATH
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@:$CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_FULL_LIBDIR@/cmake/clair:$CMAKE_PREFIX_PATH
2 changes: 1 addition & 1 deletion share/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clair
)

install(EXPORT clair-targets NAMESPACE c2py:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clair)
install(EXPORT clair-targets NAMESPACE clair:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/clair)
7 changes: 2 additions & 5 deletions share/cmake/clair-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CLAIR_LLVM_VERSION @CMAKE_CXX_COMPILER_VERSION@)
set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root directory")

# Include the exported targets of this project
include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake)
include(@CMAKE_INSTALL_FULL_LIBDIR@/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake)

if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "@CMAKE_CXX_COMPILER_ID@")
MESSAGE(FATAL_ERROR "Clair plugins are only usable with clang")
Expand All @@ -26,11 +26,8 @@ message(STATUS "Found @[email protected] with version @PROJECT_VERSION@

# Mac specific
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_NAME_DIR "@CMAKE_INSTALL_PREFIX@/lib")
set(CMAKE_INSTALL_NAME_DIR "@CMAKE_INSTALL_FULL_LIBDIR@")
set(CMAKE_MACOSX_RPATH 1) # new for cmake 3.x
endif()

# include the exported targets of this project
include(@CMAKE_INSTALL_PREFIX@/lib/cmake/clair/clair-targets.cmake)

endif()
2 changes: 1 addition & 1 deletion src/plugins/c2py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_dependencies(c2py_plugin clair_c2py)
target_compile_options(c2py_plugin
INTERFACE
$<BUILD_INTERFACE:-fplugin=${CMAKE_CURRENT_BINARY_DIR}/clair_c2py${CMAKE_SHARED_LIBRARY_SUFFIX}>
$<INSTALL_INTERFACE:-fplugin=${CMAKE_INSTALL_LIBDIR}/clair_c2py${CMAKE_SHARED_LIBRARY_SUFFIX}>
$<INSTALL_INTERFACE:-fplugin=${CMAKE_INSTALL_FULL_LIBDIR}/clair_c2py${CMAKE_SHARED_LIBRARY_SUFFIX}>
)
target_compile_definitions(c2py_plugin INTERFACE C2PY_INCLUDED)
add_library(clair::c2py_plugin ALIAS c2py_plugin)
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/c2py/matchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace matchers {
#endif

if (auto *s = llvm::dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>(cls)) {
if (!s->getTypeAsWritten()) return;
if (!s->isExplicitInstantiationOrSpecialization()) return;
}

// Reject the declaration of the template itself.
Expand Down

0 comments on commit 5a789ba

Please sign in to comment.