From 93fcab952b28f4db39d9326b83f14cbd86c0cf17 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Fri, 27 Feb 2015 18:05:29 -0500 Subject: Clean up and tweak build system * Combine client and server man pages. * Update unit test options and available databases in man page. * Add `--worldname` to man page. * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`. * Disable server build by default on all operating systems. * Make `ENABLE_FREETYPE` not fail if FreeType isn't found. * Enable LevelDB, Redis, and FreeType detection by default. * Remove the `VERSION_PATCH_ORIG` hack. * Add option to search for and use system JSONCPP. * Remove broken LuaJIT version detection. * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`. * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`. * Clean up style of CMake files. --- src/CMakeLists.txt | 464 +++++++++++++++++++++-------------------------------- 1 file changed, 180 insertions(+), 284 deletions(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2ce108681..b33bea87b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,8 @@ -project(minetest) -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required(VERSION 2.6) + +project(Minetest) +string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) -INCLUDE(CheckCSourceRuns) INCLUDE(CheckIncludeFiles) # Add custom SemiDebug build mode @@ -22,83 +23,69 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING FORCE ) + # Set some random things default to not being visible in the GUI mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) -option(ENABLE_CURL "Enable cURL support for fetching media" 1) -if (NOT ENABLE_CURL) - mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR) -endif(NOT ENABLE_CURL) +option(ENABLE_CURL "Enable cURL support for fetching media" TRUE) +set(USE_CURL FALSE) -if( ENABLE_CURL ) +if(ENABLE_CURL) find_package(CURL) -endif( ENABLE_CURL ) -set(USE_CURL 0) -if (CURL_FOUND AND ENABLE_CURL) - message(STATUS "cURL support enabled") - set(USE_CURL 1) -endif(CURL_FOUND AND ENABLE_CURL) + if (CURL_FOUND) + message(STATUS "cURL support enabled.") + set(USE_CURL TRUE) + endif() +else() + mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR) +endif() -# user-visible option to enable/disable gettext usage -OPTION(ENABLE_GETTEXT "Use GetText for internationalization" 0) -# this is only set to 1 if gettext is enabled _and_ available -set(USE_GETTEXT 0) +option(ENABLE_GETTEXT "Use GetText for internationalization" FALSE) +set(USE_GETTEXT FALSE) if(ENABLE_GETTEXT) find_package(GettextLib) + if(GETTEXT_FOUND) + if(WIN32) + message(STATUS "GetText library: ${GETTEXT_LIBRARY}") + message(STATUS "GetText DLL: ${GETTEXT_DLL}") + message(STATUS "GetText iconv DLL: ${GETTEXT_ICONV_DLL}") + endif() + set(USE_GETTEXT TRUE) + message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") + endif(GETTEXT_FOUND) else() - MARK_AS_ADVANCED(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT) + mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT) + message(STATUS "GetText disabled.") endif() -if(GETTEXT_FOUND AND ENABLE_GETTEXT) - message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}") - message(STATUS "gettext msgfmt path: ${GETTEXT_MSGFMT}") - if(WIN32) - message(STATUS "gettext library: ${GETTEXT_LIBRARY}") - message(STATUS "gettext dll: ${GETTEXT_DLL}") - message(STATUS "gettext iconv dll: ${GETTEXT_ICONV_DLL}") - endif() - set(USE_GETTEXT 1) - message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}") -elseif(GETTEXT_FOUND AND NOT ENABLE_GETTEXT) - MESSAGE(STATUS "GetText found but disabled;") -else(GETTEXT_FOUND AND ENABLE_GETTEXT) - message(STATUS "GetText disabled") -endif(GETTEXT_FOUND AND ENABLE_GETTEXT) - -# user visible option to enable/disable sound -OPTION(ENABLE_SOUND "Enable sound" ON) - -# this is only set to 1 if sound is enabled _and_ available -set(USE_SOUND 0) -set(SOUND_PROBLEM 0) - -if(ENABLE_SOUND AND BUILD_CLIENT) + +option(ENABLE_SOUND "Enable sound" TRUE) +set(USE_SOUND FALSE) + +if(BUILD_CLIENT AND ENABLE_SOUND) # Sound libraries find_package(OpenAL) find_package(Vorbis) if(NOT OPENAL_FOUND) message(STATUS "Sound enabled, but OpenAL not found!") - set(SOUND_PROBLEM 1) - MARK_AS_ADVANCED(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR) + mark_as_advanced(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR) endif() if(NOT VORBIS_FOUND) message(STATUS "Sound enabled, but Vorbis libraries not found!") - set(SOUND_PROBLEM 1) - MARK_AS_ADVANCED(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) + mark_as_advanced(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) endif() if(OPENAL_FOUND AND VORBIS_FOUND) - set(USE_SOUND 1) - message(STATUS "Sound enabled") + set(USE_SOUND TRUE) + message(STATUS "Sound enabled.") + else() + message(FATAL_ERROR "Sound enabled, but cannot be used.\n" + "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)") endif() -endif(ENABLE_SOUND AND BUILD_CLIENT) - -if(SOUND_PROBLEM) - message(FATAL_ERROR "Sound enabled, but cannot be used.\n" - "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)") endif() + if(USE_SOUND) set(sound_SRCS sound_openal.cpp) set(SOUND_INCLUDE_DIRS @@ -112,18 +99,87 @@ if(USE_SOUND) ) endif() -option(ENABLE_FREETYPE "Enable freetype2 (truetype fonts and basic unicode support)" OFF) -set(USE_FREETYPE 0) + +option(ENABLE_GLES "Enable OpenGL ES support" FALSE) +mark_as_advanced(ENABLE_GLES) +if(ENABLE_GLES) + find_package(OpenGLES2) +endif() + + +option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode support)" TRUE) +set(USE_FREETYPE FALSE) + if(ENABLE_FREETYPE) - set(USE_FREETYPE 1) + if(UNIX) + include(FindPkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(FREETYPE QUIET freetype2) + if(FREETYPE_FOUND) + SET(FREETYPE_PKGCONFIG_FOUND TRUE) + SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES}) + # Because CMake is idiotic + string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS}) + string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS}) + endif(FREETYPE_FOUND) + endif(PKG_CONFIG_FOUND) + endif(UNIX) + if(NOT FREETYPE_FOUND) + find_package(Freetype) + endif() + if(FREETYPE_FOUND) + set(USE_FREETYPE TRUE) + set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont") + set(CGUITTFONT_LIBRARY cguittfont) + endif() endif(ENABLE_FREETYPE) + +find_package(Lua REQUIRED) + + +option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE) +set(USE_LEVELDB FALSE) + +if(ENABLE_LEVELDB) + find_library(LEVELDB_LIBRARY leveldb) + find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb) + if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR) + set(USE_LEVELDB TRUE) + message(STATUS "LevelDB backend enabled.") + include_directories(${LEVELDB_INCLUDE_DIR}) + else() + message(STATUS "LevelDB not found!") + endif() +endif(ENABLE_LEVELDB) + + +OPTION(ENABLE_REDIS "Enable Redis backend" TRUE) +set(USE_REDIS FALSE) + +if(ENABLE_REDIS) + find_library(REDIS_LIBRARY hiredis) + find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis) + if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) + set(USE_REDIS TRUE) + message(STATUS "Redis backend enabled.") + include_directories(${REDIS_INCLUDE_DIR}) + else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) + message(STATUS "Redis not found!") + endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) +endif(ENABLE_REDIS) + + +find_package(SQLite3 REQUIRED) +find_package(Json REQUIRED) + + if(NOT MSVC) - set(USE_GPROF 0 CACHE BOOL "Use -pg flag for g++") + set(USE_GPROF FALSE CACHE BOOL "Use -pg flag for g++") endif() # Use cmake_config.h -add_definitions ( -DUSE_CMAKE_CONFIG_H ) +add_definitions(-DUSE_CMAKE_CONFIG_H) if(WIN32) # Windows @@ -150,7 +206,7 @@ if(WIN32) CACHE PATH "freetype include dir") set(FREETYPE_LIBRARY "${PROJECT_SOURCE_DIR}/../../freetype2/objs/win32/vc2005/freetype247.lib" CACHE FILEPATH "Path to freetype247.lib") - endif(USE_FREETYPE) + endif() if(ENABLE_SOUND) set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL32.dll for installation (optional)") set(OGG_DLL "" CACHE FILEPATH "Path to libogg.dll for installation (optional)") @@ -166,9 +222,9 @@ else() find_package(BZip2 REQUIRED) find_package(PNG REQUIRED) if(APPLE) - FIND_LIBRARY(CARBON_LIB Carbon) - FIND_LIBRARY(COCOA_LIB Cocoa) - FIND_LIBRARY(IOKIT_LIB IOKit) + find_library(CARBON_LIB Carbon) + find_library(COCOA_LIB Cocoa) + find_library(IOKIT_LIB IOKit) mark_as_advanced( CARBON_LIB COCOA_LIB @@ -191,156 +247,14 @@ else() set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY}) endif() -find_package(SQLite3 REQUIRED) -find_package(Json REQUIRED) - -option(ENABLE_GLES "Enable OpenGL ES support" 0) -mark_as_advanced(ENABLE_GLES) -if(ENABLE_GLES) - find_package(OpenGLES2) -endif(ENABLE_GLES) - -if(USE_FREETYPE) - if(UNIX) - include(FindPkgConfig) - if(PKG_CONFIG_FOUND) - pkg_check_modules(FREETYPE QUIET freetype2) - if(FREETYPE_FOUND) - SET(FREETYPE_PKGCONFIG_FOUND TRUE) - SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES}) - # because cmake is idiotic - string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS}) - string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS}) - endif(FREETYPE_FOUND) - endif(PKG_CONFIG_FOUND) - endif(UNIX) - if(NOT FREETYPE_FOUND) - find_package(Freetype REQUIRED) - endif(NOT FREETYPE_FOUND) - set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont") - set(CGUITTFONT_LIBRARY cguittfont) -endif(USE_FREETYPE) - -if (NOT DISABLE_LUAJIT) - find_library(LUA_LIBRARY luajit - NAMES luajit-5.1) - find_path(LUA_INCLUDE_DIR luajit.h - NAMES luajit.h - PATH_SUFFIXES luajit-2.0) - message (STATUS "LuaJIT library: ${LUA_LIBRARY}") - message (STATUS "LuaJIT headers: ${LUA_INCLUDE_DIR}") -else (NOT ${DISABLE_LUAJIT} MATCHES "1") - message (STATUS "LuaJIT detection disabled! (DISABLE_LUAJIT=1)") - set(LUA_LIBRARY "") - set(LUA_INCLUDE_DIR "") -endif (NOT DISABLE_LUAJIT) - -set(USE_LUAJIT 0) -if(LUA_LIBRARY AND LUA_INCLUDE_DIR) - message (STATUS "LuaJIT found, checking for broken versions...") - if(CMAKE_CROSSCOMPILING) - message(WARNING "Cross-compiling enabled, assuming LuaJIT is not broken") - set(VALID_LUAJIT_VERSION 1) - else(CMAKE_CROSSCOMPILING) - set(BACKUP_REQUIRED_INCS CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${LUA_INCLUDE_DIR}") - CHECK_C_SOURCE_RUNS(" - #include - #include - #include - - #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0])) - - static char *broken_luajit_versions[] = { - \"LuaJIT 2.0.0-beta7\", - \"LuaJIT 2.0.0-beta6\", - \"LuaJIT 2.0.0-beta5\", - \"LuaJIT 2.0.0-beta4\", - \"LuaJIT 2.0.0-beta3\", - \"LuaJIT 2.0.0-beta2\", - \"LuaJIT 2.0.0-beta1\" - }; - - int main(int argc, char *argv[]) { - unsigned int i; - for (i = 0; i < ARRAYSIZE(broken_luajit_versions); i++) { - if (strcmp(LUAJIT_VERSION, broken_luajit_versions[i]) == 0) { - return 1; - } - } - return 0; - } - " - VALID_LUAJIT_VERSION) - set(CMAKE_REQUIRED_INCLUDES BACKUP_REQUIRED_INCS) - endif(CMAKE_CROSSCOMPILING) - if (VALID_LUAJIT_VERSION) - message (STATUS "LuaJIT version ok") - set(USE_LUAJIT 1) - else (VALID_LUAJIT_VERSION) - message (STATUS "LuaJIT versions till 2.0.0beta7 known to be broken, update to at least beta8") - set(USE_LUAJIT 0) - endif (VALID_LUAJIT_VERSION) -endif (LUA_LIBRARY AND LUA_INCLUDE_DIR) - -if(NOT USE_LUAJIT) - message (STATUS "LuaJIT not found, using bundled Lua.") - set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src") - set(LUA_LIBRARY "lua") - add_subdirectory(lua) -endif(NOT USE_LUAJIT) - -mark_as_advanced(LUA_LIBRARY) -mark_as_advanced(LUA_INCLUDE_DIR) - -set(USE_LEVELDB 0) - -OPTION(ENABLE_LEVELDB "Enable LevelDB backend") - -if(ENABLE_LEVELDB) - find_library(LEVELDB_LIBRARY leveldb) - find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb) - message (STATUS "LevelDB library: ${LEVELDB_LIBRARY}") - message (STATUS "LevelDB headers: ${LEVELDB_INCLUDE_DIR}") - if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR) - set(USE_LEVELDB 1) - message(STATUS "LevelDB backend enabled") - include_directories(${LEVELDB_INCLUDE_DIR}) - else(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR) - set(USE_LEVELDB 0) - message(STATUS "LevelDB not found!") - endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR) -endif(ENABLE_LEVELDB) - -set(USE_REDIS 0) - -OPTION(ENABLE_REDIS "Enable redis backend" 0) - -if(ENABLE_REDIS) - find_library(REDIS_LIBRARY hiredis) - find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis) - message(STATUS "redis library: ${REDIS_LIBRARY}") - message(STATUS "redis headers: ${REDIS_INCLUDE_DIR}") - if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) - set(USE_REDIS 1) - message(STATUS "redis backend enabled") - include_directories(${REDIS_INCLUDE_DIR}) - else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) - set(USE_REDIS 0) - message(STATUS "redis not found!") - endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR) -endif(ENABLE_REDIS) - -CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H) -if(NOT HAVE_ENDIAN_H) - set(HAVE_ENDIAN_H 0) -endif(NOT HAVE_ENDIAN_H) +check_include_files(endian.h HAVE_ENDIAN_H) configure_file( "${PROJECT_SOURCE_DIR}/cmake_config.h.in" "${PROJECT_BINARY_DIR}/cmake_config.h" ) + # Add a target that always rebuilds cmake_config_githash.h add_custom_target(GenerateVersion COMMAND ${CMAKE_COMMAND} @@ -351,11 +265,13 @@ add_custom_target(GenerateVersion -P "${CMAKE_SOURCE_DIR}/cmake/Modules/GenerateVersion.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + add_subdirectory(jthread) add_subdirectory(network) add_subdirectory(script) add_subdirectory(util) + set (unittests_SRCS test.cpp ) @@ -437,9 +353,10 @@ set(common_SRCS ${unittests_SRCS} ) + # This gives us the icon and file version information if(WIN32) - set(WINRESOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc) + set(WINRESOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc") if(MINGW) if(NOT CMAKE_RC_COMPILER) set(CMAKE_RC_COMPILER "windres.exe") @@ -456,16 +373,16 @@ if(WIN32) endif(MINGW) endif() -# Client sources +# Client sources if (BUILD_CLIENT) add_subdirectory(client) endif(BUILD_CLIENT) -set(minetest_SRCS +set(client_SRCS + ${client_SRCS} ${common_SRCS} ${sound_SRCS} - ${client_SRCS} ${client_network_SRCS} camera.cpp chat.cpp @@ -500,16 +417,16 @@ set(minetest_SRCS shader.cpp sky.cpp wieldmesh.cpp - ${minetest_SCRIPT_SRCS} + ${client_SCRIPT_SRCS} ) -list(SORT minetest_SRCS) +list(SORT client_SRCS) # Server sources -set(minetestserver_SRCS +set(server_SRCS ${common_SRCS} main.cpp ) -list(SORT minetestserver_SRCS) +list(SORT server_SRCS) include_directories( ${PROJECT_BINARY_DIR} @@ -526,26 +443,24 @@ include_directories( ${PROJECT_SOURCE_DIR}/script ) + if(USE_FREETYPE) - include_directories( - ${FREETYPE_INCLUDE_DIRS} - ${CGUITTFONT_INCLUDE_DIR} - ) -endif(USE_FREETYPE) + include_directories(${FREETYPE_INCLUDE_DIRS} ${CGUITTFONT_INCLUDE_DIR}) +endif() if(USE_CURL) - include_directories( - ${CURL_INCLUDE_DIR} - ) -endif(USE_CURL) + include_directories(${CURL_INCLUDE_DIR}) +endif() + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin") + if(BUILD_CLIENT) - add_executable(${PROJECT_NAME} ${minetest_SRCS}) - add_dependencies(${PROJECT_NAME} GenerateVersion) - set(minetest_LIBS - ${PROJECT_NAME} + add_executable(${PROJECT_NAME_LOWER} ${client_SRCS}) + add_dependencies(${PROJECT_NAME_LOWER} GenerateVersion) + set(client_LIBS + ${PROJECT_NAME_LOWER} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${OPENGL_LIBRARIES} @@ -564,46 +479,47 @@ if(BUILD_CLIENT) ) if(APPLE) target_link_libraries( - ${minetest_LIBS} + ${client_LIBS} ${ICONV_LIBRARY} ) else() target_link_libraries( - ${minetest_LIBS} + ${client_LIBS} ) endif() if(USE_CURL) target_link_libraries( - ${PROJECT_NAME} + ${PROJECT_NAME_LOWER} ${CURL_LIBRARY} ) - endif(USE_CURL) + endif() if(USE_FREETYPE) if(FREETYPE_PKGCONFIG_FOUND) - set_target_properties(${PROJECT_NAME} + set_target_properties(${PROJECT_NAME_LOWER} PROPERTIES COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}" ) - endif(FREETYPE_PKGCONFIG_FOUND) + endif() target_link_libraries( - ${PROJECT_NAME} + ${PROJECT_NAME_LOWER} ${FREETYPE_LIBRARY} ${CGUITTFONT_LIBRARY} ) - endif(USE_FREETYPE) + endif() if (USE_LEVELDB) - target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY}) - endif(USE_LEVELDB) + target_link_libraries(${PROJECT_NAME_LOWER} ${LEVELDB_LIBRARY}) + endif() if (USE_REDIS) - target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY}) - endif(USE_REDIS) + target_link_libraries(${PROJECT_NAME_LOWER} ${REDIS_LIBRARY}) + endif() endif(BUILD_CLIENT) + if(BUILD_SERVER) - add_executable(${PROJECT_NAME}server ${minetestserver_SRCS}) - add_dependencies(${PROJECT_NAME}server GenerateVersion) + add_executable(${PROJECT_NAME_LOWER}server ${server_SRCS}) + add_dependencies(${PROJECT_NAME_LOWER}server GenerateVersion) target_link_libraries( - ${PROJECT_NAME}server + ${PROJECT_NAME_LOWER}server ${ZLIB_LIBRARIES} ${SQLITE3_LIBRARY} ${JSON_LIBRARY} @@ -611,24 +527,24 @@ if(BUILD_SERVER) ${LUA_LIBRARY} ${PLATFORM_LIBS} ) + set_target_properties(${PROJECT_NAME_LOWER}server PROPERTIES + COMPILE_DEFINITIONS "SERVER") if (USE_LEVELDB) - target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY}) - endif(USE_LEVELDB) + target_link_libraries(${PROJECT_NAME_LOWER}server ${LEVELDB_LIBRARY}) + endif() if (USE_REDIS) - target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY}) - endif(USE_REDIS) + target_link_libraries(${PROJECT_NAME_LOWER}server ${REDIS_LIBRARY}) + endif() if(USE_CURL) target_link_libraries( - ${PROJECT_NAME}server + ${PROJECT_NAME_LOWER}server ${CURL_LIBRARY} ) - endif(USE_CURL) + endif() endif(BUILD_SERVER) -# # Set some optimizations and tweaks -# include(CheckCXXCompilerFlag) @@ -649,12 +565,6 @@ if(MSVC) # Flags for C files (sqlite) # /MT = Link statically with standard library stuff set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT") - - if(BUILD_SERVER) - set_target_properties(${PROJECT_NAME}server PROPERTIES - COMPILE_DEFINITIONS "SERVER") - endif(BUILD_SERVER) - else() # Probably GCC if(APPLE) @@ -687,20 +597,11 @@ else() if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") endif() - - if(BUILD_SERVER) - set_target_properties(${PROJECT_NAME}server PROPERTIES - COMPILE_DEFINITIONS "SERVER") - endif(BUILD_SERVER) - endif() -#MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}") -#MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}") -# # Installation -# + if(WIN32) if(USE_SOUND) if(OPENAL_DLL) @@ -737,7 +638,7 @@ if(WIN32) endif() if(BUILD_CLIENT) - install(TARGETS ${PROJECT_NAME} + install(TARGETS ${PROJECT_NAME_LOWER} RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${BINDIR} ARCHIVE DESTINATION ${BINDIR} @@ -755,9 +656,9 @@ if(BUILD_CLIENT) if(USE_GETTEXT) foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) - set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME_LOWER}.mo") install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH}) - endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) + endforeach() endif() if(WIN32) @@ -771,21 +672,21 @@ if(BUILD_CLIENT) if(DEFINED GETTEXT_ICONV_DLL) install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR}) endif() - endif(USE_GETTEXT) + endif() endif() endif(BUILD_CLIENT) if(BUILD_SERVER) - install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR}) -endif(BUILD_SERVER) + install(TARGETS ${PROJECT_NAME_LOWER}server DESTINATION ${BINDIR}) +endif() if (USE_GETTEXT) set(MO_FILES) foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) - set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po") + set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME_LOWER}.po") set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) - set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME_LOWER}.mo") add_custom_command(OUTPUT ${MO_BUILD_PATH} COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} @@ -800,20 +701,15 @@ if (USE_GETTEXT) ) set(MO_FILES ${MO_FILES} ${MO_FILE_PATH}) - endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES}) + endforeach() add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES}) -endif(USE_GETTEXT) +endif() + # Subdirectories if (BUILD_CLIENT AND USE_FREETYPE) add_subdirectory(cguittfont) -endif (BUILD_CLIENT AND USE_FREETYPE) - -if (JSON_FOUND) -else (JSON_FOUND) - add_subdirectory(json) -endif (JSON_FOUND) +endif() -#end -- cgit v1.2.3