vcpkg/ports/osgearth/StaticOSG.patch
ankurverma85 5a10163c44
[osgearth] Fix x64-windows-static-md (#15375)
* osgearth:x64-windows-static-md fixes

* Try to build for x64-windows-static-md

* Fix builds

* Indent and combine blocks

* overwrite version

* merge with master and update version

* revert incorrect version changes

* [osgearth] Improve portfile.cmake, add feature tools

* update version record

* disable fontconfig on windows

* update version

* [osgearth] Fix dependencies

* [osgearth] Re-fix dependencies

* [osgearth] Fix the sequence of linking osg

* [osgearth] Fix dependency osg

* update version record

* Fix osgearth:x64-linux

* x64-windows-static-md fixes

* Fix x64-linux

* Build fixes

* Update x-add-version

Co-authored-by: ankurv <ankurv@microsoft.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2021-03-25 13:28:42 -07:00

85 lines
2.3 KiB
Diff

From 4e719ceacdc8df729f3296f62c9f50075c862967 Mon Sep 17 00:00:00 2001
From: Ankur Verma <ankur.verma@outlook.com>
Date: Sun, 27 Dec 2020 22:26:32 -0800
Subject: [PATCH] StaticOSG
---
CMakeLists.txt | 9 ++++++
CMakeModules/FindGEOS.cmake | 29 +++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 049e37e..d75a3b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -266,6 +266,15 @@ ELSE()
SET(OSGEARTH_DYNAMIC_OR_STATIC "STATIC")
ENDIF()
+IF(NOT OSGEARTH_BUILD_SHARED_LIBS)
+ ADD_DEFINITIONS(-DOSGEARTH_LIBRARY_STATIC)
+ENDIF()
+
+OPTION(OSG_IS_STATIC "Set to ON to build OSG for static linking. Use OFF for dynamic." OFF)
+IF (OSG_IS_STATIC)
+ ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
+ LINK_LIBRARIES(${CMAKE_DL_LIBS})
+ENDIF(OSG_IS_STATIC)
# OE Libraries
ADD_SUBDIRECTORY(src)
diff --git a/CMakeModules/FindGEOS.cmake b/CMakeModules/FindGEOS.cmake
index e85f922..b1bbfed 100644
--- a/CMakeModules/FindGEOS.cmake
+++ b/CMakeModules/FindGEOS.cmake
@@ -65,7 +65,7 @@ FIND_LIBRARY(GEOS_LIBRARY
)
FIND_LIBRARY(GEOS_LIBRARY_DEBUG
- NAMES geos_cd geos_i_d geosd
+ NAMES geos_cd geos_i_d
PATHS
${GEOS_DIR}/lib
$ENV{GEOS_DIR}
@@ -74,7 +74,7 @@ FIND_LIBRARY(GEOS_LIBRARY_DEBUG
)
FIND_LIBRARY(GEOS_LIBRARY_DEBUG
- NAMES geos_cd geos_i_d geosd
+ NAMES geos_cd geos_i_d
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -92,3 +92,28 @@ SET(GEOS_FOUND "NO")
IF(GEOS_LIBRARY AND GEOS_INCLUDE_DIR)
SET(GEOS_FOUND "YES")
ENDIF(GEOS_LIBRARY AND GEOS_INCLUDE_DIR)
+
+OPTION(GEOS_IS_STATIC "Set to ON to build GEOS for static linking. Use OFF for dynamic." OFF)
+IF (GEOS_IS_STATIC)
+ FIND_LIBRARY(GEOS_CXX_LIBRARY
+ NAMES geos
+ PATHS
+ ${GEOS_DIR}/lib
+ $ENV{GEOS_DIR}
+ NO_DEFAULT_PATH
+ PATH_SUFFIXES lib64 lib
+ )
+
+ FIND_LIBRARY(GEOS_CXX_LIBRARY_DEBUG
+ NAMES geosd
+ PATHS
+ ${GEOS_DIR}/lib
+ $ENV{GEOS_DIR}
+ NO_DEFAULT_PATH
+ PATH_SUFFIXES lib64 lib
+ )
+
+ set(GEOS_LIBRARY "${GEOS_LIBRARY};${GEOS_CXX_LIBRARY}" CACHE STRING "Geos Libraries" FORCE )
+ set(GEOS_LIBRARY_DEBUG "${GEOS_LIBRARY_DEBUG};${GEOS_CXX_LIBRARY_DEBUG}" CACHE STRING "Geos Debug Libraries" FORCE )
+
+ENDIF(GEOS_IS_STATIC)
--
2.29.2