Commit 10e4ac08 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

cmake: prefix common targets with OVM_ when built in subdir; simplify doxygen

parent 6a09c460
Pipeline #12000 failed with stage
in 4 minutes and 52 seconds
...@@ -16,8 +16,6 @@ else() ...@@ -16,8 +16,6 @@ else()
set(OVM_STANDALONE_BUILD FALSE) set(OVM_STANDALONE_BUILD FALSE)
endif() endif()
#message("OVM_STANDALONE_BUILD: ${OVM_STANDALONE_BUILD}")
set(OVM_ENABLE_UNITTESTS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh unit tests in 'all' target") set(OVM_ENABLE_UNITTESTS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh unit tests in 'all' target")
set(OVM_ENABLE_EXAMPLES ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh examples in 'all' target") set(OVM_ENABLE_EXAMPLES ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh examples in 'all' target")
set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh documentation in 'all' target") set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh documentation in 'all' target")
...@@ -25,19 +23,15 @@ set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolume ...@@ -25,19 +23,15 @@ set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolume
set(OVM_CXX_VERSION 14 CACHE STRING "C++ version to use") set(OVM_CXX_VERSION 14 CACHE STRING "C++ version to use")
set_property(CACHE OVM_CXX_VERSION PROPERTY STRINGS 14 17 20) set_property(CACHE OVM_CXX_VERSION PROPERTY STRINGS 14 17 20)
if (OVM_STANDALONE_BUILD)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/bin")
if (WIN32) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set (ACG_PROJECT_LIBDIR "lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/lib")
set (ACG_PROJECT_BINDIR ".") set(OVM_TARGET_PREFIX "")
else () else()
set (ACG_PROJECT_LIBDIR "lib") # OVM_TARGET_PREFIX is prepended to targets with generic names,
set (ACG_PROJECT_BINDIR "bin") # i.e., "doc", "unittests"
endif () set(OVM_TARGET_PREFIX "OVM_")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}")
endif() endif()
set (CMAKE_DEBUG_POSTFIX "d") set (CMAKE_DEBUG_POSTFIX "d")
......
if (NOT TARGET doc) find_package(Doxygen REQUIRED dot)
include (ACGDoxygen) set(TARGET_NAME "${OVM_TARGET_PREFIX}doc")
#find_package(Doxygen REQUIRED dot) if (DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/html/logo_vci.png")
set(DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/images")
set(DOXYGEN_WARN_IF_UNDOCUMENTED "FALSE")
set(DOXYGEN_CITE_BIB_FILES "${CMAKE_CURRENT_SOURCE_DIR}/references.bib")
IF (DOXYGEN_FOUND) if (${ACG_PROJECT_DATADIR})
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html")
if (TARGET doc) else()
# TODO set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/share/doc/OpenVolumeMesh")
#acg_copy_after_build (doc "${CMAKE_CURRENT_SOURCE_DIR}/html" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html")
endif ()
# Add a documentation install target
add_custom_target(doc-install COMMENT "Installing Documentation" VERBATIM )
# Build Documentation before installing it
add_dependencies(doc-install doc)
if (TARGET doc-install)
# TODO
# acg_copy_after_build (doc-install "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/html" "${CMAKE_INSTALL_PREFIX}/${ACG_PROJECT_DATADIR}/doc/html")
endif() endif()
ENDIF(DOXYGEN_FOUND) doxygen_add_docs(${TARGET_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/..")
ENDIF()
endif()
...@@ -9,20 +9,22 @@ SET(SOURCE_FILES ...@@ -9,20 +9,22 @@ SET(SOURCE_FILES
find_package(OpenVolumeMesh REQUIRED) find_package(OpenVolumeMesh REQUIRED)
set(TARGET_NAME "${OVM_TARGET_PREFIX}unittests")
enable_testing() enable_testing()
find_package(GTest) find_package(GTest)
if(GTEST_FOUND) if(GTEST_FOUND)
include(GoogleTest) include(GoogleTest)
add_executable(unittests ${SOURCE_FILES}) add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(unittests target_link_libraries(unittests
OpenVolumeMesh::OpenVolumeMesh OpenVolumeMesh::OpenVolumeMesh
GTest::GTest GTest::GTest
GTest::Main GTest::Main
) )
gtest_add_tests(TARGET unittests gtest_add_tests(TARGET ${TARGET_NAME}
EXTRA_ARGS "--gtest_color=yes;--gtest_output=xml" EXTRA_ARGS "--gtest_color=yes;--gtest_output=xml"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests"
) )
...@@ -31,7 +33,7 @@ if(GTEST_FOUND) ...@@ -31,7 +33,7 @@ if(GTEST_FOUND)
DESTINATION "${CMAKE_BINARY_DIR}/Unittests" DESTINATION "${CMAKE_BINARY_DIR}/Unittests"
) )
set_target_properties(unittests PROPERTIES set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests
CXX_STANDARD ${OVM_CXX_VERSION} CXX_STANDARD ${OVM_CXX_VERSION}
CXX_STANDARD_REQUIRED YES CXX_STANDARD_REQUIRED YES
...@@ -40,7 +42,7 @@ if(GTEST_FOUND) ...@@ -40,7 +42,7 @@ if(GTEST_FOUND)
#[[= #[[=
if ( WIN32 ) if ( WIN32 )
add_custom_command (TARGET unittests POST_BUILD add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E COMMAND ${CMAKE_COMMAND} -E
copy_if_different copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/unittests.exe
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment