Skip to content

Commit

Permalink
Merge pull request #684 from nmellado/fix#682-2
Browse files Browse the repository at this point in the history
Add dependencies between external targets
  • Loading branch information
nmellado authored Feb 10, 2021
2 parents 537caae + 377349c commit a50a3b4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ else()
add_subdirectory(Core)
# add Engine dependencies
add_subdirectory(Engine)
# set dependencies between external targets
add_dependencies(EngineExternals CoreExternals)
# add IO dependencies, all activated by default by this cmake script
option( RADIUM_IO_ASSIMP "Provide loaders based on Assimp library" ON )
option( RADIUM_IO_TINYPLY "Provide loaders based on TinyPly library" ON )
Expand Down
8 changes: 6 additions & 2 deletions external/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
string(REPLACE ";" "" indent_string "${CMAKE_MESSAGE_INDENT}")
set(indent_string "${indent_string}--")

add_custom_target( CoreExternals )

if (NOT DEFINED Eigen3_DIR)
CheckExternalsPrerequisite()
StatusMessage("" "eigen3" "remote git")
Expand All @@ -29,9 +31,9 @@ if (NOT DEFINED Eigen3_DIR)
-DBUILD_TESTING=OFF
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies( CoreExternals Eigen3 )
else ()
StatusMessage("" "eigen3" ${Eigen3_DIR})
add_custom_target(Eigen3)
endif ()


Expand All @@ -53,6 +55,7 @@ if (NOT DEFINED OpenMesh_DIR)
-DBUILD_APPS=OFF
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies( CoreExternals OpenMesh )
else()
StatusMessage("" "OpenMesh" ${OpenMesh_DIR})
endif()
Expand All @@ -73,6 +76,7 @@ if (NOT DEFINED cpplocate_DIR OR NOT cpplocate_DIR)
-DOPTION_BUILD_DOCS=OFF
-DCMAKE_MESSAGE_INDENT=${indent_string}\;
)
add_dependencies( CoreExternals cpplocate )
else()
StatusMessage("" "cpplocate" ${cpplocate_DIR})
endif()
endif()
8 changes: 7 additions & 1 deletion external/Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
string(REPLACE ";" "" indent_string "${CMAKE_MESSAGE_INDENT}")
set(indent_string "${indent_string}--")

add_custom_target( EngineExternals )

if (NOT DEFINED glm_DIR)
CheckExternalsPrerequisite()
StatusMessage("[EngineExternal]" "glm" "remote git")
Expand All @@ -35,6 +37,7 @@ if (NOT DEFINED glm_DIR)
)

set(glm_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/glm)
add_dependencies( EngineExternals glm )
else()
#because other might depends on it, but it's already done, define a dummy target
add_custom_target(glm)
Expand Down Expand Up @@ -62,6 +65,7 @@ if (NOT DEFINED glbinding_DIR)
)

set(glbinding_DIR ${CMAKE_INSTALL_PREFIX}/share/glbinding)
add_dependencies( EngineExternals glbinding )
else()
add_custom_target(glbinding)
StatusMessage("" "glbinding" "${glbinding_DIR}")
Expand All @@ -83,7 +87,7 @@ if (NOT DEFINED globjects_DIR)
GIT_PROGRESS TRUE
PATCH_COMMAND git reset --hard && git apply -v --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/patches/globjects.patch"
INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
DEPENDS glbinding glm Eigen3
DEPENDS glbinding glm
CMAKE_ARGS
${RADIUM_EXTERNAL_CMAKE_OPTIONS}
-DOPTION_BUILD_DOCS=OFF
Expand All @@ -96,6 +100,7 @@ if (NOT DEFINED globjects_DIR)
)

set(globjects_DIR ${CMAKE_INSTALL_PREFIX}/share/globjects)
add_dependencies( EngineExternals globjects )
else()
StatusMessage("" "globjects" "${globjects_DIR}")
endif()
Expand All @@ -114,6 +119,7 @@ if (NOT DEFINED stb_DIR)
COMMAND ${CMAKE_COMMAND} -E copy_if_different <SOURCE_DIR>/stb_image_write.h ${CMAKE_INSTALL_PREFIX}/include/stb/
INSTALL_COMMAND ""
)
add_dependencies( EngineExternals stb )
else()
StatusMessage("" "stb" "${stb_DIR}")
message(STATUS "Installing stb_image.h to ${CMAKE_INSTALL_PREFIX}/include")
Expand Down
4 changes: 4 additions & 0 deletions external/IO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
string(REPLACE ";" "" indent_string "${CMAKE_MESSAGE_INDENT}")
set(indent_string "${indent_string}--")

add_custom_target( IOExternals )

if (RADIUM_IO_ASSIMP)
if (NOT DEFINED assimp_DIR)
CheckExternalsPrerequisite()
Expand All @@ -39,6 +41,7 @@ if (RADIUM_IO_ASSIMP)
-DASSIMP_NO_EXPORT=True
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies( IOExternals assimp )
else()
StatusMessage("" "assimp" "${assimp_DIR}")
endif()
Expand All @@ -60,6 +63,7 @@ if(RADIUM_IO_TINYPLY)
-DSHARED_LIB=TRUE
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies( IOExternals tinyply )
else()
StatusMessage("[IOExternal]" "tinyply" "${tinyply_DIR}")
endif()
Expand Down

0 comments on commit a50a3b4

Please sign in to comment.