Made compiler and OS variable names much clearer in CMake files
This commit is contained in:
parent
fe12270d62
commit
9b0ed300b5
@ -37,7 +37,7 @@ sfml_set_option(SFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the SFML examples,
|
||||
sfml_set_option(SFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||
|
||||
# Mac OS X specific options
|
||||
if(MACOSX)
|
||||
if(SFML_OS_MACOSX)
|
||||
# add an option to build frameworks instead of dylibs (release only)
|
||||
sfml_set_option(SFML_BUILD_FRAMEWORKS FALSE BOOL "TRUE to build SFML as frameworks libraries (release only), FALSE to build according to BUILD_SHARED_LIBS")
|
||||
|
||||
@ -54,12 +54,12 @@ if(NOT BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
|
||||
# remove SL security warnings with Visual C++
|
||||
if(COMPILER_MSVC)
|
||||
if(SFML_COMPILER_MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
# define an option for choosing between static and dynamic C runtime (Windows only)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
sfml_set_option(SFML_USE_STATIC_STD_LIBS FALSE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
|
||||
|
||||
# the following combination of flags is not valid
|
||||
@ -68,7 +68,7 @@ if(WINDOWS)
|
||||
endif()
|
||||
|
||||
# for VC++, we can apply it globally by modifying the compiler flags
|
||||
if(COMPILER_MSVC AND SFML_USE_STATIC_STD_LIBS)
|
||||
if(SFML_COMPILER_MSVC AND SFML_USE_STATIC_STD_LIBS)
|
||||
foreach(flag
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
@ -83,7 +83,7 @@ endif()
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
|
||||
# setup Mac OS X stuff
|
||||
if(MACOSX)
|
||||
if(SFML_OS_MACOSX)
|
||||
# SFML_BUILD_FRAMEWORKS needs two things :
|
||||
# first, it's available only for release
|
||||
# (because cmake currently doesn't allow specifying a custom framework name so XXX-d is not possible)
|
||||
@ -103,7 +103,7 @@ if(MACOSX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
||||
if(SFML_INSTALL_PKGCONFIG_FILES)
|
||||
@ -190,7 +190,7 @@ install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${INSTALL_MISC_DIR}/cmake
|
||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
if(ARCH_32BITS)
|
||||
install(FILES extlibs/bin/x86/libsndfile-1.dll DESTINATION bin)
|
||||
install(FILES extlibs/bin/x86/openal32.dll DESTINATION bin)
|
||||
@ -198,7 +198,7 @@ if(WINDOWS)
|
||||
install(FILES extlibs/bin/x64/libsndfile-1.dll DESTINATION bin)
|
||||
install(FILES extlibs/bin/x64/openal32.dll DESTINATION bin)
|
||||
endif()
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
|
||||
install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# detect the OS
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(WINDOWS 1)
|
||||
set(SFML_OS_WINDOWS 1)
|
||||
|
||||
# detect the architecture (note: this test won't work for cross-compilation)
|
||||
include(CheckTypeSize)
|
||||
@ -14,13 +14,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
return()
|
||||
endif()
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(LINUX 1)
|
||||
set(UNIX 1)
|
||||
set(SFML_OS_LINUX 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set(FreeBSD 1)
|
||||
set(UNIX 1)
|
||||
set(SFML_OS_FREEBSD 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(MACOSX 1)
|
||||
set(SFML_OS_MACOSX 1)
|
||||
|
||||
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
||||
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
||||
@ -40,28 +38,28 @@ endif()
|
||||
if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change,
|
||||
# but there is no other way to detect CLang at the moment
|
||||
set(COMPILER_CLANG 1)
|
||||
set(SFML_COMPILER_CLANG 1)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" SFML_CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(COMPILER_GCC 1)
|
||||
set(SFML_COMPILER_GCC 1)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
|
||||
string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
|
||||
if(${GCC_MACHINE} MATCHES ".*w64.*")
|
||||
set(COMPILER_GCC_W64 1)
|
||||
set(SFML_COMPILER_GCC_W64 1)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(COMPILER_MSVC 1)
|
||||
set(SFML_COMPILER_MSVC 1)
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
set(MSVC_VERSION 2005)
|
||||
elseif(MSVC_VERSION EQUAL 1500)
|
||||
set(MSVC_VERSION 2008)
|
||||
elseif(MSVC_VERSION EQUAL 1600)
|
||||
set(MSVC_VERSION 2010)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(MSVC_VERSION 2011)
|
||||
set(SFML_MSVC_VERSION 2005)
|
||||
elseif(SFML_MSVC_VERSION EQUAL 1500)
|
||||
set(SFML_MSVC_VERSION 2008)
|
||||
elseif(SFML_MSVC_VERSION EQUAL 1600)
|
||||
set(SFML_MSVC_VERSION 2010)
|
||||
elseif(SFML_MSVC_VERSION EQUAL 1700)
|
||||
set(SFML_MSVC_VERSION 2011)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler")
|
||||
@ -69,8 +67,8 @@ else()
|
||||
endif()
|
||||
|
||||
# define the install directory for miscellaneous files
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(INSTALL_MISC_DIR .)
|
||||
elseif(UNIX)
|
||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
|
||||
set(INSTALL_MISC_DIR share/SFML)
|
||||
endif()
|
||||
|
@ -10,12 +10,12 @@ include(CMakeParseArguments)
|
||||
# pre-link dependencies, we just "link" them so that the SFML samples can compile
|
||||
# out-of-the-box (CMake forwards the dependencies automatically)
|
||||
macro(sfml_static_add_libraries target)
|
||||
if(WINDOWS AND COMPILER_GCC)
|
||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||
# Windows - gcc
|
||||
foreach(lib ${ARGN})
|
||||
if(NOT ${lib} MATCHES ".*/.*")
|
||||
string(REGEX REPLACE "(.*)/bin/.*\\.exe" "\\1" STANDARD_LIBS_PATH "${CMAKE_CXX_COMPILER}")
|
||||
if(COMPILER_GCC_W64)
|
||||
if(SFML_COMPILER_GCC_W64)
|
||||
set(lib "${STANDARD_LIBS_PATH}/${GCC_MACHINE}/lib/lib${lib}.a")
|
||||
else()
|
||||
set(lib "${STANDARD_LIBS_PATH}/lib/lib${lib}.a")
|
||||
@ -30,14 +30,14 @@ macro(sfml_static_add_libraries target)
|
||||
COMMAND del *.o /f /q
|
||||
VERBATIM)
|
||||
endforeach()
|
||||
elseif(MSVC)
|
||||
elseif(SFML_COMPILER_MSVC)
|
||||
# Visual C++
|
||||
set(LIBRARIES "")
|
||||
foreach(lib ${ARGN})
|
||||
if(NOT ${lib} MATCHES ".*\\.lib")
|
||||
set(lib ${lib}.lib)
|
||||
endif()
|
||||
if(MSVC_IDE AND MSVC_VERSION LESS 2010)
|
||||
if(MSVC_IDE AND SFML_MSVC_VERSION LESS 2010)
|
||||
# for Visual Studio projects < 2010, we must add double quotes
|
||||
# around paths because they may contain spaces
|
||||
set(LIBRARIES "${LIBRARIES} "\\;${lib}"\\;")
|
||||
@ -72,14 +72,14 @@ macro(sfml_add_library target)
|
||||
|
||||
# adjust the output file prefix/suffix to match our conventions
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
# include the major version number in Windows shared library names (but not import library names)
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
endif()
|
||||
if (WINDOWS AND COMPILER_GCC)
|
||||
if (SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||
# on Windows/gcc get rid of "lib" prefix for shared libraries,
|
||||
# and transform the ".dll.a" suffix into ".a" for import libraries
|
||||
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||
@ -99,15 +99,15 @@ macro(sfml_add_library target)
|
||||
set_target_properties(${target} PROPERTIES FOLDER "SFML")
|
||||
|
||||
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||
if(WINDOWS AND COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
|
||||
if(NOT GCC_VERSION VERSION_LESS "4")
|
||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
|
||||
if(NOT SFML_GCC_VERSION VERSION_LESS "4")
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default
|
||||
# (exported ones are explicitely marked)
|
||||
if(NOT WINDOWS AND ((COMPILER_GCC AND NOT GCC_VERSION VERSION_LESS "4") OR (COMPILER_CLANG AND NOT CLANG_VERSION VERSION_LESS "3")))
|
||||
if(NOT SFML_OS_WINDOWS AND ((SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4") OR (SFML_COMPILER_CLANG AND NOT SFML_CLANG_VERSION VERSION_LESS "3")))
|
||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
||||
endif()
|
||||
|
||||
@ -117,7 +117,7 @@ macro(sfml_add_library target)
|
||||
endif()
|
||||
|
||||
# build frameworks or dylibs
|
||||
if(MACOSX AND BUILD_SHARED_LIBS)
|
||||
if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS)
|
||||
if(SFML_BUILD_FRAMEWORKS)
|
||||
# adapt target to build frameworks instead of dylibs
|
||||
set_target_properties(${target} PROPERTIES
|
||||
@ -168,7 +168,7 @@ macro(sfml_add_example target)
|
||||
source_group("" FILES ${THIS_SOURCES})
|
||||
|
||||
# create the target
|
||||
if(THIS_GUI_APP AND WINDOWS)
|
||||
if(THIS_GUI_APP AND SFML_OS_WINDOWS)
|
||||
add_executable(${target} WIN32 ${THIS_SOURCES})
|
||||
target_link_libraries(${target} sfml-main)
|
||||
else()
|
||||
@ -182,8 +182,8 @@ macro(sfml_add_example target)
|
||||
set_target_properties(${target} PROPERTIES FOLDER "Examples")
|
||||
|
||||
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||
if(WINDOWS AND COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
|
||||
if(NOT GCC_VERSION VERSION_LESS "4")
|
||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
|
||||
if(NOT SFML_GCC_VERSION VERSION_LESS "4")
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
# find doxygen
|
||||
if(MACOSX)
|
||||
if(SFML_OS_MACOSX)
|
||||
# Add some path to search doxygen in more directories.
|
||||
set(ADDITIONAL_PATHS
|
||||
/Developer/Applications/Doxygen.app/Contents/Resources
|
||||
@ -20,7 +20,7 @@ set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR})
|
||||
set(DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/doc)
|
||||
|
||||
# see if we can generate the CHM documentation
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
# if HHC is found, we can generate the CHM (compressed HTML) output
|
||||
find_program(DOXYGEN_HHC_PROGRAM
|
||||
NAMES hhc.exe
|
||||
|
@ -9,10 +9,10 @@ add_subdirectory(sound)
|
||||
add_subdirectory(sound_capture)
|
||||
add_subdirectory(voip)
|
||||
add_subdirectory(window)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
add_subdirectory(win32)
|
||||
elseif(LINUX)
|
||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
|
||||
add_subdirectory(X11)
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
add_subdirectory(cocoa)
|
||||
endif()
|
||||
|
@ -31,10 +31,10 @@ set(SRC
|
||||
source_group("" FILES ${SRC})
|
||||
|
||||
# let CMake know about our additional audio libraries paths (on Windows and OSX)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/AL")
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libsndfile/windows")
|
||||
elseif (MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libsndfile/osx")
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/Frameworks")
|
||||
endif()
|
||||
|
@ -3,9 +3,9 @@
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
|
||||
|
||||
# let CMake know about our additional libraries paths (on Windows and OS X)
|
||||
if (WINDOWS)
|
||||
if (SFML_OS_WINDOWS)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||
if(COMPILER_GCC)
|
||||
if(SFML_COMPILER_GCC)
|
||||
if(ARCH_32BITS)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86")
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x86")
|
||||
@ -13,14 +13,14 @@ if (WINDOWS)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64")
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x64")
|
||||
endif()
|
||||
elseif(COMPILER_MSVC)
|
||||
elseif(SFML_COMPILER_MSVC)
|
||||
if(ARCH_32BITS)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x86")
|
||||
elseif(ARCH_64BITS)
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x64")
|
||||
endif()
|
||||
endif()
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/lib/")
|
||||
endif()
|
||||
@ -40,6 +40,6 @@ add_subdirectory(Window)
|
||||
add_subdirectory(Network)
|
||||
add_subdirectory(Graphics)
|
||||
add_subdirectory(Audio)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
add_subdirectory(Main)
|
||||
endif()
|
||||
|
@ -84,14 +84,14 @@ set(STB_SRC
|
||||
source_group("stb_image" FILES ${STB_SRC})
|
||||
|
||||
# let CMake know about our additional graphics libraries paths (on Windows and OSX)
|
||||
if(WINDOWS OR MACOSX)
|
||||
if(SFML_OS_WINDOWS OR SFML_OS_MACOSX)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/jpeg")
|
||||
endif()
|
||||
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libfreetype/windows")
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libfreetype/windows/freetype")
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libfreetype/osx")
|
||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libfreetype/osx/freetype2")
|
||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/Frameworks")
|
||||
@ -102,7 +102,7 @@ find_package(OpenGL REQUIRED)
|
||||
find_package(Freetype REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX)
|
||||
find_package(X11 REQUIRED)
|
||||
endif()
|
||||
|
||||
@ -114,7 +114,7 @@ include_directories(${FREETYPE_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${JPEG_INCLUDE
|
||||
set(GRAPHICS_EXT_LIBS ${FREETYPE_LIBRARY} ${GLEW_LIBRARY} ${JPEG_LIBRARY})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(GRAPHICS_EXT_LIBS ${GRAPHICS_EXT_LIBS} ${OPENGL_gl_LIBRARY})
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX)
|
||||
set(GRAPHICS_EXT_LIBS ${GRAPHICS_EXT_LIBS} ${X11_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
@ -124,7 +124,7 @@ add_definitions(-DGLEW_STATIC -DSTBI_FAILURE_USERMSG)
|
||||
|
||||
# ImageLoader.cpp must be compiled with the -fno-strict-aliasing
|
||||
# when gcc is used; otherwise saving PNGs may crash in stb_image_write
|
||||
if(COMPILER_GCC)
|
||||
if(SFML_OS_COMPILER_GCC)
|
||||
set_source_files_properties(${SRCROOT}/ImageLoader.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
|
||||
endif()
|
||||
|
||||
|
@ -28,7 +28,7 @@ set(SRC
|
||||
)
|
||||
|
||||
# add platform specific sources
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(SRC
|
||||
${SRC}
|
||||
${SRCROOT}/Win32/SocketImpl.cpp
|
||||
@ -46,7 +46,7 @@ source_group("" FILES ${SRC})
|
||||
|
||||
# build the list of external libraries to link
|
||||
set(NETWORK_EXT_LIBS)
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(NETWORK_EXT_LIBS ${NETWORK_EXT_LIBS} ws2_32)
|
||||
endif()
|
||||
|
||||
|
@ -39,7 +39,7 @@ set(SRC
|
||||
source_group("" FILES ${SRC})
|
||||
|
||||
# add platform specific sources
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(PLATFORM_SRC
|
||||
${SRCROOT}/Win32/ClockImpl.cpp
|
||||
${SRCROOT}/Win32/ClockImpl.hpp
|
||||
@ -71,13 +71,13 @@ endif()
|
||||
|
||||
# build the list of external libraries to link
|
||||
set(SYSTEM_EXT_LIBS)
|
||||
if(UNIX)
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
|
||||
set(SYSTEM_EXT_LIBS ${SYSTEM_EXT_LIBS} pthread)
|
||||
endif()
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX)
|
||||
set(SYSTEM_EXT_LIBS ${SYSTEM_EXT_LIBS} rt)
|
||||
endif()
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(SYSTEM_EXT_LIBS ${SYSTEM_EXT_LIBS} winmm)
|
||||
endif()
|
||||
|
||||
|
@ -36,7 +36,7 @@ set(SRC
|
||||
source_group("" FILES ${SRC})
|
||||
|
||||
# add platform specific sources
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(PLATFORM_SRC
|
||||
${SRCROOT}/Win32/WglContext.cpp
|
||||
${SRCROOT}/Win32/WglContext.hpp
|
||||
@ -52,7 +52,7 @@ if(WINDOWS)
|
||||
|
||||
# make sure that we use the Unicode version of the Win API functions
|
||||
add_definitions(-DUNICODE)
|
||||
elseif(UNIX)
|
||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
|
||||
set(PLATFORM_SRC
|
||||
${SRCROOT}/Unix/Display.cpp
|
||||
${SRCROOT}/Unix/Display.hpp
|
||||
@ -64,13 +64,13 @@ elseif(UNIX)
|
||||
${SRCROOT}/Unix/WindowImplX11.cpp
|
||||
${SRCROOT}/Unix/WindowImplX11.hpp
|
||||
)
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX)
|
||||
set(PLATFORM_SRC
|
||||
${PLATFORM_SRC}
|
||||
${SRCROOT}/Unix/JoystickImpl.cpp
|
||||
${SRCROOT}/Unix/JoystickImpl.hpp
|
||||
)
|
||||
elseif(FREEBSD)
|
||||
elseif(SFML_OS_FREEBSD)
|
||||
set(PLATFORM_SRC
|
||||
${PLATFORM_SRC}
|
||||
${SRCROOT}/FreeBSD/JoystickImpl.cpp
|
||||
@ -78,7 +78,7 @@ elseif(UNIX)
|
||||
)
|
||||
endif()
|
||||
source_group("unix" FILES ${PLATFORM_SRC})
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
set(PLATFORM_SRC
|
||||
${SRCROOT}/OSX/cpp_objc_conversion.h
|
||||
${SRCROOT}/OSX/cpp_objc_conversion.mm
|
||||
@ -123,7 +123,7 @@ endif()
|
||||
# find external libraries
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
if(LINUX)
|
||||
if(SFML_OS_LINUX)
|
||||
find_package(X11 REQUIRED)
|
||||
if(NOT X11_Xrandr_FOUND)
|
||||
message(FATAL_ERROR "Xrandr library not found")
|
||||
@ -133,14 +133,14 @@ endif()
|
||||
|
||||
# build the list of external libraries to link
|
||||
set(WINDOW_EXT_LIBS ${OPENGL_gl_LIBRARY})
|
||||
if(WINDOWS)
|
||||
if(SFML_OS_WINDOWS)
|
||||
set(WINDOW_EXT_LIBS ${WINDOW_EXT_LIBS} winmm gdi32)
|
||||
elseif(LINUX)
|
||||
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
|
||||
set(WINDOW_EXT_LIBS ${WINDOW_EXT_LIBS} ${X11_X11_LIB} ${X11_Xrandr_LIB})
|
||||
if(FREEBSD)
|
||||
if(SFML_OS_FREEBSD)
|
||||
set(WINDOW_EXT_LIBS ${WINDOW_EXT_LIBS} usbhid)
|
||||
endif()
|
||||
elseif(MACOSX)
|
||||
elseif(SFML_OS_MACOSX)
|
||||
set(WINDOW_EXT_LIBS ${WINDOW_EXT_LIBS} "-framework Foundation -framework AppKit -framework IOKit -framework Carbon")
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user