← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/compile_switches into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/compile_switches into lp:widelands.

Commit message:
Added command line switches for release builds and for not building translations to compile.sh.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/compile_switches/+merge/304858

Added command line switches for release builds and for not building translations to compile.sh.

This will significantly speed up development for me. We used to have them for Build18, but as annoying user input.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/compile_switches into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2016-08-05 12:32:08 +0000
+++ CMakeLists.txt	2016-09-04 07:59:32 +0000
@@ -7,6 +7,7 @@
 option(OPTION_USE_GLBINDING "Use glbinding instead of GLEW" OFF)
 option(OPTION_GLEW_STATIC "Use static GLEW Library" OFF)
 option(OPTION_BUILD_WEBSITE_TOOLS "Build website-related tools" ON)
+option(OPTION_BUILD_TRANSLATIONS "Build translations" ON)
 
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
   message(FATAL_ERROR "Build directory and source directory must not be the same.")
@@ -69,8 +70,8 @@
   find_package(GLEW REQUIRED)
 endif()
 
-if (APPLE OR WIN32 OR 
-    CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR 
+if (APPLE OR WIN32 OR
+    CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR
     CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
   if (NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
     find_package(intl REQUIRED)
@@ -250,7 +251,9 @@
 
 # Installation.
 add_subdirectory(doc)
-add_subdirectory(po)
+if(OPTION_BUILD_TRANSLATIONS)
+  add_subdirectory(po)
+endif(OPTION_BUILD_TRANSLATIONS)
 add_subdirectory(src)
 
 # install files to the correct locations here

=== modified file 'compile.sh'
--- compile.sh	2016-05-17 16:02:17 +0000
+++ compile.sh	2016-09-04 07:59:32 +0000
@@ -23,16 +23,22 @@
 
 
 ## Option to avoid building and linking website-related executables.
-NO_WEBSITE=0
+BUILD_WEBSITE="ON"
+BUILD_TRANSLATIONS="ON"
+BUILDTYPE="Debug"
 while [ "$1" != "" ]; do
-  if [ "$1" = "--no-website" -o "$1" = "-n" ]; then
-    NO_WEBSITE=1
+  if [ "$1" = "--no-website" -o "$1" = "-w" ]; then
+    BUILD_WEBSITE="OFF"
+  elif [ "$1" = "--release" -o "$1" = "-r" ]; then
+    BUILDTYPE="Release"
+  elif [ "$1" = "--no-translations" -o "$1" = "-t" ]; then
+    BUILD_TRANSLATIONS="OFF"
   fi
   shift
 done
-if [ $NO_WEBSITE -eq 0 ]; then
+if [ $BUILD_WEBSITE = "ON" ]; then
   echo "A complete build will be created."
-  echo "You can use -n or --no-website to omit building and"
+  echo "You can use -w or --no-website to omit building and"
   echo "linking website-related executables."
 else
   echo "Any website-related code will be OMITTED in the build."
@@ -40,9 +46,27 @@
   echo "build before submitting code to the repository!"
 fi
 echo " "
-echo "###########################################################"
-echo " "
-
+if [ $BUILD_TRANSLATIONS = "ON" ]; then
+  echo "Translations will be built."
+  echo "You can use -t or --no-translations to omit building them."
+else
+echo "Translations will not be built."
+fi
+echo " "
+echo "###########################################################"
+echo " "
+if [ $BUILDTYPE = "Release" ]; then
+  echo "Creating a Release build."
+else
+  echo "Creating a Debug build. Use -r to create a Release build."
+fi
+echo " "
+echo "For instructions on how to adjust options and build with"
+echo "CMake, please take a look at"
+echo "https://wl.widelands.org/wiki/BuildingWidelands/.";
+echo " "
+echo "###########################################################"
+echo " "
 
 ######################################
 # Definition of some local variables #
@@ -89,22 +113,10 @@
 
   # Compile Widelands
   compile_widelands () {
-    echo "This script produces a Debug build by default. If you want a Release build, "
-    echo "please take a look at https://wl.widelands.org/wiki/BuildingWidelands/ "
-    echo "for instructions on how to adjust options and build with CMake."
-
     if [ $buildtool = "ninja" ] || [ $buildtool = "ninja-build" ] ; then
-      if [ $NO_WEBSITE -eq 0 ]; then
-        cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug -DOPTION_BUILD_WEBSITE_TOOLS=ON
-      else
-        cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug -DOPTION_BUILD_WEBSITE_TOOLS=OFF
-      fi
+      cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$BUILDTYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS
     else
-      if [ $NO_WEBSITE -eq 0 ]; then
-        cmake .. -DCMAKE_BUILD_TYPE=Debug -DOPTION_BUILD_WEBSITE_TOOLS=ON
-      else
-        cmake .. -DCMAKE_BUILD_TYPE=Debug -DOPTION_BUILD_WEBSITE_TOOLS=OFF
-      fi
+      cmake .. -DCMAKE_BUILD_TYPE=$BUILDTYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS
     fi
 
     $buildtool


Follow ups