Skip to content

Commit

Permalink
Rename library
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqiNs committed Oct 29, 2024
1 parent d33b9b9 commit 9dcdabb
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,40 @@ add_subdirectory(src)
add_subdirectory(tests)

# Install targets and files.
install(TARGETS LibRBP
EXPORT LibRBPTargets
install(TARGETS RBP
EXPORT RBPTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/LibRBP)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/RBP)

install(EXPORT LibRBPTargets
FILE LibRBPTargets.cmake
NAMESPACE LibRBP::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibRBP)
install(EXPORT RBPTargets
FILE RBPTargets.cmake
NAMESPACE RBP::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/RBP)

# Install the configuration file.
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibRBPConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibRBP)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/RBPConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/RBPConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/RBP)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/RBPConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibRBP)
"${CMAKE_CURRENT_BINARY_DIR}/RBPConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/RBPConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/RBP)

# Install the dependency file.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibRBPDependencies.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPDependencies.cmake"
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/RBPDependencies.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/RBPDependencies.cmake"
@ONLY)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/LibRBPDependencies.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibRBP)
"${CMAKE_CURRENT_BINARY_DIR}/RBPDependencies.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/RBP)
4 changes: 2 additions & 2 deletions cmake/LibRBPConfig.cmake.in → cmake/RBPConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ include(CMakeFindDependencyMacro)
find_dependency(RELIC REQUIRED)
link_libraries(${RLC_LIBRARY})

include("${CMAKE_CURRENT_LIST_DIR}/LibRBPTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/RBPTargets.cmake")

check_required_components(LibRBP)
check_required_components(RBP)
File renamed without changes.
4 changes: 2 additions & 2 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find the RBP library.
find_package(LibRBP REQUIRED)
find_package(RBP REQUIRED)

# Create an executable.
add_executable(demo demo.cpp)

# Link the executable with the library.
target_link_libraries(demo PUBLIC LibRBP::LibRBP)
target_link_libraries(demo PUBLIC RBP::RBP)
2 changes: 1 addition & 1 deletion demo/demo.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <iostream>
#include <LibRBP/bp.hpp>
#include <RBP/bp.hpp>

int main(){
std::cout << "Testing import the RBP library..." << std::endl;
Expand Down
12 changes: 6 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
file(GLOB SOURCE_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp")

# Make an automatic library - will be static or dynamic based on user setting.
add_library(LibRBP ${SOURCE_LIST})
add_library(RBP ${SOURCE_LIST})

# Add this line:
add_library(LibRBP::LibRBP ALIAS LibRBP)
add_library(RBP::RBP ALIAS RBP)

# We need this directory, and users of our library will need it too.
target_include_directories(LibRBP PUBLIC
target_include_directories(RBP PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_link_libraries(LibRBP PUBLIC ${RLC_LIBRARY})
target_link_libraries(RBP PUBLIC ${RLC_LIBRARY})

# Add this line to ensure RELIC's include directories are correctly passed
target_include_directories(LibRBP PUBLIC ${RLC_INCLUDE_DIRS})
target_include_directories(RBP PUBLIC ${RLC_INCLUDE_DIRS})

# Add RPATH settings
set_target_properties(LibRBP PROPERTIES
set_target_properties(RBP PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib"
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH TRUE)
10 changes: 5 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ include(GoogleTest)
set(GTEST_LIB gtest gtest_main)
# -----------------------------------------------------
add_executable(test_fp test_fp.cpp)
target_link_libraries(test_fp LibRBP ${GTEST_LIB})
target_link_libraries(test_fp RBP ${GTEST_LIB})
gtest_discover_tests(test_fp)
# -----------------------------------------------------
add_executable(test_field test_field.cpp)
target_link_libraries(test_field LibRBP ${GTEST_LIB})
target_link_libraries(test_field RBP ${GTEST_LIB})
gtest_discover_tests(test_field)
# -----------------------------------------------------
add_executable(test_gp test_gp.cpp)
target_link_libraries(test_gp LibRBP ${GTEST_LIB})
target_link_libraries(test_gp RBP ${GTEST_LIB})
gtest_discover_tests(test_gp)
# -----------------------------------------------------
add_executable(test_group test_group.cpp)
target_link_libraries(test_group LibRBP ${GTEST_LIB})
target_link_libraries(test_group RBP ${GTEST_LIB})
gtest_discover_tests(test_group)
# -----------------------------------------------------
add_executable(test_bp test_bp.cpp)
target_link_libraries(test_bp LibRBP ${GTEST_LIB})
target_link_libraries(test_bp RBP ${GTEST_LIB})
gtest_discover_tests(test_bp)
# -----------------------------------------------------

0 comments on commit 9dcdabb

Please sign in to comment.