Skip to content

Commit

Permalink
Modify namespace scheme for conan-center
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavezac committed May 14, 2021
1 parent 3cb820a commit 484f8ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
21 changes: 11 additions & 10 deletions cmake/exporting.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Exports so3 so other packages can access it
export(
TARGETS so3
FILE "${PROJECT_BINARY_DIR}/So3Targets.cmake"
NAMESPACE so3)
TARGETS astro-informatics-so3
FILE "${PROJECT_BINARY_DIR}/astro-informatics-so3Targets.cmake"
NAMESPACE astro-informatics-so3::)

# Avoids creating an entry in the cmake registry.
if(NOT NOEXPORT)
export(PACKAGE so3)
export(PACKAGE astro-informatics-so3)
endif()

set(INCLUDE_INSTALL_DIR include/)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/so3Config.in.cmake "${PROJECT_BINARY_DIR}/so3Config.cmake"
cmake/so3Config.in.cmake
"${PROJECT_BINARY_DIR}/astro-informatics-so3Config.cmake"
INSTALL_DESTINATION lib/cmake/so3
PATH_VARS INCLUDE_INSTALL_DIR)
write_basic_package_version_file(
Expand All @@ -21,12 +22,12 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion)

if(NOT CONAN_EXPORTED)
install(FILES "${PROJECT_BINARY_DIR}/so3Config.cmake"
"${PROJECT_BINARY_DIR}/so3ConfigVersion.cmake"
DESTINATION lib/cmake/so3)
install(FILES "${PROJECT_BINARY_DIR}/astro-informatics-so3Config.cmake"
"${PROJECT_BINARY_DIR}/astro-informatics-so3ConfigVersion.cmake"
DESTINATION lib/cmake/astro-informatics-so3)
endif()

install(
EXPORT so3Targets
DESTINATION lib/cmake/so3
NAMESPACE so3)
DESTINATION lib/cmake/astro-informatics-so3
NAMESPACE astro-informatics-so3::)
17 changes: 10 additions & 7 deletions src/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
add_library(so3 STATIC so3_core.c so3_sampling.c so3_adjoint.c so3_conv.c)
target_link_libraries(so3 PUBLIC ssht::ssht FFTW3::FFTW3 ${MATH_LIBRARY})
add_library(astro-informatics-so3 STATIC so3_core.c so3_sampling.c
so3_adjoint.c so3_conv.c)
target_link_libraries(astro-informatics-so3 PUBLIC ssht::ssht FFTW3::FFTW3
${MATH_LIBRARY})
target_include_directories(
so3
astro-informatics-so3
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(so3 PROPERTIES C_STANDARD 99 ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib)
target_compile_features(so3 PUBLIC c_std_99)
set_target_properties(
astro-informatics-so3 PROPERTIES C_STANDARD 99 ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/lib)
target_compile_features(astro-informatics-so3 PUBLIC c_std_99)
configure_file(${PROJECT_SOURCE_DIR}/include/so3/so3_version.in.h
${PROJECT_BINARY_DIR}/include/so3/so3_version.h)

if(NOT SKBUILD)
install(
TARGETS so3
TARGETS astro-informatics-so3
EXPORT so3Targets
ARCHIVE DESTINATION lib
PUBLIC_HEADER)
Expand Down
4 changes: 2 additions & 2 deletions src/so3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ add_cython_target(cython_sources bindings.pyx C PY3)

add_library(bindings MODULE ${cython_sources})
python_extension_module(bindings)
target_link_libraries(bindings so3)
target_link_libraries(bindings astro-informatics-so3)
target_include_directories(bindings PUBLIC ${NumPy_INCLUDE_DIRS})
if(WIN32)
target_compile_definitions(bindings PUBLIC MS_WIN64)
target_compile_definitions(bindings PUBLIC MS_WIN64)
endif()
install(TARGETS bindings LIBRARY DESTINATION src/so3)
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_library(utilities OBJECT utilities.c)
target_link_libraries(utilities PUBLIC so3)
target_link_libraries(utilities PUBLIC astro-informatics-so3)
foreach(testname sampling so3 convolution)
add_executable(test_${testname} test_${testname}.c)
target_link_libraries(test_${testname} PRIVATE so3 cmocka)
target_link_libraries(test_${testname} PRIVATE astro-informatics-so3 cmocka)
set_target_properties(
test_${testname} PROPERTIES C_STANDARD 11 RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin)
Expand Down

0 comments on commit 484f8ad

Please sign in to comment.