From 3aab45fcdc187d65e03d78ebf842c06759493739 Mon Sep 17 00:00:00 2001 From: Alexandre Demers Date: Fri, 18 Jun 2010 16:08:25 -0400 Subject: [PATCH] Better usage of LIB_SUFFIX Documenting a bit different sections of the CMakeFile.txt Signed-off-by: Alexandre Demers --- CMakeLists.txt | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e30b8bf505..f214371d11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,28 +29,39 @@ SET(PATCH_VERSION "0") # Find out CPU architecture ... # we could also use IF(CMAKE_SIZEOF_VOID_P EQUAL 4) to determine if it's a 32 or a 64bit arch -# Enforcing the value of LIB_SUFFIX because some distributions use it and some not when packaging, but FHS 2.3 defines it +# +# Setting the value of LIB_SUFFIX if not specified (We could build 32bit version on 64bit) +# However, some distro don't implement FHS the same way +# Suse, Redhat put 64bit libs in /lib64; Debian use /lib for 64bit, but specifies /lib32 for 32bit libs +# See FHS 2.3 for Lib directories under each architecture IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "i[3-6]86") SET(i386 1) - SET(LIB_SUFFIX "") + SET(LIB_SUFFIX "" CACHE STRING "Choose the suffix of the lib folder (if any) : None 64") ELSEIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64") SET(x86_64 1) - SET(LIB_SUFFIX "64") + SET(LIB_SUFFIX "64" CACHE STRING "Choose the suffix of the lib folder (if any) : None 64") ELSE() MESSAGE(SEND_ERROR "Platform ${CMAKE_SYSTEM_PROCESSOR} not supported") -ENDIF() +ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "i[3-6]86") # Using relative folders, cmake happens by itself CMAKE_INSTALL_PREFIX SET(BINDIR "bin") SET(DATADIR "share") SET(LIBDIR "lib${LIB_SUFFIX}") +# Setting variables SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install prefix") SET(COMPILE_LIGHTSPARK TRUE CACHE BOOL "Compile Lightspark?") SET(COMPILE_TIGHTSPARK TRUE CACHE BOOL "Compile Tightspark?") SET(COMPILE_PLUGIN FALSE CACHE BOOL "Compile the Firefox Plugin?") SET(ENABLE_SOUND TRUE CACHE BOOL "Enable sound?") SET(PLUGIN_DIRECTORY "${LIBDIR}/mozilla/plugins" CACHE STRING "Directory to install Firefox plugin to") +# We could have more complete profile options like RelWithDebInfo MinSizeRel +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release Profile Debian" + FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/conf) @@ -83,6 +94,7 @@ SET(CMAKE_SHARED_LINKER_FLAGS "-lGLEW -lrt -ldl -lpthread -Wl,--as-needed ${LLVM ENABLE_LANGUAGE(ASM-NASM) +# Compiler defaults flags for different profiles SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wnon-virtual-dtor -Woverloaded-virtual -pipe -fvisibility=hidden") SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DEXPENSIVE_DEBUG") SET(CMAKE_CXX_FLAGS_PROFILE "-g -pg -O2") @@ -96,10 +108,9 @@ IF(${i386}) SET(LIBSPARK_SOURCES ${LIBSPARK_SOURCES} fastpaths_32.asm) ELSEIF(${x86_64}) SET(LIBSPARK_SOURCES ${LIBSPARK_SOURCES} fastpaths_64.asm) -ELSE() - MESSAGE(SEND_ERROR "Platform ${CMAKE_SYSTEM_PROCESSOR} not supported") -ENDIF() +ENDIF(${i386}) +# Build instructions IF(COMPILE_PLUGIN) pkg_check_modules(GTK REQUIRED gtk+-2.0 gtkglext-1.0) INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS})