- attempt to add support for static use of wxwidgets in tools

This commit is contained in:
SoftCoder 2017-03-20 17:06:12 -07:00
parent 4425b7d234
commit bdfb05a700
6 changed files with 69 additions and 33 deletions

View File

@ -37,6 +37,7 @@ OPTION(BUILD_MEGAGLEST "Build MegaGlest" ON)
OPTION(BUILD_MEGAGLEST_TESTS "Build MegaGlest Unit Tests" OFF)
OPTION(WANT_SINGLE_INSTALL_DIRECTORY "Use single install directory for everything. It is useful for example for MacOS cpack bundles." OFF)
OPTION(WANT_STATIC_LIBS "Builds as many static libs as possible." OFF)
OPTION(WANT_STATIC_WX_LIBS "Builds with static wxWidgets libs if possible." OFF)
OPTION(WANT_USE_VLC "Use libVLC to play videos." ON)
OPTION(WANT_USE_OpenSSL "Use libOpenSSL during CURL linking." ON)
OPTION(WANT_USE_FriBiDi "Enable libFriBIDi support." ON)
@ -56,6 +57,7 @@ MARK_AS_ADVANCED(HELP2MAN XVFB_RUN)
include(${CMAKE_SOURCE_DIR}/mk/cmake/Modules/SpecialMacros.cmake)
include(${CMAKE_SOURCE_DIR}/mk/cmake/Modules/ReqVersAndStaticConf.cmake)
MESSAGE(STATUS "=====================================================================")
SET(PKG_NAME "megaglest")
# read version

View File

@ -9,38 +9,46 @@
IF(WANT_STATIC_LIBS)
IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST)
# shared lib
FOREACH(STATIC_LIB
OpenSSL
CURL
XercesC
LUA
JPEG
PNG
FontConfig
FTGL
GLEW
FriBiDi
Miniupnpc
Ircclient)
LIST(APPEND LIST_OF_STATIC_LIBS_MG "${STATIC_LIB}")
ENDFOREACH()
# shared lib
FOREACH(STATIC_LIB
OpenSSL
CURL
XercesC
LUA
JPEG
PNG
FontConfig
FTGL
GLEW
FriBiDi
Miniupnpc
Ircclient)
LIST(APPEND LIST_OF_STATIC_LIBS_MG "${STATIC_LIB}")
ENDFOREACH()
ENDIF()
IF(WANT_STATIC_WX_LIBS AND (BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST))
MESSAGE(STATUS "==========> wxWidgets looking for STATIC libs.")
# wxWidgets for tools
FOREACH(STATIC_LIB
wxWidgets)
LIST(APPEND LIST_OF_STATIC_LIBS_MG "${STATIC_LIB}")
ENDFOREACH()
ENDIF()
IF(BUILD_MEGAGLEST)
# only libs not used by shared lib
FOREACH(STATIC_LIB
OGG)
LIST(APPEND LIST_OF_STATIC_LIBS_MG "${STATIC_LIB}")
ENDFOREACH()
# only libs not used by shared lib
FOREACH(STATIC_LIB
OGG)
LIST(APPEND LIST_OF_STATIC_LIBS_MG "${STATIC_LIB}")
ENDFOREACH()
ENDIF()
FOREACH(STATIC_LIB ${LIST_OF_STATIC_LIBS_MG})
IF(DEFINED WANT_USE_${STATIC_LIB} AND NOT WANT_USE_${STATIC_LIB})
IF(DEFINED STATIC_${STATIC_LIB})
UNSET(STATIC_${STATIC_LIB} CACHE)
IF(DEFINED WANT_USE_${STATIC_LIB} AND NOT WANT_USE_${STATIC_LIB})
IF(DEFINED STATIC_${STATIC_LIB})
UNSET(STATIC_${STATIC_LIB} CACHE)
ENDIF()
ELSE()
OPTION("STATIC_${STATIC_LIB}" "Set to ON to link your project with static library (instead of DLL)." ON)
ENDIF()
ELSE()
OPTION("STATIC_${STATIC_LIB}" "Set to ON to link your project with static library (instead of DLL)." ON)
ENDIF()
ENDFOREACH()
ENDIF()
@ -75,6 +83,7 @@ ENDIF()
IF(STATIC_wxWidgets)
SET(wxWidgets_USE_STATIC ON)
MESSAGE(STATUS "==========> wxWidgets wanting STATIC libs.")
ENDIF()
SET(VLC_MIN_VERSION_MG "1.1.0")

View File

