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

Make libcitygml prebuilds portable #98

Open
wants to merge 3 commits into
base: master
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
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})

if(NOT DEFINED BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
endif(NOT DEFINED BIN_INSTALL_DIR)
if(NOT DEFINED LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
endif(NOT DEFINED LIB_INSTALL_DIR)
if(NOT DEFINED DATA_INSTALL_DIR)
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share")
endif(NOT DEFINED DATA_INSTALL_DIR)
Expand Down
25 changes: 10 additions & 15 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include(GenerateExportHeader)
include(GNUInstallDirs)

IF (NOT DEFINED CMAKE_MODULE_PATH)
GET_FILENAME_COMPONENT(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../CMakeModules" ABSOLUTE)
Expand Down Expand Up @@ -231,45 +232,39 @@ generate_export_header(citygml
EXPORT_FILE_NAME ${EXPORT_HEADER_FILE_NAME})

if(XercesC_FOUND)
TARGET_LINK_LIBRARIES( ${target} PUBLIC XercesC::XercesC)
TARGET_LINK_LIBRARIES( ${target} PRIVATE XercesC::XercesC)
else(XercesC_FOUND)
TARGET_LINK_LIBRARIES( ${target} PUBLIC ${XERCESC_LIBRARIES} )
TARGET_LINK_LIBRARIES( ${target} PRIVATE ${XERCESC_LIBRARIES} )
endif(XercesC_FOUND)

if(LIBCITYGML_USE_OPENGL)
TARGET_LINK_LIBRARIES( ${target} PUBLIC ${OPENGL_LIBRARIES} )
TARGET_LINK_LIBRARIES( ${target} PRIVATE ${OPENGL_LIBRARIES} )
endif(LIBCITYGML_USE_OPENGL)
if(LIBCITYGML_USE_GDAL)
TARGET_LINK_LIBRARIES( ${target} PUBLIC ${GDAL_LIBRARY} )
TARGET_LINK_LIBRARIES( ${target} PRIVATE ${GDAL_LIBRARY} )
endif(LIBCITYGML_USE_GDAL)

set_target_properties( ${target} PROPERTIES
VERSION ${META_VERSION}
SOVERSION ${META_VERSION_MAJOR}
)

if(NOT DEFINED BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
endif(NOT DEFINED BIN_INSTALL_DIR)
if(NOT DEFINED LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
endif(NOT DEFINED LIB_INSTALL_DIR)
if(NOT DEFINED INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/citygml")
endif(NOT DEFINED INCLUDE_INSTALL_DIR)

if(WIN32)
set(CONFIG_INSTALL_DIR "cmake")
else()
set(CONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/citygml")
set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/citygml")
endif()

INSTALL(
TARGETS ${target}
EXPORT citygmlConfigInternal
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT "runtime"
)
INSTALL(
Expand Down Expand Up @@ -331,7 +326,7 @@ configure_file(citygml.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/citygml.pc)

INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/citygml.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT "development"
)

6 changes: 3 additions & 3 deletions sources/citygml.pc.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=${BIN_INSTALL_DIR}
libdir=${LIB_INSTALL_DIR}
exec_prefix=${CMAKE_INSTALL_BINDIR}
libdir=${CMAKE_INSTALL_LIBDIR}
includedir=${INCLUDE_INSTALL_DIR}

Name: citygml
Description: Read and Write CityGML files
Requires: ${PKG_CONFIG_REQUIRES}
Version: ${META_VERSION}
Libs: -L${LIB_INSTALL_DIR} -lcitygml${LIBCITYGML_POSTFIX}
Libs: -L${CMAKE_INSTALL_LIBDIR} -lcitygml${LIBCITYGML_POSTFIX}
Cflags: -I${INCLUDE_INSTALL_DIR}
6 changes: 1 addition & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ IF(LIBCITYGML_USE_OPENGL)
TARGET_LINK_LIBRARIES( citygmltest citygml ${OPENGL_LIBRARIES} )
ENDIF(LIBCITYGML_USE_OPENGL)

if(NOT DEFINED BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
endif(NOT DEFINED BIN_INSTALL_DIR)

install(TARGETS citygmltest RUNTIME DESTINATION ${BIN_INSTALL_DIR})
install(TARGETS citygmltest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})


add_test(NAME berlin_open_data_sample_data COMMAND citygmltest ../../data/berlin_open_data_sample_data.citygml)
Expand Down
Loading