mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fix CMake variables to allow adding SFML as a dependency.
This commit is contained in:
parent
550ef632e3
commit
13986b2a3b
@ -11,7 +11,7 @@ endif()
|
|||||||
project(SFML)
|
project(SFML)
|
||||||
|
|
||||||
# include the configuration file
|
# include the configuration file
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake)
|
||||||
|
|
||||||
# setup version numbers
|
# setup version numbers
|
||||||
set(VERSION_MAJOR 2)
|
set(VERSION_MAJOR 2)
|
||||||
@ -19,7 +19,7 @@ set(VERSION_MINOR 0)
|
|||||||
set(VERSION_PATCH 0)
|
set(VERSION_PATCH 0)
|
||||||
|
|
||||||
# add the SFML header path
|
# add the SFML header path
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
# add an option for choosing the build type (shared or static)
|
# add an option for choosing the build type (shared or static)
|
||||||
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
|
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
|
||||||
|
@ -15,8 +15,8 @@ endif()
|
|||||||
find_package(Doxygen REQUIRED)
|
find_package(Doxygen REQUIRED)
|
||||||
|
|
||||||
# set the input and output documentation paths
|
# set the input and output documentation paths
|
||||||
set(DOXYGEN_INPUT_DIR ${CMAKE_SOURCE_DIR})
|
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR})
|
||||||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc)
|
set(DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/doc)
|
||||||
|
|
||||||
# see if we can generate the CHM documentation
|
# see if we can generate the CHM documentation
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/X11)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/X11)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/X11.cpp)
|
set(SRC ${SRCROOT}/X11.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/ftp)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/ftp)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Ftp.cpp)
|
set(SRC ${SRCROOT}/Ftp.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/opengl)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/opengl)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/OpenGL.cpp)
|
set(SRC ${SRCROOT}/OpenGL.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/pong)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/pong)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Pong.cpp)
|
set(SRC ${SRCROOT}/Pong.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/shader)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/shader)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Shader.cpp)
|
set(SRC ${SRCROOT}/Shader.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/sockets)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sockets)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Sockets.cpp
|
set(SRC ${SRCROOT}/Sockets.cpp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/sound)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sound)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Sound.cpp)
|
set(SRC ${SRCROOT}/Sound.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/sound_capture)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/sound_capture)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/SoundCapture.cpp)
|
set(SRC ${SRCROOT}/SoundCapture.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/voip)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/voip)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/VoIP.cpp
|
set(SRC ${SRCROOT}/VoIP.cpp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/win32)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/win32)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Win32.cpp)
|
set(SRC ${SRCROOT}/Win32.cpp)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/examples/window)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/window)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC ${SRCROOT}/Window.cpp)
|
set(SRC ${SRCROOT}/Window.cpp)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Audio)
|
set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Audio)
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Audio)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Audio)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC
|
set(SRC
|
||||||
@ -30,11 +30,11 @@ set(SRC
|
|||||||
|
|
||||||
# let CMake know about our additional audio libraries paths (on Windows and OSX)
|
# let CMake know about our additional audio libraries paths (on Windows and OSX)
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers/AL")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/AL")
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers/libsndfile/windows")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libsndfile/windows")
|
||||||
elseif (MACOSX)
|
elseif (MACOSX)
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers/libsndfile/osx")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/libsndfile/osx")
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/libs-osx/Frameworks")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/Frameworks")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# find external libraries
|
# find external libraries
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
|
|
||||||
# include the SFML specific macros
|
# include the SFML specific macros
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/Macros.cmake)
|
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
|
||||||
|
|
||||||
# let CMake know about our additional libraries paths (on Windows and OS X)
|
# let CMake know about our additional libraries paths (on Windows and OS X)
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||||
if(COMPILER_GCC)
|
if(COMPILER_GCC)
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/libs-mingw")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw")
|
||||||
if(ARCH_32BITS)
|
if(ARCH_32BITS)
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/bin/x86")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x86")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/bin/x64")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/bin/x64")
|
||||||
endif()
|
endif()
|
||||||
elseif(COMPILER_MSVC)
|
elseif(COMPILER_MSVC)
|
||||||
if(ARCH_32BITS)
|
if(ARCH_32BITS)
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/libs-msvc/x86")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x86")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/libs-msvc/x64")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x64")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(MACOSX)
|
elseif(MACOSX)
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||||
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${CMAKE_SOURCE_DIR}/extlibs/libs-osx/lib/")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-osx/lib/")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# add the SFML sources path
|
# add the SFML sources path
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
# define the path of our additional CMake modules
|
# define the path of our additional CMake modules
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
# set the output directory for SFML libraries
|
# set the output directory for SFML libraries
|
||||||
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
|
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
|
||||||
|
|
||||||
# define the export symbol
|
# define the export symbol
|
||||||
add_definitions(-DSFML_EXPORTS)
|
add_definitions(-DSFML_EXPORTS)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Graphics)
|
set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Graphics)
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Graphics)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Graphics)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC
|
set(SRC
|
||||||
@ -55,8 +55,8 @@ set(SRC
|
|||||||
|
|
||||||
# let CMake know about our additional graphics libraries paths (on Windows and OSX)
|
# let CMake know about our additional graphics libraries paths (on Windows and OSX)
|
||||||
if (WINDOWS OR MACOSX)
|
if (WINDOWS OR MACOSX)
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers/freetype")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/freetype")
|
||||||
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${CMAKE_SOURCE_DIR}/extlibs/headers/jpeg")
|
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/extlibs/headers/jpeg")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# find external libraries
|
# find external libraries
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
# define the sfml-main target
|
# define the sfml-main target
|
||||||
add_library(sfml-main STATIC ${CMAKE_SOURCE_DIR}/src/SFML/Main/SFML_Main.cpp)
|
add_library(sfml-main STATIC ${PROJECT_SOURCE_DIR}/src/SFML/Main/SFML_Main.cpp)
|
||||||
|
|
||||||
# set the debug suffix
|
# set the debug suffix
|
||||||
set_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d)
|
set_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Network)
|
set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Network)
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Network)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Network)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC
|
set(SRC
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/System)
|
set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/System)
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/System)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/System)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC
|
set(SRC
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Window)
|
set(INCROOT ${PROJECT_SOURCE_DIR}/include/SFML/Window)
|
||||||
set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Window)
|
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Window)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC
|
set(SRC
|
||||||
|
Loading…
Reference in New Issue
Block a user