@ -19,6 +19,7 @@ CMAKE_ONLY=0
MAKE_ONLY=0
CLANG_FORCED=0
WANT_STATIC_LIBS="-DWANT_STATIC_LIBS=ON"
WANT_STATIC_WX_LIBS="-DWANT_STATIC_WX_LIBS=OFF"
FORCE_EMBEDDED_LIBS=0
GCC_FORCED_VERSION=0
LUA_FORCED_VERSION=0
@ -26,7 +27,7 @@ FORCE_32BIT_CROSS_COMPILE=0
COMPILATION_WITHOUT=0
BUILD_MEGAGLEST_TESTS="ON"
while getopts "c:defg:hl:mnwx" option; do
while getopts "c:defg:hl:mnswx" option; do
case "${option}" in
c)
CPU_COUNT=${OPTARG}
@ -60,6 +61,7 @@ while getopts "c:defg:hl:mnwx" option; do
echo " -l x : Force using LUA version x - example: -l 5.3"
echo " -m : Force running CMAKE only to create Make files (do not compile)"
echo " -n : Force running MAKE only to compile (assume CMAKE already built make files)"
echo " -s : Force compilation of wxWidgets STATIC libs"
echo " -w : Force compilation 'Without using wxWidgets'"
echo " -x : Force cross compiling on x64 linux to produce an x86 32 bit binary"
@ -77,6 +79,10 @@ while getopts "c:defg:hl:mnwx" option; do
;;
n)
MAKE_ONLY=1
# echo "${option} value: ${OPTARG}"
;;
s)
WANT_STATIC_WX_LIBS="-DWANT_STATIC_WX_LIBS=ON"
# echo "${option} value: ${OPTARG}"
;;
w)
@ -295,8 +301,8 @@ if [ "$COMPILATION_WITHOUT" != "0" ] && [ "$COMPILATION_WITHOUT" != "" ]; then
fi
if [ $MAKE_ONLY = 0 ]; then
echo "Calling cmake with EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON $WANT_STATIC_LIBS -DBUILD_MEGAGLEST_TESTS=$BUILD_MEGAGLEST_TESTS -DBREAKPAD_ROOT=$BREAKPAD_ROOT $EXTRA_CMAKE_OPTIONS ../../..
echo "Calling cmake with EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS} AND WANT_STATIC_LIBS = ${WANT_STATIC_LIBS} AND WANT_STATIC_WX_LIBS = ${WANT_STATIC_WX_LIBS}"
cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON $WANT_STATIC_LIBS $WANT_STATIC_WX_LIBS -DBUILD_MEGAGLEST_TESTS=$BUILD_MEGAGLEST_TESTS -DBREAKPAD_ROOT=$BREAKPAD_ROOT $EXTRA_CMAKE_OPTIONS ../../..
if [ $? -ne 0 ]; then
echo 'ERROR: CMAKE failed.' >&2; exit 1
fi

View File

@ -40,7 +40,16 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
# Optimal order most likely is gl > core > base, in some cases it may do difference.
IF(STATIC_wxWidgets)
SET(wxWidgets_USE_STATIC ON)
MESSAGE(STATUS "==========> wxWidgets wanting STATIC libs.")
ENDIF()
FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS gl core base)
IF(wxWidgets_USE_STATIC)
MESSAGE(STATUS "==========> wxWidgets using STATIC libs: ${wxWidgets_LIBRARIES}")
ELSE()
MESSAGE(STATUS "==========> wxWidgets NOT using STATIC libs: ${wxWidgets_LIBRARIES}")
ENDIF()
IF(UNIX)
# wxWidgets include (this will do all the magic to configure everything)
INCLUDE( ${wxWidgets_USE_FILE} )

View File

@ -186,14 +186,15 @@ IF(BUILD_MEGAGLEST)
menu
network
sound
steamshim
type_instances
types
world)
SET(GLEST_LIB_INCLUDE_ROOT "../shared_lib/include/")
SET(GLEST_LIB_INCLUDE_DIRS
${GLEST_LIB_INCLUDE_ROOT}compression
${GLEST_LIB_INCLUDE_ROOT}platform/common
${GLEST_LIB_INCLUDE_ROOT}compression
${GLEST_LIB_INCLUDE_ROOT}platform/common
${GLEST_LIB_INCLUDE_ROOT}platform/posix
${GLEST_LIB_INCLUDE_ROOT}util
${GLEST_LIB_INCLUDE_ROOT}graphics
@ -202,7 +203,7 @@ IF(BUILD_MEGAGLEST)
${GLEST_LIB_INCLUDE_ROOT}sound
${GLEST_LIB_INCLUDE_ROOT}sound/openal
${GLEST_LIB_INCLUDE_ROOT}xml
${GLEST_LIB_INCLUDE_ROOT}xml/rapidxml
${GLEST_LIB_INCLUDE_ROOT}xml/rapidxml
${GLEST_LIB_INCLUDE_ROOT}glew
${GLEST_LIB_INCLUDE_ROOT}lua
${GLEST_LIB_INCLUDE_ROOT}map)

View File

@ -26,7 +26,16 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
# Optimal order most likely is gl > core > base, in some cases it may do difference.
IF(STATIC_wxWidgets)
SET(wxWidgets_USE_STATIC ON)
MESSAGE(STATUS "==========> wxWidgets wanting STATIC libs.")
ENDIF()
FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS gl core base)
IF(wxWidgets_USE_STATIC)
MESSAGE(STATUS "==========> wxWidgets using STATIC libs: ${wxWidgets_LIBRARIES}")
ELSE()
MESSAGE(STATUS "==========> wxWidgets NOT using STATIC libs: ${wxWidgets_LIBRARIES}")
ENDIF()
IF(UNIX)
# wxWidgets include (this will do all the magic to configure everything)
INCLUDE( ${wxWidgets_USE_FILE} )