CMake: Remove p3dtoolconfig from build

It's just p3prc now, so instead we install some symlinks
This commit is contained in:
Sam Edwards 2019-11-04 13:44:54 -07:00
parent f7ac439eb1
commit cf59d3d983
5 changed files with 67 additions and 24 deletions

View File

@ -10,6 +10,5 @@ add_subdirectory(src/interrogate)
add_subdirectory(src/interrogatedb) add_subdirectory(src/interrogatedb)
add_subdirectory(src/prc) add_subdirectory(src/prc)
# Include dtool metalibs # Include dtool metalib
add_subdirectory(metalibs/dtool) add_subdirectory(metalibs/dtool)
add_subdirectory(metalibs/dtoolconfig)

View File

@ -1,11 +0,0 @@
set(DTOOLCONFIG_LINK_TARGETS p3prc)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "CoreDevel")
add_metalib(p3dtoolconfig INIT init_libdtoolconfig dtoolconfig.h COMPONENTS ${DTOOLCONFIG_LINK_TARGETS})
unset(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
install(TARGETS p3dtoolconfig
EXPORT Core COMPONENT Core
DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d
ARCHIVE COMPONENT CoreDevel)

View File

@ -37,7 +37,7 @@ composite_sources(p3interrogatedb P3INTERROGATEDB_SOURCES)
add_library(p3interrogatedb add_library(p3interrogatedb
${P3INTERROGATEDB_HEADERS} ${P3INTERROGATEDB_SOURCES}) ${P3INTERROGATEDB_HEADERS} ${P3INTERROGATEDB_SOURCES})
set_target_properties(p3interrogatedb PROPERTIES DEFINE_SYMBOL BUILDING_INTERROGATEDB) set_target_properties(p3interrogatedb PROPERTIES DEFINE_SYMBOL BUILDING_INTERROGATEDB)
target_link_libraries(p3interrogatedb p3dconfig p3dtoolconfig) target_link_libraries(p3interrogatedb p3dconfig p3prc)
install(TARGETS p3interrogatedb install(TARGETS p3interrogatedb
EXPORT Core COMPONENT Core EXPORT Core COMPONENT Core

View File

@ -81,8 +81,9 @@ set(P3PRC_IGATEEXT
) )
composite_sources(p3prc P3PRC_SOURCES) composite_sources(p3prc P3PRC_SOURCES)
add_component_library(p3prc NOINIT SYMBOL BUILDING_DTOOL_PRC add_library(p3prc
${P3PRC_HEADERS} ${P3PRC_SOURCES}) ${P3PRC_HEADERS} ${P3PRC_SOURCES})
set_target_properties(p3prc PROPERTIES DEFINE_SYMBOL BUILDING_DTOOL_PRC)
target_include_directories(p3prc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) target_include_directories(p3prc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_link_libraries(p3prc p3dtool PKG::OPENSSL) target_link_libraries(p3prc p3dtool PKG::OPENSSL)
target_interrogate(p3prc ALL EXTENSIONS ${P3PRC_IGATEEXT}) target_interrogate(p3prc ALL EXTENSIONS ${P3PRC_IGATEEXT})
@ -91,12 +92,66 @@ if(ANDROID)
target_link_libraries(p3prc log) target_link_libraries(p3prc log)
endif() endif()
if(NOT BUILD_METALIBS) install(TARGETS p3prc
install(TARGETS p3prc EXPORT Core COMPONENT Core
EXPORT Core COMPONENT Core DESTINATION ${CMAKE_INSTALL_LIBDIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d ARCHIVE COMPONENT CoreDevel)
ARCHIVE COMPONENT CoreDevel)
endif()
install(FILES ${P3PRC_HEADERS} COMPONENT CoreDevel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d) install(FILES ${P3PRC_HEADERS} COMPONENT CoreDevel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/panda3d)
# Also install under the old name "p3dtoolconfig"
# TODO: Remove this once "p3dtoolconfig" is deprecated
if(WIN32)
# Symlinks aren't pretty under WIN32
set(_symlink "copy")
else()
set(_symlink "create_symlink")
endif()
get_target_property(_type p3prc TYPE)
if(_type STREQUAL "SHARED_LIBRARY")
set(_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}")
if(UNIX)
get_target_property(_soversion p3prc SOVERSION)
if(APPLE)
set(_suffix ".${_soversion}${_suffix}")
else()
set(_suffix "${_suffix}.${_soversion}")
endif()
set(_file_genex "TARGET_SONAME_FILE")
set(_install_dir "${CMAKE_INSTALL_LIBDIR}")
else()
# Win32?
set(_file_genex "TARGET_FILE")
set(_install_dir "${CMAKE_INSTALL_BINDIR}")
endif()
set(_soname "${CMAKE_SHARED_LIBRARY_PREFIX}p3dtoolconfig${_suffix}")
add_custom_command(TARGET p3prc POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E chdir "$<${_file_genex}_DIR:p3prc>"
"${CMAKE_COMMAND}" -E "${_symlink}"
"$<${_file_genex}_NAME:p3prc>" "${_soname}"
)
install(FILES "$<${_file_genex}_DIR:p3prc>/${_soname}"
DESTINATION "${_install_dir}")
endif()
if(WIN32)
set(_libname "${CMAKE_IMPORT_LIBRARY_PREFIX}p3dtoolconfig${CMAKE_IMPORT_LIBRARY_SUFFIX}")
else()
set(_libname "${CMAKE_${_type}_PREFIX}p3dtoolconfig${CMAKE_${_type}_SUFFIX}")
endif()
add_custom_command(TARGET p3prc POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E chdir "$<TARGET_LINKER_FILE_DIR:p3prc>"
"${CMAKE_COMMAND}" -E "${_symlink}"
"$<TARGET_LINKER_FILE_NAME:p3prc>" "${_libname}"
)
install(FILES "$<TARGET_LINKER_FILE_DIR:p3prc>/${_libname}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}")

View File

@ -142,7 +142,7 @@ set(P3EXPRESS_IGATEEXT
composite_sources(p3express P3EXPRESS_SOURCES) composite_sources(p3express P3EXPRESS_SOURCES)
add_component_library(p3express SYMBOL BUILDING_PANDA_EXPRESS add_component_library(p3express SYMBOL BUILDING_PANDA_EXPRESS
${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS}) ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
target_link_libraries(p3express p3pandabase p3interrogatedb p3dtoolconfig p3dtool target_link_libraries(p3express p3pandabase p3interrogatedb p3prc p3dtool
PKG::ZLIB PKG::OPENSSL) PKG::ZLIB PKG::OPENSSL)
target_interrogate(p3express ALL EXTENSIONS ${P3EXPRESS_IGATEEXT}) target_interrogate(p3express ALL EXTENSIONS ${P3EXPRESS_IGATEEXT})