cleanup cmake
generated header contains compiler + some library versions (SDL,zlib,curl) add input folder where 'external' libs / headers can be placed so cmake will find them
This commit is contained in:
parent
69f87b99dd
commit
08491cc9fb
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,6 +22,10 @@ build
|
||||
# cmake generated
|
||||
OpenSpades.h
|
||||
|
||||
# cmake input dir (optional)
|
||||
Sources/Externals/include/
|
||||
Sources/Externals/lib/
|
||||
|
||||
# autotools
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
@ -1,10 +1,11 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
project(OpenSpades)
|
||||
|
||||
set(OpenSpades_VERSION_MAJOR 0)
|
||||
set(OpenSpades_VERSION_MINOR 0)
|
||||
set(OpenSpades_VERSION_REVISION 8)
|
||||
|
||||
set(CMAKE_PREFIX_PATH Sources/Externals)
|
||||
|
||||
include(FindSDL)
|
||||
if(NOT SDL_FOUND)
|
||||
@ -21,13 +22,6 @@ if(NOT GLEW_FOUND)
|
||||
message(FATAL_ERROR "GLEW not found, please install it and make sure CMake can find it (add it to the PATH)")
|
||||
endif()
|
||||
|
||||
#include(FindOpenAL)
|
||||
#if(OPENAL_FOUND)
|
||||
# set(HAVE_OPENAL TRUE)
|
||||
#else()
|
||||
# message(STATUS "OpenAL not found, set ENV{OPENALDIR} to point to OpenAL")
|
||||
#endif()
|
||||
|
||||
set(FLTK_SKIP_OPENGL TRUE)
|
||||
set(FLTK_SKIP_FORMS TRUE)
|
||||
set(FLTK_SKIP_FLUID TRUE)
|
||||
@ -118,6 +112,16 @@ if(OPENSPADES_RESDIR)
|
||||
endif()
|
||||
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID)
|
||||
if(CMAKE_CXX_COMPILER_VERSION)
|
||||
set(_version " ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
set(_version "")
|
||||
endif()
|
||||
set(OPENSPADES_COMPILER ${CMAKE_CXX_COMPILER_ID}${_version})
|
||||
endif()
|
||||
|
||||
|
||||
configure_file("${PROJECT_SOURCE_DIR}/OpenSpades.h.in" "${PROJECT_BINARY_DIR}/OpenSpades.h")
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
include_directories("${SDL_INCLUDE_DIR}")
|
||||
@ -132,21 +136,4 @@ include_directories("${CURL_INCLUDE_DIRS}")
|
||||
add_subdirectory(Resources)
|
||||
add_subdirectory(Sources)
|
||||
|
||||
#EXECUTABLE_OUTPUT_PATH
|
||||
|
||||
#if test "$prefix" = "NONE"; then
|
||||
# FLTK_CONFIG="fltk-config"
|
||||
#else
|
||||
# FLTK_CONFIG="${prefix}/bin/fltk-config"
|
||||
#fi
|
||||
|
||||
#FLTK_CFLAGS=`${FLTK_CONFIG} --cxxflags --use-images`
|
||||
#FLTK_LIBS=`${FLTK_CONFIG} --ldflags --use-images`
|
||||
|
||||
|
||||
#AC_CHECK_MEMBER(struct msghdr.msg_flags, [AC_DEFINE(HAS_MSGHDR_FLAGS)], , [#include <sys/socket.h>])
|
||||
|
||||
#AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAS_SOCKLEN_T)], ,
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#)
|
||||
|
@ -5,13 +5,17 @@
|
||||
#define OpenSpades_VERSION_MINOR @OpenSpades_VERSION_MINOR@
|
||||
#define OpenSpades_VERSION_REVISION @OpenSpades_VERSION_REVISION@
|
||||
|
||||
#define OS_STRINGIFY2(x) #x
|
||||
#define OS_STRINGIFY(x) OS_STRINGIFY2(x)
|
||||
#define OS_STRINGIFY2(x) #x
|
||||
#define OS_STRINGIFY(x) OS_STRINGIFY2(x)
|
||||
|
||||
#define OpenSpades_VER_STR "OpenSpades " OS_STRINGIFY(OpenSpades_VERSION_MAJOR) "." OS_STRINGIFY(OpenSpades_VERSION_MINOR) "." OS_STRINGIFY(OpenSpades_VERSION_REVISION)
|
||||
#define PACKAGE_STRING OpenSpades_VER_STR
|
||||
#define OpenSpades_VER_STR "OpenSpades " OS_STRINGIFY(OpenSpades_VERSION_MAJOR) "." OS_STRINGIFY(OpenSpades_VERSION_MINOR) "." OS_STRINGIFY(OpenSpades_VERSION_REVISION)
|
||||
#define PACKAGE_STRING OpenSpades_VER_STR
|
||||
|
||||
#cmakedefine HAS_OPENAL
|
||||
#define OPENSPADES_COMPILER_STR "${OPENSPADES_COMPILER}"
|
||||
|
||||
#define SDL_VERSION_STR "${SDL_VERSION_STRING}"
|
||||
#define ZLIB_VERSION_STR "${ZLIB_VERSION_STRING}"
|
||||
#define CURL_VERSION_STR "${CURL_VERSION_STRING}"
|
||||
|
||||
#cmakedefine RESDIR_DEFINED
|
||||
#define RESDIR "${RESDIR}"
|
||||
|
@ -37,8 +37,12 @@ set_target_properties(OpenSpades PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BIN
|
||||
add_dependencies(OpenSpades Angelscript Angelscript_addons)
|
||||
|
||||
if(WIN32)
|
||||
string(REGEX REPLACE "\\.lib$" ".dll" SDL_DLL ${SDL_LIBRARY})
|
||||
add_custom_command(TARGET OpenSpades POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL_DLL}" "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/")
|
||||
foreach(LIB ${SDL_LIBRARY})
|
||||
string(REGEX REPLACE "\\.lib$" ".dll" SDL_DLL ${LIB})
|
||||
if(EXISTS "${SDL_DLL}")
|
||||
add_custom_command(TARGET OpenSpades POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL_DLL}" "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/")
|
||||
endif()
|
||||
endforeach()
|
||||
add_definitions(-DCURL_STATICLIB)
|
||||
endif()
|
||||
|
||||
|
0
Sources/Externals/include/ignore
vendored
Normal file
0
Sources/Externals/include/ignore
vendored
Normal file
0
Sources/Externals/lib/ignore
vendored
Normal file
0
Sources/Externals/lib/ignore
vendored
Normal file
23
Sources/Externals/readme.txt
vendored
Normal file
23
Sources/Externals/readme.txt
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
When building (on windows) you can put dependencies in this folder.
|
||||
Headers go in the include folder (grouped by product, f.e. 'SDL', 'FL', 'curl') except for zlib, this goes directly in the include.
|
||||
Libs all go in the lib folder, without subfolders.
|
||||
|
||||
Example:
|
||||
|
||||
Externals/
|
||||
readme.txt
|
||||
include/
|
||||
zlib.h
|
||||
zconf.h
|
||||
curl/
|
||||
* all curl headers
|
||||
FL/
|
||||
* all FL headers
|
||||
SDL/
|
||||
* all SDL headers
|
||||
lib/
|
||||
zlib.lib
|
||||
libcurl.lib
|
||||
fltk.lib
|
||||
SDL.lib
|
Loading…
x
Reference in New Issue
Block a user