project(Plasma) cmake_minimum_required(VERSION 2.8.11.2) if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() # Set up Product Identification parameters set(PRODUCT_BRANCH_ID "1" CACHE STRING "Branch ID") set(PRODUCT_BUILD_ID "918" CACHE STRING "Build ID") set(PRODUCT_BUILD_TYPE "50" CACHE STRING "Build Type") set(PRODUCT_CORE_NAME "UruLive" CACHE STRING "Product Core Name") set(PRODUCT_SHORT_NAME "UruLive" CACHE STRING "Product Short Name") set(PRODUCT_LONG_NAME "Uru Live" CACHE STRING "Product Long Name") set(PRODUCT_UUID "ea489821-6c35-4bd0-9dae-bb17c585e680" CACHE STRING "Product UUID") # Configure compile-time compiler-specific flags include(cmake/CompilerChecks.cmake) # HeadSpin Configuration if(WIN32 AND NOT CYGWIN) add_definitions(-DHS_BUILD_FOR_WIN32) endif(WIN32 AND NOT CYGWIN) if(UNIX) # This is set for both Linux and Mac builds add_definitions(-DHS_BUILD_FOR_UNIX) endif(UNIX) if(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_definitions(-DHS_BUILD_FOR_OSX) endif(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-DHS_BUILD_FOR_LINUX) endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # End HeadSpin Configuration set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Plasma_BINARY_DIR}/bin) # Find all 3rd-party libraries that are required set(Python_ADDITIONAL_VERSIONS 2.7) find_package(OpenSSL REQUIRED) find_package(OpenAL REQUIRED) find_package(PythonLibs REQUIRED) find_package(EXPAT REQUIRED) find_package(ZLIB REQUIRED) find_package(JPEG REQUIRED) find_package(PNG REQUIRED) find_package(Ogg REQUIRED) #TODO: Not required if we aren't building the client find_package(Vorbis REQUIRED) #TODO: Not required if we aren't building the client find_package(Speex REQUIRED) #TODO: Not required if we aren't building the client find_package(VPX) find_package(Opus) find_package(CURL REQUIRED) find_package(Freetype) if(WIN32) find_package(PhysX REQUIRED) #TODO: Not required if we aren't building the client find_package(DirectX REQUIRED) endif(WIN32) if(VPX_FOUND AND Opus_FOUND) set(MOVIE_AVAILABLE TRUE) add_definitions(-DMOVIE_AVAILABLE) endif() include(PrecompiledHeader) #Precompiled Header helper macros if(WIN32) # libCurl isn't smart enough to detect this for us, so we have to configure it ourselves option(CURL_IS_STATIC "Using the static version of libcurl?" ON) if(CURL_IS_STATIC) add_definitions(-DCURL_STATICLIB) endif(CURL_IS_STATIC) # Same story for expat option(EXPAT_IS_STATIC "Using the static version of libexpat" ON) endif(WIN32) option(PLASMA_EXTERNAL_RELEASE "Is this release intended for the general public?" OFF) if(PLASMA_EXTERNAL_RELEASE) add_definitions(-DPLASMA_EXTERNAL_RELEASE) endif(PLASMA_EXTERNAL_RELEASE) set(PLASMA_TARGETS "Client" CACHE STRING "Which set of plasma targets to build and use") set_property(CACHE PLASMA_TARGETS PROPERTY STRINGS "Client" "Server" "Patcher" "Ethereal" "NoAvMsgs") if(PLASMA_TARGETS STREQUAL "Client") add_definitions(-DCLIENT) endif(PLASMA_TARGETS STREQUAL "Client") if(PLASMA_TARGETS STREQUAL "Patcher") add_definitions(-DPATCHER) endif(PLASMA_TARGETS STREQUAL "Patcher") if(PLASMA_TARGETS STREQUAL "Server") add_definitions(-DSERVER) endif(PLASMA_TARGETS STREQUAL "Server") if(PLASMA_TARGETS STREQUAL "NoAvMsgs") add_definitions(-DNO_AV_MSGS) endif(PLASMA_TARGETS STREQUAL "NoAvMsgs") if(PLASMA_TARGETS STREQUAL "Ethereal") add_definitions(-DSTREAM_LOGGER) endif(PLASMA_TARGETS STREQUAL "Ethereal") #Allow us to disable certain parts of the build option(PLASMA_BUILD_RESOURCE_DAT "Do we want to build resource.dat?" ON) option(PLASMA_BUILD_LAUNCHER "Do we want to build plUruLauncher?" ON) option(PLASMA_BUILD_TOOLS "Do we want to build the Plasma tools?" ON) option(PLASMA_BUILD_TESTS "Do we want to build the unit tests?" OFF) if(WIN32) option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF) else() set(3dsm_BUILD_PLUGIN OFF) endif() if(PLASMA_BUILD_TOOLS) # Custom dummy target for compiling all tools add_custom_target(tools) endif() if(3dsm_BUILD_PLUGIN) find_package(MaxSDK REQUIRED) add_definitions(-DBUILDING_MAXPLUGIN) endif(3dsm_BUILD_PLUGIN) option(USE_VLD "Build and link with Visual Leak Detector (MSVC only)" OFF) if(USE_VLD) add_definitions(-DUSE_VLD) find_package(VLD REQUIRED) include_directories(${VLD_INCLUDE_DIR}) endif(USE_VLD) include(TestBigEndian) test_big_endian(BIG_ENDIAN) if(BIG_ENDIAN) add_definitions(-DBIG_ENDIAN) else() add_definitions(-DLITTLE_ENDIAN) endif() if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_SCL_SECURE_NO_DEPRECATE) endif(MSVC) #TODO: Make the OpenSSL includes less promiscuous so this isn't needed include_directories(${OPENSSL_INCLUDE_DIR}) add_subdirectory(Sources/Plasma) add_subdirectory(Sources/Tools) if(PLASMA_BUILD_TESTS) enable_testing() add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) add_subdirectory(Sources/Tests EXCLUDE_FROM_ALL) endif(PLASMA_BUILD_TESTS)