Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build as shared library or static library #1001

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1029,15 +1029,6 @@ else()
add_library(draco::draco ALIAS draco)

else()
draco_add_library(
NAME draco_static
OUTPUT_NAME draco
TYPE STATIC
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})

if(BUILD_SHARED_LIBS)
draco_add_library(
NAME draco_shared
Expand All @@ -1046,10 +1037,19 @@ else()
TYPE SHARED
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
LIB_DEPS draco_static)
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})
add_library(draco::draco ALIAS draco_shared)
set_target_properties(draco_shared PROPERTIES EXPORT_NAME draco)
else()
draco_add_library(
NAME draco_static
OUTPUT_NAME draco
TYPE STATIC
DEFINES ${draco_defines}
INCLUDES ${draco_include_paths}
OBJLIB_DEPS ${draco_object_library_deps}
LIB_DEPS ${draco_lib_deps})
add_library(draco::draco ALIAS draco_static)
set_target_properties(draco_static PROPERTIES EXPORT_NAME draco)
endif()
Expand Down
9 changes: 5 additions & 4 deletions cmake/draco_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ macro(draco_setup_install_target)
ARCHIVE DESTINATION "${libs_path}"
LIBRARY DESTINATION "${libs_path}")
else()
install(
TARGETS draco_static
EXPORT dracoExport
DESTINATION "${libs_path}")

if(BUILD_SHARED_LIBS)
install(
Expand All @@ -78,6 +74,11 @@ macro(draco_setup_install_target)
RUNTIME DESTINATION "${bin_path}"
ARCHIVE DESTINATION "${libs_path}"
LIBRARY DESTINATION "${libs_path}")
else()
install(
TARGETS draco_static
EXPORT dracoExport
DESTINATION "${libs_path}")
endif()
endif()

Expand Down