Add a PLATFORM_GNU global variable matching all GNU systems such as Debian's Linux, kFreeBSD and Hurd
parent
8c25650ad5
commit
343fa8f0cb
desktop
lib/clipboard
src
test/unit
|
@ -42,6 +42,7 @@ message(STATUS "Building Colobot \"${COLOBOT_VERSION_CODENAME}\" (${COLOBOT_VERS
|
|||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||
message(STATUS "Build for Windows system")
|
||||
set(PLATFORM_WINDOWS 1)
|
||||
set(PLATFORM_GNU 0)
|
||||
set(PLATFORM_LINUX 0)
|
||||
set(PLATFORM_MACOSX 0)
|
||||
set(PLATFORM_OTHER 0)
|
||||
|
@ -52,15 +53,27 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
|||
message(STATUS "Build for Linux system")
|
||||
set(PLATFORM_WINDOWS 0)
|
||||
set(PLATFORM_LINUX 1)
|
||||
set(PLATFORM_GNU 1)
|
||||
set(PLATFORM_MACOSX 0)
|
||||
set(PLATFORM_OTHER 0)
|
||||
|
||||
# Platform-dependent implementation of system.h
|
||||
set(SYSTEM_CPP_MODULE "system_linux.cpp")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "kFreeBSD" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
|
||||
message(STATUS "Build for kFreeBSD system")
|
||||
set(PLATFORM_WINDOWS 0)
|
||||
set(PLATFORM_LINUX 0)
|
||||
set(PLATFORM_GNU 1)
|
||||
set(PLATFORM_MACOSX 0)
|
||||
set(PLATFORM_OTHER 0)
|
||||
|
||||
# Platform-dependent implementation of system.h
|
||||
set(SYSTEM_CPP_MODULE "system_other.cpp")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
message(STATUS "Build for Mac OSX system")
|
||||
set(PLATFORM_WINDOWS 0)
|
||||
set(PLATFORM_LINUX 0)
|
||||
set(PLATFORM_GNU 0)
|
||||
set(PLATFORM_MACOSX 1)
|
||||
set(PLATFORM_OTHER 0)
|
||||
|
||||
|
@ -72,6 +85,7 @@ else()
|
|||
message(STATUS "Build for other system")
|
||||
set(PLATFORM_WINDOWS 0)
|
||||
set(PLATFORM_LINUX 0)
|
||||
set(PLATFORM_GNU 0)
|
||||
set(PLATFORM_MACOSX 0)
|
||||
set(PLATFORM_OTHER 1)
|
||||
|
||||
|
@ -226,7 +240,7 @@ include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
|
|||
##
|
||||
# Clipboard support needs X11 libraries
|
||||
##
|
||||
if(PLATFORM_LINUX OR PLATFORM_MACOSX)
|
||||
if(PLATFORM_GNU OR PLATFORM_MACOSX)
|
||||
find_package(X11 REQUIRED)
|
||||
if(PLATFORM_MACOSX)
|
||||
# Add the includes for X11
|
||||
|
|
|
@ -4,7 +4,7 @@ set(COLOBOT_ICON_FILE colobot.svg)
|
|||
|
||||
# Render SVG icon in various sizes
|
||||
find_program(RSVG_CONVERT rsvg-convert)
|
||||
if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
|
||||
if(RSVG_CONVERT AND (PLATFORM_GNU OR PLATFORM_MACOSX))
|
||||
add_custom_target(png-icons ALL)
|
||||
foreach(PNGSIZE 512 256 128 48 32 16)
|
||||
add_custom_command(
|
||||
|
@ -15,7 +15,7 @@ if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
|
|||
add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png)
|
||||
add_dependencies(png-icons png-icon-${PNGSIZE})
|
||||
|
||||
if(PLATFORM_LINUX)
|
||||
if(PLATFORM_GNU)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
|
||||
|
@ -37,7 +37,7 @@ if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
|
|||
|
||||
endif()
|
||||
|
||||
if(PLATFORM_LINUX)
|
||||
if(PLATFORM_GNU)
|
||||
# Install Desktop Entry file
|
||||
set(COLOBOT_DESKTOP_FILE colobot.desktop)
|
||||
add_custom_command(
|
||||
|
@ -112,7 +112,7 @@ if(PLATFORM_LINUX)
|
|||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
endif(PLATFORM_LINUX)
|
||||
endif(PLATFORM_GNU)
|
||||
|
||||
if(PLATFORM_MACOSX)
|
||||
configure_file(Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
|
||||
|
|
|
@ -7,8 +7,6 @@ add_definitions(-DLIB_COMPILE=1)
|
|||
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(CLIPBOARD_SRC src/clipboardWin32.c)
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(CLIPBOARD_SRC src/clipboardX11.c)
|
||||
else()
|
||||
set(CLIPBOARD_SRC src/clipboardX11.c)
|
||||
endif()
|
||||
|
|
|
@ -28,6 +28,8 @@ if(MXE) # MXE requires special treatment
|
|||
elseif(PLATFORM_WINDOWS)
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
elseif(PLATFORM_GNU)
|
||||
set(PLATFORM_LIBS "-lX11")
|
||||
elseif(PLATFORM_LINUX)
|
||||
# for clock_gettime
|
||||
set(PLATFORM_LIBS "-lrt -lX11")
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// Macros set by CMake
|
||||
#cmakedefine PLATFORM_WINDOWS @PLATFORM_WINDOWS@
|
||||
#cmakedefine PLATFORM_LINUX @PLATFORM_LINUX@
|
||||
#cmakedefine PLATFORM_GNU @PLATFORM_GNU@
|
||||
#cmakedefine PLATFORM_MACOSX @PLATFORM_MACOSX@
|
||||
#cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ if(MXE) # MXE requires special treatment
|
|||
elseif(PLATFORM_WINDOWS)
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
elseif(PLATFORM_GNU)
|
||||
set(PLATFORM_LIBS "-lX11")
|
||||
elseif(PLATFORM_LINUX)
|
||||
# for clock_gettime
|
||||
set(PLATFORM_LIBS "-lrt -lX11")
|
||||
|
|
|
@ -10,8 +10,6 @@ ${CLIPBOARD_INCLUDE_DIR}
|
|||
|
||||
# Platform-dependent implementation of CSystemUtils
|
||||
if(PLATFORM_WINDOWS)
|
||||
elseif(PLATFORM_LINUX)
|
||||
set(ADDITIONAL_LIB "-lX11")
|
||||
elseif(PLATFORM_MACOSX)
|
||||
set(ADDITIONAL_LIB "${X11_X11_LIB}")
|
||||
else()
|
||||
|
|
Loading…
Reference in New Issue