Skip to content

Commit

Permalink
[refactor]: refactor for cmake project
Browse files Browse the repository at this point in the history
  • Loading branch information
dterazhao committed Oct 25, 2023
1 parent bcd44dc commit b35158c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (OPENMP_FOUND)
endif ()

# include directories and link libraries
include_directories(. third_party/include)
include_directories(. include third_party/include)
link_directories(third_party/lib)
set(EXTRA_LIB)
if (APPLE)
Expand All @@ -41,7 +41,7 @@ set(ABSL_LIB absl_int128 absl_strings absl_symbolize absl_stacktrace absl_throw_
add_library(${PROJECT_NAME} SHARED ${SRCS})
#target_sources(${PROJECT_NAME} PRIVATE)
target_link_libraries(${PROJECT_NAME} yacl ${ABSL_LIB} # protobuf::libprotobuf protobuf::libprotobuf-lite
tommath fmt ssl crypto blake3 sodium curve25519)
tommath fmt blake3 sodium curve25519)
set(EXE_TARGETS)

# Building tests
Expand Down Expand Up @@ -79,7 +79,7 @@ endforeach ()
add_executable(${PROJECT_NAME}_tests ${PROJECT_NAME}/tests.cc)
target_link_libraries(${PROJECT_NAME}_tests ${PROJECT_NAME}
GTest::GTest
)
)
file(GLOB TEST_SUITS ${PROJECT_NAME}/tests/*_test.cc)
target_sources(${PROJECT_NAME}_tests PRIVATE ${TEST_SUITS})
list(APPEND EXE_TARGETS ${PROJECT_NAME}_tests)
Expand All @@ -91,4 +91,4 @@ set_target_properties(${PROJECT_NAME} ${EXE_TARGETS} PROPERTIES
CXX_STANDARD ${CMAKE_CXX_STANDARD}
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
)
File renamed without changes.
3 changes: 1 addition & 2 deletions third_party/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ cd "$CD" || exit
echo "Current Directory: $CD"
[ -d src ] || mkdir src

#rm -rf include/* lib/*
rm -rf lib/*
rm -rf include/* lib/* && mkdir include lib
# build yacl
"$CD"/build_yacl.sh
10 changes: 4 additions & 6 deletions third_party/build_yacl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ echo "Current Directory: $CD"
pkg=yacl
[ -f src/"$pkg".tar.gz ] || curl https://github.com/dtera/yacl/releases/download/v1.0.0/"$pkg".tar.gz -L -o src/"$pkg".tar.gz
rm -rf "$pkg" && tar xvf src/"$pkg".tar.gz && "$pkg"/third_party/build.sh
lib=".so"
#lib=".so"
# [[ "$OSTYPE" == "darwin"* ]] && lib=".dylib"
rm -f "$CD"/$pkg/third_party/lib/libssl"$lib" && \
cp "$CD"/$pkg/third_party/lib/libssl.1.1"$lib" "$CD"/$pkg/third_party/lib/libssl"$lib" && \
rm -f "$CD"/$pkg/third_party/lib/libssl.1.1"$lib"
[ -d "$CD"/lib ] || mkdir -p "$CD"/lib
[ -d "$CD"/include ] || mkdir -p "$CD"/include
#rm -f "$CD"/$pkg/third_party/lib/libssl"$lib" && \
#cp "$CD"/$pkg/third_party/lib/libssl.1.1"$lib" "$CD"/$pkg/third_party/lib/libssl"$lib" && \
#rm -f "$CD"/$pkg/third_party/lib/libssl.1.1"$lib"
cp -R "$CD"/$pkg/third_party/lib/* "$CD"/lib/ && cp -R "$CD"/$pkg/third_party/include/* "$CD"/include/

cd "$CD"/"$pkg" || exit 0
Expand Down

0 comments on commit b35158c

Please sign in to comment.