Skip to content

Commit

Permalink
fix: cmakelists (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiakiteaneo authored Aug 8, 2023
2 parents c4bfecb + ac9500b commit 474b435
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 67 deletions.
2 changes: 1 addition & 1 deletion packages/cpp/ArmoniK.Api.Client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ install(EXPORT ${PROJECT_NAME}Targets
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
PATH_VARS CMAKE_INSTALL_PREFIX
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_LIBDIR
)

install(FILES
Expand Down
5 changes: 3 additions & 2 deletions packages/cpp/ArmoniK.Api.Client/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@PACKAGE_INIT@

set_and_check(ARMONIK_API_CLIENT_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set_and_check(ARMONIK_API_CLIENT_LIBPATH "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include(CMakeFindDependencyMacro)
find_dependency(ArmoniK.Api.Common CONFIG REQUIRED)

include("${ARMONIK_API_CLIENT_PREFIX}/lib/cmake/ArmoniK.Api.Client/ArmoniK.Api.ClientTargets.cmake")
include("${ARMONIK_API_CLIENT_LIBPATH}/cmake/ArmoniK.Api.Client/ArmoniK.Api.ClientTargets.cmake")

check_required_components(ArmoniK.Api.Client)

include_directories("${ARMONIK_API_CLIENT_PREFIX}/include/armonik/client")
include_directories("${ARMONIK_API_CLIENT_PREFIX}/include/armonik/client")
3 changes: 1 addition & 2 deletions packages/cpp/ArmoniK.Api.Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ include(FetchContent)
FETCHCONTENT_DECLARE(
simdjson
URL https://github.com/simdjson/simdjson/archive/refs/tags/v3.2.1.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)

FetchContent_GetProperties(simdjson)
Expand Down Expand Up @@ -119,7 +118,7 @@ install(EXPORT ${PROJECT_NAME}Targets
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
PATH_VARS CMAKE_INSTALL_PREFIX
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_LIBDIR
)

install(FILES
Expand Down
5 changes: 3 additions & 2 deletions packages/cpp/ArmoniK.Api.Common/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@PACKAGE_INIT@

set_and_check(ARMONIK_API_COMMON_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set_and_check(ARMONIK_API_COMMON_LIBPATH "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include(CMakeFindDependencyMacro)
find_dependency(Protobuf REQUIRED)
find_dependency(gRPC CONFIG REQUIRED)
find_dependency(Threads)

include("${ARMONIK_API_COMMON_PREFIX}/lib/cmake/ArmoniK.Api.Common/ArmoniK.Api.CommonTargets.cmake")
include("${ARMONIK_API_COMMON_LIBPATH}/cmake/ArmoniK.Api.Common/ArmoniK.Api.CommonTargets.cmake")

check_required_components(ArmoniK.Api.Common)

include_directories("${ARMONIK_API_COMMON_PREFIX}/include/armonik/common")
include_directories("${ARMONIK_API_COMMON_PREFIX}/include/armonik/common")
19 changes: 0 additions & 19 deletions packages/cpp/ArmoniK.Api.Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,3 @@ install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

#FILE(GLOB INCLUDE_FILES ${PROTO_BINARY_DIR}/*.h)
install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
5 changes: 0 additions & 5 deletions packages/cpp/ArmoniK.Api.Tests/Config.cmake.in

This file was deleted.

19 changes: 0 additions & 19 deletions packages/cpp/ArmoniK.Api.Worker.Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,3 @@ install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

#FILE(GLOB INCLUDE_FILES ${PROTO_BINARY_DIR}/*.h)
install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
5 changes: 0 additions & 5 deletions packages/cpp/ArmoniK.Api.Worker.Tests/Config.cmake.in

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cpp/ArmoniK.Api.Worker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ install(EXPORT ${PROJECT_NAME}Targets
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
PATH_VARS CMAKE_INSTALL_PREFIX
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_LIBDIR
)

install(FILES
Expand Down
3 changes: 2 additions & 1 deletion packages/cpp/ArmoniK.Api.Worker/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@PACKAGE_INIT@

set_and_check(ARMONIK_API_WORKER_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set_and_check(ARMONIK_API_WORKER_LIBPATH "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include(CMakeFindDependencyMacro)
find_dependency(ArmoniK.Api.Common CONFIG REQUIRED)

include("${ARMONIK_API_WORKER_PREFIX}/lib/cmake/ArmoniK.Api.Worker/ArmoniK.Api.WorkerTargets.cmake")
include("${ARMONIK_API_WORKER_LIBPATH}/cmake/ArmoniK.Api.Worker/ArmoniK.Api.WorkerTargets.cmake")

check_required_components(ArmoniK.Api.Worker)

Expand Down
15 changes: 9 additions & 6 deletions packages/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
cmake_minimum_required(VERSION 3.22)

if (POLICY CMP0135)
cmake_policy(SET CMP0135 OLD)
endif ()
set(version 0.1.0)

set(SOLUTION_NAME ArmoniK.Api)
project(${SOLUTION_NAME} C CXX)
if (UNIX)
set(BUILD_DIR "/app/build")
set(PROTO_FILES_DIR "/app/proto")
elseif (WIN32)
if(NOT DEFINED BUILD_DIR)
set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build")
endif()
if(NOT DEFINED PROTO_FILES_DIR)
set(PROTO_FILES_DIR "${CMAKE_SOURCE_DIR}/../../Protos/V1")
endif()
if (WIN32)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/tools/win64/lib/cmake/grpc")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/tools/win64/cmake")
set(Protobuf_USE_STATIC_LIBS ON)
endif (UNIX)
endif ()

option(BUILD_TEST "Build tests" OFF)
option(BUILD_CLIENT "Build client" ON)
Expand Down
2 changes: 1 addition & 1 deletion packages/cpp/tools/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN echo $PATH
WORKDIR /app/build

# Set the default command to build the client using CMake and make
CMD ["bash", "-c", "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/app/install -DBUILD_TEST=OFF /app/source/ && make -j $(nproc) install"]
CMD ["bash", "-c", "cmake -DCMAKE_BUILD_TYPE=Debug -DPROTO_FILES_DIR=/app/proto -DCMAKE_INSTALL_PREFIX=/app/install -DBUILD_TEST=OFF /app/source/ && make -j $(nproc) install"]

# Uncomment the line below if you want the container to start in the bash shell by default
# ENTRYPOINT ["bash"]
4 changes: 1 addition & 3 deletions packages/cpp/tools/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ cd -
cd "${working_dir}"

# Check if the Docker image exists, and if not, build it
if [ -z "$(docker images -q "${IMAGE_TAG}" 2> /dev/null)" ]; then
docker build -t "${IMAGE_TAG}" -f tools/Dockerfile.ubuntu .
fi
docker build -t "${IMAGE_TAG}" -f tools/Dockerfile.ubuntu .

mkdir -p ${working_dir}/build
mkdir -p ${working_dir}/buildtest
Expand Down

0 comments on commit 474b435

Please sign in to comment.