-
Notifications
You must be signed in to change notification settings - Fork 2.3k
geotrans/3.8 #6512
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
Merged
conan-center-bot
merged 18 commits into
conan-io:master
from
samuel-emrys:recipe/geotrans
Oct 15, 2021
Merged
geotrans/3.8 #6512
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7125ecf
Add geotrans package to close #1779
samuel-emrys 8b7c205
Modify CMake recipe to build both libraries instead of just one
samuel-emrys 6638006
Add component definitions to package_info
samuel-emrys b11f52c
Rectify errors identified by cci hooks
samuel-emrys cd1c510
Apply suggestions from code review
samuel-emrys c2f2e9e
Improve geotrans package as per code review
samuel-emrys f3ceff0
Resolve issues with suggested changes in review
samuel-emrys 3201118
Add output to inform the user about geotrans MPCCS_DATA envvar
samuel-emrys 688b378
Rectify fPIC management as per KB-H007 to address CI issues
samuel-emrys 3425370
Update recipes/geotrans/all/conanfile.py
samuel-emrys aab06b1
Remove fPIC management from config_options function
samuel-emrys 5f0fa06
Link dtcc library to ccs and remove cmake_find_package values
samuel-emrys 32dd18f
Remove -Wno-deprecated compilation flag for windows compatability
samuel-emrys 2094356
Add MSVC compatability to geotrans
samuel-emrys 14a3246
Fix windows build by exporting symbols to ensure lib is created
samuel-emrys 4e828af
Apply suggestions from code review
samuel-emrys e63a5b3
Apply changes from code review
samuel-emrys 77a972e
[geotrans] Update source URL to use JFrog Artifactory
samuel-emrys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| cmake_minimum_required(VERSION 3.8) | ||
| project(geotrans LANGUAGES CXX) | ||
| #### | ||
| # Conan | ||
| #### | ||
| include(${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake) | ||
| conan_basic_setup() | ||
|
|
||
| #### | ||
| # Directories | ||
| #### | ||
|
|
||
| set(SRC_SUBFOLDER "${CMAKE_SOURCE_DIR}/source_subfolder") | ||
| set(DTCCDIR "${SRC_SUBFOLDER}/CCS/src/dtcc/CoordinateSystems") | ||
| set(CCSERVICEDIR "${SRC_SUBFOLDER}/CCS/src") | ||
| set(SRCDIR "${SRC_SUBFOLDER}/GEOTRANS3/java_gui/geotrans3/jni") | ||
|
|
||
| #### | ||
| # Sources | ||
| #### | ||
| file(GLOB_RECURSE DTCCSRCS "${DTCCDIR}/*.cpp") | ||
| set(CCSSRCS "${CCSERVICEDIR}/CoordinateConversion/CoordinateConversionService.cpp") | ||
| file(GLOB_RECURSE CCSERVICESRCS "${CCSERVICEDIR}/dtcc/*.cpp") | ||
| list(FILTER CCSERVICESRCS EXCLUDE REGEX ".*${DTCCDIR}.*") | ||
| set(SRCS "${SRCDIR}/strtoval.cpp" "${SRCDIR}/fiomeths.cpp") | ||
|
|
||
| #### | ||
| # Includes | ||
| #### | ||
|
|
||
| # Construct DTCC includes | ||
| file(GLOB_RECURSE DTCC_HEADERS "${DTCCDIR}/*.h") | ||
| set(DTTCINCS "") | ||
| foreach(file ${DTCC_HEADERS}) | ||
| get_filename_component(DIR_PATH ${file} PATH) | ||
| set(DTTCINCS ${DTTCINCS} ${DIR_PATH}) | ||
| endforeach() | ||
| list(REMOVE_DUPLICATES DTTCINCS) | ||
|
|
||
| # Construct CCS includes. This is all headers not in DTTCINCS | ||
| file(GLOB_RECURSE CCS_HEADERS "${CCSERVICEDIR}/*.h") | ||
| set(INCS ${SRCDIR}) | ||
| foreach(file ${CCS_HEADERS}) | ||
| get_filename_component(DIR_PATH ${file} PATH) | ||
| set(INCS ${INCS} ${DIR_PATH}) | ||
| endforeach() | ||
| list(REMOVE_DUPLICATES INCS) | ||
| list(FILTER INCS EXCLUDE REGEX ".*${DTCCDIR}.*") | ||
|
|
||
| set(PUBLIC_HEADERS ${DTTC_HEADERS} ${CCS_HEADERS}) | ||
|
|
||
| #### | ||
| # Dependencies | ||
| #### | ||
|
|
||
| find_package(Threads REQUIRED) | ||
| set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
| # Create libMSPdtcc | ||
| add_library(MSPdtcc ${DTCCSRCS} ${CCSERVICESRCS}) | ||
| target_compile_features(MSPdtcc PUBLIC cxx_std_11) | ||
| if (WIN32) | ||
| add_compile_definitions(MSPdtcc PRIVATE LITTLE_ENDIAN=1) | ||
| endif(WIN32) | ||
| target_include_directories(MSPdtcc PUBLIC include ${DTTCINCS} ${INCS}) | ||
| set_target_properties(MSPdtcc PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") | ||
| target_link_libraries(MSPdtcc PRIVATE Threads::Threads) | ||
|
|
||
| # Create libMSPCoordinateConversionService | ||
| add_library(MSPCoordinateConversionService ${CCSSRCS} ${CCSERVICESRCS}) | ||
| target_compile_features(MSPCoordinateConversionService PUBLIC cxx_std_11) | ||
| target_include_directories(MSPCoordinateConversionService PUBLIC include ${DTTCINCS} ${INCS}) | ||
| set_target_properties(MSPCoordinateConversionService PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") | ||
| target_link_libraries(MSPCoordinateConversionService PUBLIC MSPdtcc) | ||
|
|
||
| include(GNUInstallDirs) | ||
| install(TARGETS MSPdtcc MSPCoordinateConversionService | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| ) | ||
| install(DIRECTORY "${SRC_SUBFOLDER}/data/" DESTINATION res) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| sources: | ||
| "3.8": | ||
| url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.8.tgz" | ||
| sha256: "BAA72D3B1AE12F237A8AD30F2DEB3FED2B80FEB759528EA0A72B4B42CB77C565" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| from conans import ConanFile, CMake, tools | ||
| import os | ||
|
|
||
|
|
||
| class GeotransConan(ConanFile): | ||
| name = "geotrans" | ||
| license = ( | ||
| "NGA GEOTRANS ToS (https://earth-info.nga.mil/php/download.php?file=wgs-terms)" | ||
| ) | ||
| url = "https://github.com/conan-io/conan-center-index" | ||
| homepage = "https://earth-info.nga.mil/" | ||
| description = "MSP GEOTRANS is the NGA and DOD approved coordinate converter and datum translator." | ||
| topics = ( | ||
| "geotrans", | ||
| "geodesic", | ||
| "geographic", | ||
| "coordinate", | ||
| "datum", | ||
| "geodetic", | ||
| "conversion", | ||
| "transformation", | ||
| ) | ||
| settings = "os", "compiler", "build_type", "arch" | ||
| options = {"shared": [True, False], "fPIC": [True, False]} | ||
| default_options = {"shared": False, "fPIC": True} | ||
| generators = "cmake" | ||
| exports_sources = "CMakeLists.txt" | ||
| _cmake = None | ||
|
|
||
| @property | ||
| def _source_subfolder(self): | ||
| return "source_subfolder" | ||
|
|
||
| @property | ||
| def _build_subfolder(self): | ||
| return "build_subfolder" | ||
|
|
||
| def config_options(self): | ||
| if self.settings.os == "Windows": | ||
| del self.options.fPIC | ||
|
|
||
|
samuel-emrys marked this conversation as resolved.
|
||
| def configure(self): | ||
| if self.options.shared: | ||
| del self.options.fPIC | ||
|
|
||
| def source(self): | ||
| tools.get( | ||
| **self.conan_data["sources"][self.version], | ||
| strip_root=True, | ||
| destination=self._source_subfolder, | ||
| filename="master.tgz" | ||
| ) | ||
|
|
||
| def _configure_cmake(self): | ||
| if self._cmake: | ||
| return self._cmake | ||
| self._cmake = CMake(self) | ||
| self._cmake.configure(build_folder=self._build_subfolder) | ||
| return self._cmake | ||
|
|
||
| def build(self): | ||
| cmake = self._configure_cmake() | ||
| cmake.build() | ||
|
|
||
| def package(self): | ||
| self.copy( | ||
| "*.txt", | ||
| dst="licenses", | ||
| src=os.path.join(self._source_subfolder, "GEOTRANS3", "docs"), | ||
| ) | ||
| cmake = self._configure_cmake() | ||
| cmake.install() | ||
|
|
||
| def package_info(self): | ||
|
samuel-emrys marked this conversation as resolved.
|
||
| mpccs_data_path = os.path.join(self.package_folder, "res") | ||
| self.output.info("Creating MPCCS_DATA environment variable: {}".format(mpccs_data_path)) | ||
| self.env_info.MPCCS_DATA = mpccs_data_path | ||
| self.cpp_info.components["dtcc"].libs = ["MSPdtcc"] | ||
| self.cpp_info.components["dtcc"].includedirs = [ | ||
| path[0] for path in os.walk("include") | ||
| ] | ||
| if self.settings.os in ["Linux", "FreeBSD"]: | ||
| self.cpp_info.components["dtcc"].system_libs.append("pthread") | ||
|
|
||
| self.cpp_info.components["ccs"].libs = ["MSPCoordinateConversionService"] | ||
| self.cpp_info.components["ccs"].requires = ["dtcc"] | ||
| self.cpp_info.components["ccs"].includedirs = [ | ||
| path[0] for path in os.walk("include") | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| cmake_minimum_required(VERSION 3.1) | ||
| project(PackageTest CXX) | ||
|
|
||
| include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
| conan_basic_setup(TARGETS) | ||
|
|
||
| find_package(geotrans REQUIRED COMPONENTS dtcc ccs) | ||
| add_executable(example example.cpp) | ||
| target_link_libraries(example geotrans::dtcc geotrans::ccs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import os | ||
| from conans import ConanFile, CMake, tools | ||
|
|
||
|
|
||
| class GeotransTestConan(ConanFile): | ||
| settings = "os", "compiler", "build_type", "arch" | ||
| generators = ( | ||
| "cmake", | ||
| "cmake_find_package", | ||
| ) | ||
|
|
||
| def build(self): | ||
| cmake = CMake(self) | ||
| cmake.configure() | ||
| cmake.build() | ||
|
|
||
| def test(self): | ||
| if not tools.cross_building(self): | ||
| # NOTE: In order to use this library, the MPCCS_DATA environment variable *must* be set. | ||
| # The path to the appropriate data directory is available in the env_info variable. This can be | ||
| # accessed from a consumer package using `self.deps_env_info["geotrans"].MPCCS_DATA. | ||
| # Alternatively, this data directory can be moved to a location of your choice from its location | ||
| # in `res`, using the `imports()` method. | ||
| # This new location can then be used as the value for the MPCCS_DATA environment variable. | ||
| with tools.environment_append( | ||
| {"MSPCCS_DATA": self.deps_env_info["geotrans"].MPCCS_DATA} | ||
| ): | ||
| bin_path = os.path.join("bin", "example") | ||
| self.run(bin_path, run_environment=True) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.