Skip to content

Commit

Permalink
Supportobj (#1715)
Browse files Browse the repository at this point in the history
* Only compile Support.cpp once.

* Generate dimension header file for Support.cpp.
  • Loading branch information
abellgithub committed Nov 1, 2017
1 parent 6f07137 commit 618b2c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -58,6 +58,7 @@ endif()
set(PDAL_UTIL_LIB_NAME pdal_util)
set(PDAL_BOOST_LIB_NAME pdal_boost)
set(PDAL_KAZHDAN_LIB_NAME pdal_kazhdan)
set(PDAL_TEST_SUPPORT_OBJS pdal_test_support)

set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)

Expand Down
6 changes: 2 additions & 4 deletions cmake/macros.cmake
Expand Up @@ -162,14 +162,12 @@ macro(PDAL_ADD_TEST _name)
set(oneValueArgs)
set(multiValueArgs FILES LINK_WITH)
cmake_parse_arguments(PDAL_ADD_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(common_srcs
${PROJECT_SOURCE_DIR}/test/unit/Support.cpp
)
if (WIN32)
list(APPEND ${PDAL_ADD_TEST_FILES} ${PDAL_TARGET_OBJECTS})
add_definitions("-DPDAL_DLL_EXPORT=1")
endif()
add_executable(${_name} ${PDAL_ADD_TEST_FILES} ${common_srcs})
add_executable(${_name} ${PDAL_ADD_TEST_FILES}
$<TARGET_OBJECTS:${PDAL_TEST_SUPPORT_OBJS}>)
target_include_directories(${_name} PRIVATE
${ROOT_DIR}
${PDAL_INCLUDE_DIR}
Expand Down
11 changes: 11 additions & 0 deletions test/unit/CMakeLists.txt
Expand Up @@ -15,6 +15,17 @@ foreach(infileName ${inFiles})
"${CMAKE_BINARY_DIR}/${outfileName}")
endforeach()

add_library(${PDAL_TEST_SUPPORT_OBJS} OBJECT Support.cpp)
add_dependencies(${PDAL_TEST_SUPPORT_OBJS} generate_dimension_hpp)
target_include_directories(${PDAL_TEST_SUPPORT_OBJS}
PRIVATE
${ROOT_DIR}
${PROJECT_BINARY_DIR}/include
${PROJECT_BINARY_DIR}/test/unit
${PDAL_INCLUDE_DIR}
)
PDAL_TARGET_COMPILE_SETTINGS(${PDAL_TEST_SUPPORT_OBJS})

PDAL_ADD_TEST(pdal_bounds_test FILES BoundsTest.cpp)
PDAL_ADD_TEST(pdal_config_test FILES ConfigTest.cpp)
PDAL_ADD_TEST(pdal_eigen_test FILES EigenTest.cpp)
Expand Down

0 comments on commit 618b2c4

Please sign in to comment.