diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 100 | ||||
| -rw-r--r-- | src/apps/CMakeLists.txt | 94 | ||||
| -rw-r--r-- | src/apps/bin_cct.cmake (renamed from src/bin_cct.cmake) | 9 | ||||
| -rw-r--r-- | src/apps/bin_cs2cs.cmake (renamed from src/bin_cs2cs.cmake) | 7 | ||||
| -rw-r--r-- | src/apps/bin_geod.cmake (renamed from src/bin_geod.cmake) | 12 | ||||
| -rw-r--r-- | src/apps/bin_gie.cmake (renamed from src/bin_gie.cmake) | 9 | ||||
| -rw-r--r-- | src/apps/bin_proj.cmake (renamed from src/bin_proj.cmake) | 8 | ||||
| -rw-r--r-- | src/apps/bin_projinfo.cmake | 13 | ||||
| -rw-r--r-- | src/apps/bin_projsync.cmake | 9 | ||||
| -rw-r--r-- | src/bin_projinfo.cmake | 17 | ||||
| -rw-r--r-- | src/bin_projsync.cmake | 13 | ||||
| -rw-r--r-- | src/lib_proj.cmake | 5 | ||||
| -rw-r--r-- | src/tests/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/tests/bin_geodtest.cmake (renamed from src/bin_geodtest.cmake) | 3 |
14 files changed, 150 insertions, 153 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 752d69f3..01e06979 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,93 +1,13 @@ -# first include proj library -# always need -include(lib_proj.cmake) - -# configure executable build -option(BUILD_APPS - "Build PROJ applications (default value for BUILD_CCT, BUILD_CS2CS, etc.)" ON) - -option(BUILD_CCT - "Build cct (coordinate conversion and transformation tool)" "${BUILD_APPS}") -option(BUILD_CS2CS - "Build cs2cs (coordinate systems to coordinate systems translation tool)" "${BUILD_APPS}") -option(BUILD_GEOD - "Build geod (computation of geodesic lines)" "${BUILD_APPS}") -option(BUILD_GIE - "Build gie (geospatial integrity investigation environment)" "${BUILD_APPS}") -option(BUILD_PROJ - "Build proj (cartographic projection tool)" "${BUILD_APPS}") -option(BUILD_PROJINFO - "Build projinfo (SRS and coordinate operation metadata/query tool)" "${BUILD_APPS}") -option(BUILD_PROJSYNC - "Build projsync (synchronize transformation support data)" "${BUILD_APPS}") - -if(NOT MSVC) - - # Use relative path so that package is relocatable - if(APPLE) - set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") - set(CMAKE_INSTALL_RPATH "@loader_path/../${LIBDIR}") - else() - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${LIBDIR}") - endif() - # Other apps can link to libproj using e.g. LDFLAGS -Wl,-rpath,${prefix}/lib - -else() - - # Linking to setargv.obj enables wildcard globbing for the - # command line utilities, when compiling with MSVC - # https://docs.microsoft.com/cpp/c-language/expanding-wildcard-arguments - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} setargv.obj") - -endif() - -if(BUILD_CCT) - include(bin_cct.cmake) - set(BIN_TARGETS ${BIN_TARGETS} cct) -endif() - -if(BUILD_CS2CS) - include(bin_cs2cs.cmake) - set(BIN_TARGETS ${BIN_TARGETS} cs2cs) -endif() - -if(BUILD_GEOD) - include(bin_geod.cmake) - if(BUILD_TESTING) - include(bin_geodtest.cmake) - endif() - set(BIN_TARGETS ${BIN_TARGETS} geod) -endif() - -if(BUILD_PROJ) - include(bin_proj.cmake) - set(BIN_TARGETS ${BIN_TARGETS} binproj) -endif() - -if(BUILD_PROJINFO) - include(bin_projinfo.cmake) - set(BIN_TARGETS ${BIN_TARGETS} binprojinfo) -endif() - -# Always build gie if testing is requested -if(BUILD_GIE OR BUILD_TESTING) - include(bin_gie.cmake) - set(BIN_TARGETS ${BIN_TARGETS} gie) -endif() - -if(BUILD_PROJSYNC) - if(NOT ENABLE_CURL) - message(SEND_ERROR "projsync requires Curl") - endif() - include(bin_projsync.cmake) - set(BIN_TARGETS ${BIN_TARGETS} bin_projsync) -endif() +# Global compile options for current directory and subdirectories +add_compile_options("$<$<COMPILE_LANGUAGE:C>:${PROJ_C_WARN_FLAGS}>") +add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${PROJ_CXX_WARN_FLAGS}>") +# First configure proj library +include(lib_proj.cmake) +add_subdirectory(apps) +add_subdirectory(tests) -if(MSVC OR CMAKE_CONFIGURATION_TYPES) - if(BIN_TARGETS) - # Add _d suffix for your debug versions of the tools - set_target_properties(${BIN_TARGETS} PROPERTIES - DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) - endif() +if(APPLE) + # Directory name for installed targets + set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") endif() diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt new file mode 100644 index 00000000..0f16ef91 --- /dev/null +++ b/src/apps/CMakeLists.txt @@ -0,0 +1,94 @@ +# Configure executable builds +option(BUILD_APPS + "Build PROJ applications (default value for BUILD_CCT, BUILD_CS2CS, etc.)" + ON) + +option(BUILD_CCT + "Build cct (coordinate conversion and transformation tool)" + "${BUILD_APPS}") +option(BUILD_CS2CS + "Build cs2cs (coordinate systems to coordinate systems translation tool)" + "${BUILD_APPS}") +option(BUILD_GEOD + "Build geod (computation of geodesic lines)" + "${BUILD_APPS}") +option(BUILD_GIE + "Build gie (geospatial integrity investigation environment)" + "${BUILD_APPS}") +option(BUILD_PROJ + "Build proj (cartographic projection tool)" + "${BUILD_APPS}") +option(BUILD_PROJINFO + "Build projinfo (SRS and coordinate operation metadata/query tool)" + "${BUILD_APPS}") +option(BUILD_PROJSYNC + "Build projsync (synchronize transformation support data)" + "${BUILD_APPS}") + +if(NOT MSVC) + + # Use relative path so that package is relocatable + if(APPLE) + set(CMAKE_INSTALL_RPATH "@loader_path/../${LIBDIR}") + else() + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${LIBDIR}") + endif() + # Other apps can link to libproj using e.g. LDFLAGS -Wl,-rpath,${prefix}/lib + +else() + + # Linking to setargv.obj enables wildcard globbing for the + # command line utilities, when compiling with MSVC + # https://docs.microsoft.com/cpp/c-language/expanding-wildcard-arguments + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} setargv.obj") + +endif() + +if(BUILD_CCT) + include(bin_cct.cmake) + list(APPEND BIN_TARGETS cct) +endif() + +if(BUILD_CS2CS) + include(bin_cs2cs.cmake) + list(APPEND BIN_TARGETS cs2cs) +endif() + +if(BUILD_GEOD) + include(bin_geod.cmake) + list(APPEND BIN_TARGETS geod) +endif() + +if(BUILD_PROJ) + include(bin_proj.cmake) + list(APPEND BIN_TARGETS binproj) +endif() + +if(BUILD_PROJINFO) + include(bin_projinfo.cmake) + list(APPEND BIN_TARGETS projinfo) +endif() + +# Always build gie if testing is requested +if(BUILD_GIE OR BUILD_TESTING) + include(bin_gie.cmake) + list(APPEND BIN_TARGETS gie) +endif() + +if(BUILD_PROJSYNC) + if(NOT ENABLE_CURL) + message(SEND_ERROR "projsync requires Curl") + endif() + include(bin_projsync.cmake) + list(APPEND BIN_TARGETS projsync) +endif() + +# global configurations for all apps + +if(MSVC OR CMAKE_CONFIGURATION_TYPES) + if(BIN_TARGETS) + # Add _d suffix for debug versions of the apps + set_target_properties(${BIN_TARGETS} PROPERTIES + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) + endif() +endif() diff --git a/src/bin_cct.cmake b/src/apps/bin_cct.cmake index 85ce490c..94b0f878 100644 --- a/src/bin_cct.cmake +++ b/src/apps/bin_cct.cmake @@ -1,15 +1,14 @@ set(CCT_SRC - apps/cct.cpp - apps/proj_strtod.cpp - apps/proj_strtod.h + cct.cpp + proj_strtod.cpp + proj_strtod.h ) -set(CCT_INCLUDE apps/optargpm.h) +set(CCT_INCLUDE optargpm.h) source_group("Source Files\\Bin" FILES ${CCT_SRC}) add_executable(cct ${CCT_SRC} ${CCT_INCLUDE}) target_link_libraries(cct PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(cct PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS cct DESTINATION ${BINDIR}) diff --git a/src/bin_cs2cs.cmake b/src/apps/bin_cs2cs.cmake index bffc6503..c5e82478 100644 --- a/src/bin_cs2cs.cmake +++ b/src/apps/bin_cs2cs.cmake @@ -1,14 +1,13 @@ set(CS2CS_SRC - apps/cs2cs.cpp - apps/emess.cpp - apps/utils.cpp + cs2cs.cpp + emess.cpp + utils.cpp ) source_group("Source Files\\Bin" FILES ${CS2CS_SRC}) add_executable(cs2cs ${CS2CS_SRC} ${CS2CS_INCLUDE}) target_link_libraries(cs2cs PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(cs2cs PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS cs2cs DESTINATION ${BINDIR}) diff --git a/src/bin_geod.cmake b/src/apps/bin_geod.cmake index 6f081634..4fa41977 100644 --- a/src/bin_geod.cmake +++ b/src/apps/bin_geod.cmake @@ -1,16 +1,15 @@ set(GEOD_SRC - apps/geod.cpp - apps/geod_set.cpp - apps/geod_interface.cpp - apps/emess.cpp + geod.cpp + geod_set.cpp + geod_interface.cpp + emess.cpp ) -set(GEOD_INCLUDE apps/geod_interface.h) +set(GEOD_INCLUDE geod_interface.h) source_group("Source Files\\Bin" FILES ${GEOD_SRC} ${GEOD_INCLUDE}) add_executable(geod ${GEOD_SRC} ${GEOD_INCLUDE}) target_link_libraries(geod PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(geod PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS geod DESTINATION ${BINDIR}) @@ -39,7 +38,6 @@ else() add_executable(invgeod ${GEOD_SRC} ${GEOD_INCLUDE}) target_link_libraries(invgeod PRIVATE ${PROJ_LIBRARIES}) - target_compile_options(invgeod PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS invgeod DESTINATION ${BINDIR}) diff --git a/src/bin_gie.cmake b/src/apps/bin_gie.cmake index 853163f5..8e2d2278 100644 --- a/src/bin_gie.cmake +++ b/src/apps/bin_gie.cmake @@ -1,15 +1,14 @@ set(GIE_SRC - apps/gie.cpp - apps/proj_strtod.cpp - apps/proj_strtod.h + gie.cpp + proj_strtod.cpp + proj_strtod.h ) -set(GIE_INCLUDE apps/optargpm.h) +set(GIE_INCLUDE optargpm.h) source_group("Source Files\\Bin" FILES ${GIE_SRC}) add_executable(gie ${GIE_SRC} ${GIE_INCLUDE}) target_link_libraries(gie PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(gie PRIVATE ${PROJ_CXX_WARN_FLAGS}) if(BUILD_GIE) install(TARGETS gie diff --git a/src/bin_proj.cmake b/src/apps/bin_proj.cmake index 931f3f12..86232f59 100644 --- a/src/bin_proj.cmake +++ b/src/apps/bin_proj.cmake @@ -1,7 +1,7 @@ set(PROJ_SRC - apps/proj.cpp - apps/emess.cpp - apps/utils.cpp + proj.cpp + emess.cpp + utils.cpp ) source_group("Source Files\\Bin" FILES ${PROJ_SRC}) @@ -11,7 +11,6 @@ set_target_properties(binproj PROPERTIES RUNTIME_OUTPUT_NAME proj) target_link_libraries(binproj PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(binproj PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS binproj DESTINATION ${BINDIR}) @@ -40,7 +39,6 @@ else() add_executable(invproj ${PROJ_SRC}) target_link_libraries(invproj PRIVATE ${PROJ_LIBRARIES}) - target_compile_options(invproj PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS invproj DESTINATION ${BINDIR}) diff --git a/src/apps/bin_projinfo.cmake b/src/apps/bin_projinfo.cmake new file mode 100644 index 00000000..e5b03424 --- /dev/null +++ b/src/apps/bin_projinfo.cmake @@ -0,0 +1,13 @@ +set(PROJINFO_SRC projinfo.cpp) + +source_group("Source Files\\Bin" FILES ${PROJINFO_SRC}) + +add_executable(projinfo ${PROJINFO_SRC}) +target_link_libraries(projinfo PRIVATE ${PROJ_LIBRARIES}) + +install(TARGETS projinfo + DESTINATION ${BINDIR}) + +if(CURL_ENABLED) + target_compile_definitions(projinfo PRIVATE -DCURL_ENABLED) +endif() diff --git a/src/apps/bin_projsync.cmake b/src/apps/bin_projsync.cmake new file mode 100644 index 00000000..c51d28da --- /dev/null +++ b/src/apps/bin_projsync.cmake @@ -0,0 +1,9 @@ +set(PROJSYNC_SRC projsync.cpp) + +source_group("Source Files\\Bin" FILES ${PROJSYNC_SRC}) + +add_executable(projsync ${PROJSYNC_SRC}) +target_link_libraries(projsync PRIVATE ${PROJ_LIBRARIES}) + +install(TARGETS projsync + DESTINATION ${BINDIR}) diff --git a/src/bin_projinfo.cmake b/src/bin_projinfo.cmake deleted file mode 100644 index c2449049..00000000 --- a/src/bin_projinfo.cmake +++ /dev/null @@ -1,17 +0,0 @@ -set(PROJINFO_SRC apps/projinfo.cpp) - -source_group("Source Files\\Bin" FILES ${PROJINFO_SRC}) - -add_executable(binprojinfo ${PROJINFO_SRC}) -set_target_properties(binprojinfo - PROPERTIES - OUTPUT_NAME projinfo) -target_link_libraries(binprojinfo PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(binprojinfo PRIVATE ${PROJ_CXX_WARN_FLAGS}) - -install(TARGETS binprojinfo - DESTINATION ${BINDIR}) - -if(CURL_ENABLED) - target_compile_definitions(binprojinfo PRIVATE -DCURL_ENABLED) -endif() diff --git a/src/bin_projsync.cmake b/src/bin_projsync.cmake deleted file mode 100644 index 7ab7c43c..00000000 --- a/src/bin_projsync.cmake +++ /dev/null @@ -1,13 +0,0 @@ -set(PROJSYNC_SRC apps/projsync.cpp) - -source_group("Source Files\\Bin" FILES ${PROJSYNC_SRC}) - -add_executable(bin_projsync ${PROJSYNC_SRC}) -set_target_properties(bin_projsync - PROPERTIES - OUTPUT_NAME projsync) -target_link_libraries(bin_projsync PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(bin_projsync PRIVATE ${PROJ_CXX_WARN_FLAGS}) - -install(TARGETS bin_projsync - DESTINATION ${BINDIR}) diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index b44c9fbd..93b3f9ec 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -370,11 +370,6 @@ add_library(proj ) add_library(PROJ::proj ALIAS proj) -target_compile_options(proj - PRIVATE $<$<COMPILE_LANGUAGE:C>:${PROJ_C_WARN_FLAGS}> - PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PROJ_CXX_WARN_FLAGS}> -) - if(MSVC OR MINGW) target_compile_definitions(proj PRIVATE -DNOMINMAX) endif() diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt new file mode 100644 index 00000000..4b4f8145 --- /dev/null +++ b/src/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +# BUILD_GEOD is defined in src/apps/CMakeLists.txt +if(BUILD_TESTING AND BUILD_GEOD) + include(bin_geodtest.cmake) +endif() diff --git a/src/bin_geodtest.cmake b/src/tests/bin_geodtest.cmake index 8687a2bc..f0c26f3b 100644 --- a/src/bin_geodtest.cmake +++ b/src/tests/bin_geodtest.cmake @@ -1,11 +1,10 @@ -set(GEODTEST_SRC tests/geodtest.cpp) +set(GEODTEST_SRC geodtest.cpp) set(GEODTEST_INCLUDE) source_group("Source Files\\Bin" FILES ${GEODTEST_SRC} ${GEODTEST_INCLUDE}) add_executable(geodtest ${GEODTEST_SRC} ${GEODTEST_INCLUDE}) target_link_libraries(geodtest PRIVATE ${PROJ_LIBRARIES}) -target_compile_options(geodtest PRIVATE ${PROJ_CXX_WARN_FLAGS}) # Do not install, instead run as a test add_test(NAME geodesic-test COMMAND geodtest) |
