Some further changes in CMakeLists
* removed DEV_BUILD autodetection (could be confusing) * ignore desktop subdirectory on Windows * some refactoringdev-ui
parent
3e989c96df
commit
81a6de41a5
|
@ -45,20 +45,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|||
# Include cmake directory with some additional scripts
|
||||
set(CMAKE_MODULE_PATH "${colobot_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Auto-detect develpment build if not given
|
||||
if(CMAKE_BUILD_TYPE AND NOT(DEV_BUILD))
|
||||
if("${CMAKE_BUILD_TYPE}" MATCHES "debug")
|
||||
SET(DEV_BUILD 1)
|
||||
else()
|
||||
SET(DEV_BUILD 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Default build type if not given is debug
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE debug)
|
||||
endif()
|
||||
|
||||
# Compiler detection
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
execute_process(
|
||||
|
@ -123,6 +109,19 @@ option(BOOST_STATIC "Link with static boost libraries" OFF)
|
|||
# This is useful on Windows, if linking against standard GLEW dll fails
|
||||
option(GLEW_STATIC "Link statically with GLEW" OFF)
|
||||
|
||||
|
||||
# Default build type if not given is debug
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Build type not specified - assuming debug")
|
||||
set(CMAKE_BUILD_TYPE debug)
|
||||
endif()
|
||||
|
||||
# Warn about development build
|
||||
if(DEV_BUILD)
|
||||
message("Building with development extensions")
|
||||
endif()
|
||||
|
||||
|
||||
##
|
||||
# Searching for packages
|
||||
##
|
||||
|
@ -143,7 +142,7 @@ find_package(Boost COMPONENTS system filesystem regex REQUIRED)
|
|||
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
if (${OPENAL_SOUND})
|
||||
if (OPENAL_SOUND)
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(LibSndFile REQUIRED)
|
||||
endif()
|
||||
|
@ -153,11 +152,11 @@ endif()
|
|||
# Platform detection and some related checks
|
||||
##
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||
set(PLATFORM_WINDOWS 1)
|
||||
set(PLATFORM_LINUX 0)
|
||||
set(PLATFORM_OTHER 0)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set(PLATFORM_WINDOWS 0)
|
||||
set(PLATFORM_LINUX 1)
|
||||
set(PLATFORM_OTHER 0)
|
||||
|
@ -167,11 +166,11 @@ else()
|
|||
set(PLATFORM_OTHER 1)
|
||||
endif()
|
||||
|
||||
if(NOT ${ASSERTS})
|
||||
if(NOT ASSERTS)
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
if(${TESTS})
|
||||
if(TESTS)
|
||||
add_definitions(-DTESTS -DTEST_VIRTUAL=virtual)
|
||||
else()
|
||||
add_definitions(-DTEST_VIRTUAL=)
|
||||
|
@ -193,9 +192,9 @@ include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
|
|||
##
|
||||
# Summary of detected things
|
||||
##
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if (PLATFORM_WINDOWS)
|
||||
message(STATUS "Build for Windows system")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
message(STATUS "Build for Linux system")
|
||||
else()
|
||||
message(STATUS "Build for other system")
|
||||
|
@ -235,7 +234,7 @@ endif()
|
|||
# Targets
|
||||
##
|
||||
|
||||
if(${TESTS})
|
||||
if(TESTS)
|
||||
# Google Test library
|
||||
find_path(GTEST_SRC_DIR NAMES src/gtest.cc src/gtest-all.cc PATHS /usr/src PATH_SUFFIXES gtest)
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h PATHS /usr/include)
|
||||
|
@ -273,8 +272,8 @@ if(${TESTS})
|
|||
endif()
|
||||
|
||||
# Installation paths defined before compiling sources
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
if (${MXE})
|
||||
if(PLATFORM_WINDOWS)
|
||||
if(MXE)
|
||||
# We need to use STRING because PATH doesn't accept relative paths
|
||||
set(COLOBOT_INSTALL_BIN_DIR ./ CACHE STRING "Colobot binary directory")
|
||||
set(COLOBOT_INSTALL_LIB_DIR ./ CACHE STRING "Colobot libraries directory")
|
||||
|
@ -301,8 +300,12 @@ add_subdirectory(src)
|
|||
|
||||
add_subdirectory(po)
|
||||
|
||||
if(${DESKTOP})
|
||||
if(DESKTOP)
|
||||
if(PLATFORM_WINDOWS)
|
||||
message("Desktop files ignored on Windows")
|
||||
else()
|
||||
add_subdirectory(desktop)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ endif()
|
|||
|
||||
# Create manpage from pod-formatted file
|
||||
find_program(POD2MAN pod2man)
|
||||
if(POD2MAN AND (NOT MSYS))
|
||||
if(POD2MAN)
|
||||
set(COLOBOT_MANPAGE_SECTION 6)
|
||||
|
||||
macro(podman)
|
||||
|
@ -75,7 +75,7 @@ endif()
|
|||
# Translate translatable material
|
||||
find_program(PO4A po4a)
|
||||
|
||||
if(PO4A AND (NOT MSYS))
|
||||
if(PO4A)
|
||||
add_custom_target(desktop_po4a
|
||||
COMMAND ${PO4A} po4a.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
|
|
@ -5,9 +5,9 @@ include_directories(. include/clipboard)
|
|||
add_definitions(-DLIB_COMPILE=1)
|
||||
|
||||
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(CLIPBOARD_SRC src/clipboardWin32.c)
|
||||
elseif (${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(CLIPBOARD_SRC src/clipboardX11.c)
|
||||
else()
|
||||
set(CLIPBOARD_SRC src/clipboardX11.c)
|
||||
|
|
|
@ -12,7 +12,7 @@ CBotVar.cpp
|
|||
CBotWhile.cpp
|
||||
)
|
||||
|
||||
if(${CBOT_STATIC})
|
||||
if(CBOT_STATIC)
|
||||
add_library(CBot STATIC ${SOURCES})
|
||||
else()
|
||||
add_library(CBot SHARED ${SOURCES})
|
||||
|
|
|
@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
|
|||
|
||||
add_subdirectory(CBot)
|
||||
|
||||
if(${TOOLS})
|
||||
if(TOOLS)
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
|
||||
|
@ -17,18 +17,18 @@ endif()
|
|||
set(OPTIONAL_LIBS "")
|
||||
set(OPTIONAL_INCLUDES "")
|
||||
|
||||
if (${OPENAL_SOUND})
|
||||
if(OPENAL_SOUND)
|
||||
set(OPTIONAL_LIBS ${OPENAL_LIBRARY})
|
||||
set(OPTIONAL_INCLUDES ${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# Additional libraries per platform
|
||||
if (${MXE}) # MXE requires special treatment
|
||||
if(MXE) # MXE requires special treatment
|
||||
set(PLATFORM_LIBS ${MXE_LIBS})
|
||||
elseif (${PLATFORM_WINDOWS})
|
||||
elseif(PLATFORM_WINDOWS)
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
# for clock_gettime
|
||||
set(PLATFORM_LIBS "-lrt -lX11")
|
||||
endif()
|
||||
|
@ -39,7 +39,7 @@ configure_file(common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h
|
|||
|
||||
set(OPENAL_SRC "")
|
||||
|
||||
if (${OPENAL_SOUND})
|
||||
if(OPENAL_SOUND)
|
||||
set(OPENAL_SRC
|
||||
sound/oalsound/alsound.cpp
|
||||
sound/oalsound/buffer.cpp
|
||||
|
@ -48,9 +48,9 @@ if (${OPENAL_SOUND})
|
|||
endif()
|
||||
|
||||
# Platform-dependent implementation of system.h
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(SYSTEM_CPP_MODULE "system_windows.cpp")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(SYSTEM_CPP_MODULE "system_linux.cpp")
|
||||
else()
|
||||
set(SYSTEM_CPP_MODULE "system_other.cpp")
|
||||
|
|
|
@ -3,9 +3,9 @@ set(SRC_DIR ${colobot_SOURCE_DIR}/src)
|
|||
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
|
||||
|
||||
# Platform-dependent implementation of system.h
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(SYSTEM_CPP_MODULE "system_windows.cpp")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(SYSTEM_CPP_MODULE "system_linux.cpp")
|
||||
else()
|
||||
set(SYSTEM_CPP_MODULE "system_other.cpp")
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
set(SRC_DIR ${colobot_SOURCE_DIR}/src)
|
||||
|
||||
# Additional libraries per platform
|
||||
if (${MXE}) # MXE requires special treatment
|
||||
if(MXE) # MXE requires special treatment
|
||||
set(PLATFORM_LIBS ${MXE_LIBS})
|
||||
elseif (${PLATFORM_WINDOWS})
|
||||
elseif(PLATFORM_WINDOWS)
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
# for clock_gettime
|
||||
set(PLATFORM_LIBS "-lrt -lX11")
|
||||
endif()
|
||||
|
@ -16,9 +16,9 @@ endif()
|
|||
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
|
||||
|
||||
# Platform-dependent implementation of system.h
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(SYSTEM_CPP_MODULE "system_windows.cpp")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(SYSTEM_CPP_MODULE "system_linux.cpp")
|
||||
else()
|
||||
set(SYSTEM_CPP_MODULE "system_other.cpp")
|
||||
|
@ -149,7 +149,7 @@ ${SRC_DIR}/ui/window.cpp
|
|||
|
||||
set(OPENAL_SOURCES "")
|
||||
|
||||
if (${OPENAL_SOUND})
|
||||
if(OPENAL_SOUND)
|
||||
set(OPENAL_SOURCES
|
||||
${SRC_DIR}/sound/oalsound/alsound.cpp
|
||||
${SRC_DIR}/sound/oalsound/buffer.cpp
|
||||
|
@ -160,16 +160,16 @@ endif()
|
|||
# Optional libraries
|
||||
set(OPTIONAL_LIBS "")
|
||||
|
||||
if (${OPENAL_SOUND})
|
||||
if(OPENAL_SOUND)
|
||||
set(OPTIONAL_LIBS ${OPENAL_LIBRARY})
|
||||
set(OPTIONAL_INCLUDES ${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
|
||||
# Platform-dependent tests
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(PLATFORM_TESTS app/system_windows_test.cpp)
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(PLATFORM_TESTS app/system_linux_test.cpp)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ ${CLIPBOARD_INCLUDE_DIR}
|
|||
)
|
||||
|
||||
# Platform-dependent implementation of CSystemUtils
|
||||
if (${PLATFORM_WINDOWS})
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(SYSTEM_CPP_MODULE "system_windows.cpp")
|
||||
elseif(${PLATFORM_LINUX})
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(SYSTEM_CPP_MODULE "system_linux.cpp")
|
||||
set(ADDITIONAL_LIB "-lX11")
|
||||
else()
|
||||
|
|
Loading…
Reference in New Issue