mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-24 05:07:54 +08:00
cb0e14cadf
* Add v-hacd * [v-hacd] Fix portfile features * [v-hacd] Only support static linkage * [v-hacd] Fix patchfile * [v-hacd] Remove ARM as a supported platform * [v-hacd] Update ports/v-hacd/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
127 lines
4.6 KiB
Diff
127 lines
4.6 KiB
Diff
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 2bbb283..2f7eb52 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -1,12 +1 @@
|
|
-cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
|
|
-project(VHACD)
|
|
-option(NO_OPENCL "NO_OPENCL" OFF)
|
|
-option(NO_OPENMP "NO_OPENMP" OFF)
|
|
-
|
|
-message("NO_OPENCL " ${NO_OPENCL})
|
|
-message("NO_OPENMP " ${NO_OPENMP})
|
|
-
|
|
-#set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/output" CACHE PATH "project install prefix" FORCE)
|
|
-set(CMAKE_COMMON_INC "${CMAKE_SOURCE_DIR}/../scripts/cmake_common.cmake")
|
|
-add_subdirectory ("${CMAKE_SOURCE_DIR}/VHACD_Lib")
|
|
-add_subdirectory ("${CMAKE_SOURCE_DIR}/test")
|
|
+add_subdirectory ("${CMAKE_CURRENT_SOURCE_DIR}/VHACD_Lib")
|
|
\ No newline at end of file
|
|
diff --git a/src/VHACD_Lib/CMakeLists.txt b/src/VHACD_Lib/CMakeLists.txt
|
|
index 46fc1b1..2260fdc 100644
|
|
--- a/src/VHACD_Lib/CMakeLists.txt
|
|
+++ b/src/VHACD_Lib/CMakeLists.txt
|
|
@@ -1,34 +1,36 @@
|
|
+cmake_minimum_required(VERSION 3.10.0)
|
|
+
|
|
project(VHACD_LIB CXX C)
|
|
-include(${CMAKE_COMMON_INC})
|
|
+include("${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/cmake_common.cmake")
|
|
+
|
|
+set(CMAKE_CXX_STANDARD 11)
|
|
|
|
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
+set(LIB_TYPE "STATIC" CACHE STRING "STATIC, SHARED or MODULE?")
|
|
+message("[VHACD] \t LIB_TYPE " ${LIB_TYPE})
|
|
+add_library(vhacd ${LIB_TYPE} ${PROJECT_CPP_FILES} ${PROJECT_C_FILES} ${PROJECT_INC_FILES} ${PROJECT_INL_FILES} ${PROJECT_CL_FILES})
|
|
|
|
if (NOT NO_OPENCL)
|
|
#include(FindOpenCL OPTIONAL)
|
|
- find_package(OpenCL)
|
|
+ find_package(OpenCL REQUIRED)
|
|
endif()
|
|
if (NOT NO_OPENMP)
|
|
#include(FindOpenMP OPTIONAL)
|
|
- find_package(OpenMP)
|
|
+ find_package(OpenMP REQUIRED)
|
|
endif()
|
|
if(OPENMP_FOUND)
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
|
|
+ target_link_libraries(vhacd PRIVATE OpenMP::OpenMP_CXX)
|
|
endif()
|
|
-set(LIB_TYPE "STATIC" CACHE STRING "STATIC, SHARED or MODULE?")
|
|
-message("[VHACD] \t LIB_TYPE " ${LIB_TYPE})
|
|
-add_library(vhacd ${LIB_TYPE} ${PROJECT_CPP_FILES} ${PROJECT_C_FILES} ${PROJECT_INC_FILES} ${PROJECT_INL_FILES} ${PROJECT_CL_FILES})
|
|
|
|
if (OpenCL_FOUND)
|
|
- target_include_directories(vhacd PRIVATE "${OpenCL_INCLUDE_DIR}")
|
|
- target_link_libraries(vhacd PRIVATE "${OpenCL_LIBRARY}")
|
|
+ target_link_libraries(vhacd PRIVATE OpenCL::OpenCL)
|
|
target_compile_definitions(vhacd PRIVATE -DOPENCL_FOUND=1 )
|
|
target_compile_definitions(vhacd PRIVATE -DOPENCL_CL_FILES="${PROJECT_CL_FILES}" )
|
|
endif()
|
|
|
|
-
|
|
target_include_directories(vhacd PUBLIC
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/public/>)
|
|
+
|
|
+target_include_directories(vhacd PRIVATE
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc/>
|
|
$<INSTALL_INTERFACE:include/> # <prefix>/include/mylib
|
|
)
|
|
@@ -43,32 +45,32 @@ install(FILES ${PROJECT_INL_FILES} DESTINATION include)
|
|
set(VHACD_LIB_VERSION 3.2.0)
|
|
include(CMakePackageConfigHelpers)
|
|
write_basic_package_version_file(
|
|
- "${CMAKE_CURRENT_BINARY_DIR}/vhacd/vhacd-config-version.cmake"
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/vhacd/v-hacd-config-version.cmake"
|
|
VERSION ${VHACD_LIB_VERSION}
|
|
COMPATIBILITY AnyNewerVersion
|
|
)
|
|
|
|
-export(EXPORT vhacd-targets NAMESPACE ::
|
|
- FILE "${CMAKE_CURRENT_BINARY_DIR}/vhacd/vhacd-targets.cmake"
|
|
+export(EXPORT vhacd-targets NAMESPACE vhacd::
|
|
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/vhacd/v-hacd-targets.cmake"
|
|
)
|
|
|
|
configure_file(cmake/vhacd-config.cmake
|
|
- "${CMAKE_CURRENT_BINARY_DIR}/vhacd/vhacd-config.cmake"
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/vhacd/v-hacd-config.cmake"
|
|
COPYONLY
|
|
)
|
|
|
|
set(ConfigPackageLocation lib/cmake/vhacd)
|
|
install(EXPORT vhacd-targets
|
|
FILE
|
|
- vhacd-targets.cmake
|
|
+ v-hacd-targets.cmake
|
|
DESTINATION
|
|
${ConfigPackageLocation}
|
|
- NAMESPACE ::
|
|
+ NAMESPACE vhacd::
|
|
)
|
|
install(
|
|
FILES
|
|
- "${CMAKE_CURRENT_BINARY_DIR}/vhacd/vhacd-config.cmake"
|
|
- "${CMAKE_CURRENT_BINARY_DIR}/vhacd/vhacd-config-version.cmake"
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/vhacd/v-hacd-config.cmake"
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/vhacd/v-hacd-config-version.cmake"
|
|
DESTINATION
|
|
${ConfigPackageLocation}
|
|
COMPONENT
|
|
diff --git a/src/VHACD_Lib/cmake/vhacd-config.cmake b/src/VHACD_Lib/cmake/vhacd-config.cmake
|
|
index 8fc5c58..7677f58 100644
|
|
--- a/src/VHACD_Lib/cmake/vhacd-config.cmake
|
|
+++ b/src/VHACD_Lib/cmake/vhacd-config.cmake
|
|
@@ -1,4 +1,4 @@
|
|
|
|
find_package(OpenCL)
|
|
find_package(OpenMP)
|
|
-include("${CMAKE_CURRENT_LIST_DIR}/vhacd-targets.cmake")
|
|
\ No newline at end of file
|
|
+include("${CMAKE_CURRENT_LIST_DIR}/v-hacd-targets.cmake")
|
|
\ No newline at end of file
|