You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-mxe/mxe.src/openmw-2-aggresive-static.p...

164 lines
4.9 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c2047dd5..d209037c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,7 +219,7 @@ if(OSG_STATIC)
add_definitions(-DOSG_LIBRARY_STATIC)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})
- list(APPEND OPENSCENEGRAPH_LIBRARIES ${OSGPlugins_LIBRARIES})
+ list(APPEND OPENSCENEGRAPH_LIBRARIES "-Wl,-Bstatic" ${OSGPlugins_LIBRARIES})
endif()
if(QT_STATIC)
@@ -470,7 +470,7 @@ if(WIN32)
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/resources" DESTINATION "." CONFIGURATIONS Debug)
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/resources" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
-
+
FILE(GLOB plugin_dir_debug "${OpenMW_BINARY_DIR}/Debug/osgPlugins-*")
FILE(GLOB plugin_dir_release "${OpenMW_BINARY_DIR}/Release/osgPlugins-*")
INSTALL(DIRECTORY ${plugin_dir_debug} DESTINATION "." CONFIGURATIONS Debug)
@@ -837,4 +837,3 @@ if (DOXYGEN_FOUND)
WORKING_DIRECTORY ${OpenMW_BINARY_DIR}
COMMENT "Generating documentation for the github-pages at ${DOXYGEN_PAGES_OUTPUT_DIR}" VERBATIM)
endif ()
-
diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt
index 0092712db..fc29e0c0b 100644
--- a/apps/openmw/CMakeLists.txt
+++ b/apps/openmw/CMakeLists.txt
@@ -97,6 +97,8 @@ add_openmw_dir (mwbase
# Main executable
+link_libraries("-static")
+
if (NOT ANDROID)
openmw_add_executable(openmw
${OPENMW_FILES}
@@ -111,6 +113,13 @@ else ()
)
endif ()
+add_custom_command(
+ TARGET openmw
+ PRE_LINK
+ COMMAND sed 's:-Wl,-Bdynamic::g' -i /home/eater/projects/openmw-mingw/mxe/tmp-openmw-x86_64-w64-mingw32.static/openmw-openmw-0.45.0.build_/apps/openmw/CMakeFiles/openmw.dir/linklibs.rsp
+)
+
+
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
# when we change the backend.
include_directories(
@@ -118,6 +127,8 @@ include_directories(
)
target_link_libraries(openmw
+ "-Wl,-Bstatic"
+ ${OPENMW_CUSTOM_FLAGS}
${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
@@ -138,7 +149,7 @@ target_link_libraries(openmw
components
)
-if (ANDROID)
+# if (ANDROID)
set (OSG_PLUGINS
-Wl,--whole-archive
)
@@ -151,24 +162,24 @@ if (ANDROID)
)
target_link_libraries(openmw
- EGL
- android
+# EGL
+# android
log
dl
z
${OPENSCENEGRAPH_LIBRARIES}
freetype
jpeg
- png
+ png
)
-endif (ANDROID)
+# endif (ANDROID)
if (USE_SYSTEM_TINYXML)
target_link_libraries(openmw ${TinyXML_LIBRARIES})
endif()
if (NOT UNIX)
-target_link_libraries(openmw ${SDL2MAIN_LIBRARY})
+target_link_libraries(openmw "-Wl,-Bstatic" ${SDL2MAIN_LIBRARY})
endif()
# Fix for not visible pthreads functions for linker with glibc 2.15
diff --git a/cmake/FindMyGUI.cmake b/cmake/FindMyGUI.cmake
index 473f543ba..2dc820922 100644
--- a/cmake/FindMyGUI.cmake
+++ b/cmake/FindMyGUI.cmake
@@ -37,7 +37,7 @@ libfind_pkg_detect(MyGUI MyGUI${MYGUI_STATIC_SUFFIX} MYGUI${MYGUI_STATIC_SUFFIX}
HINTS $ENV{MYGUI_HOME}/lib
PATH_SUFFIXES "" release relwithdebinfo minsizerel
)
-if (MYGUI_STATIC AND (APPLE OR ANDROID))
+if (MYGUI_STATIC)
# we need explicit Freetype libs only on OS X and ANDROID for static build
libfind_package(MyGUI Freetype)
endif()
@@ -48,6 +48,8 @@ libfind_version_n_header(MyGUI
)
libfind_process(MyGUI)
+set(MyGUI_LIBRARIES "-Wl,-Bstatic" ${MyGUI_LIBRARIES})
+
if (MyGUI_Debug_FOUND)
set(MyGUI_LIBRARIES optimized ${MyGUI_LIBRARIES} debug ${MyGUI_Debug_LIBRARIES})
endif()
diff --git a/cmake/FindOSGPlugins.cmake b/cmake/FindOSGPlugins.cmake
index 2654bf5d5..e0c3af930 100644
--- a/cmake/FindOSGPlugins.cmake
+++ b/cmake/FindOSGPlugins.cmake
@@ -45,4 +45,5 @@ foreach(_dependency PNG ZLIB JPEG) # needed by osgdb_png or osgdb_jpeg
#list(APPEND OSGPlugins_PROCESS_LIBS ${_dependency}_LIBRARY)
endforeach()
+libfind_package(OSGPlugin openexr)
libfind_process(OSGPlugins)
diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index 5c245afd0..d282fa6ba 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -197,6 +197,7 @@ include_directories(${Bullet_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
target_link_libraries(components
+ "-Wl,-Bstatic"
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
@@ -218,6 +219,7 @@ target_link_libraries(components
if (WIN32)
target_link_libraries(components
+ "-Wl,-Bstatic"
${Boost_LOCALE_LIBRARY})
endif()
@@ -236,7 +238,7 @@ if (GIT_CHECKOUT)
endif (GIT_CHECKOUT)
if (WIN32)
- target_link_libraries(components shlwapi)
+ target_link_libraries(components "-Wl,-Bstatic" shlwapi)
if(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOGDI")
endif(MINGW)