make VHACD an external project

This commit is contained in:
Stephen Birarda 2015-04-15 13:51:51 -07:00
parent 8b41a952b3
commit 03129f98d4
11 changed files with 57 additions and 60 deletions

View file

@ -168,6 +168,7 @@ option(GET_SOXR "Get Soxr library automatically as external project" 1)
option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1)
option(GET_LIBOVR "Get LibOVR library automatically as external project" 1)
option(USE_NSIGHT "Attempt to find the nSight libraries" 1)
option(GET_VHACD "Get V-HACD library automatically as external project" 1)
if (WIN32)
option(GET_GLEW "Get GLEW library automatically as external project" 1)

30
cmake/externals/vhacd/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,30 @@
set(EXTERNAL_NAME vhacd)
if (ANDROID)
set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19")
endif ()
include(ExternalProject)
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://hifi-public.s3.amazonaws.com/dependencies/v-hacd-master.zip
URL_MD5 81d6244ac204db5ba27305e2e8e210ad
CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
)
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
if (WIN32)
set(LIBRARY_FILENAME ${EXTERNAL_NAME_UPPER}.lib)
else ()
set(LIBRARY_FILENAME lib${EXTERNAL_NAME_UPPER}.a)
endif ()
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to V-HACD include directory")
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/${LIBRARY_FILENAME} CACHE FILEPATH "Path to V-HACD library")

View file

@ -19,38 +19,8 @@
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("vhacd")
macro(_FIND_VHACD_LIBRARY _var)
set(_${_var}_NAMES ${ARGN})
find_library(${_var}_LIBRARY_RELEASE
NAMES ${_${_var}_NAMES}
HINTS
${VHACD_SEARCH_DIRS}
$ENV{VHACD_ROOT_DIR}
PATH_SUFFIXES lib lib/Release
)
find_library(${_var}_LIBRARY_DEBUG
NAMES ${_${_var}_NAMES}
HINTS
${VHACD_SEARCH_DIRS}
$ENV{VHACD_ROOT_DIR}
PATH_SUFFIXES lib lib/Debug
)
select_library_configurations(${_var})
mark_as_advanced(${_var}_LIBRARY)
mark_as_advanced(${_var}_LIBRARY)
endmacro()
find_path(VHACD_INCLUDE_DIRS VHACD.h PATH_SUFFIXES include HINTS ${VHACD_SEARCH_DIRS} $ENV{VHACD_ROOT_DIR})
if(NOT WIN32)
_FIND_VHACD_LIBRARY(VHACD libVHACD.a)
else()
_FIND_VHACD_LIBRARY(VHACD VHACD_LIB)
endif()
set(VHACD_LIBRARIES ${VHACD_LIBRARY})
find_path(VHACD_INCLUDE_DIRS VHACD.h PATH_SUFFIXES include HINTS ${VHACD_SEARCH_DIRS})
find_library(VHACD_LIBRARIES VHACD PATH_SUFFIXES lib HINTS ${VHACD_SEARCH_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VHACD "Could NOT find VHACD, try to set the path to VHACD root folder in the system variable VHACD_ROOT_DIR or create a directory vhacd in HIFI_LIB_DIR and paste the necessary files there"

View file

@ -1,12 +1,10 @@
# add the tool directories
add_subdirectory(mtc)
set_target_properties(mtc PROPERTIES FOLDER "Tools")
add_subdirectory(scribe)
set_target_properties(scribe PROPERTIES FOLDER "Tools")
add_subdirectory(vhacd-util)
set_target_properties(vhacd-util PROPERTIES FOLDER "Tools")
find_package(VHACD)
if(VHACD_FOUND)
add_subdirectory(vhacd)
# set_target_properties(vhacd PROPERTIES FOLDER "Tools")
endif()

View file

@ -0,0 +1,21 @@
set(TARGET_NAME vhacd-util)
setup_hifi_project(Core Widgets)
link_hifi_libraries(shared fbx model gpu)
add_dependency_external_projects(vhacd)
find_package(VHACD REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES})
if (NOT WIN32)
find_package(Threads)
target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT})
# include(FindOpenMP)
# 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}")
# endif()
endif ()

View file

@ -1,23 +0,0 @@
set(TARGET_NAME vhacd-util)
setup_hifi_project(Core Widgets)
link_hifi_libraries(shared model fbx gpu networking octree)
#find_package(VHACD REQUIRED) done in CMakeList.txt in parent directory
target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES})
if(NOT WIN32)
find_package( Threads)
target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT})
include(FindOpenMP)
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}")
endif()
endif()
add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})