Unverified Commit 4633ab5c authored by Lemongrass3110's avatar Lemongrass3110 Committed by GitHub

Fixed CMake on Windows (#3204)

It is now usable in Visual Studio as well
parent 11b42569
......@@ -56,6 +56,9 @@ Thumbs.db
/conf/import
/conf/msg_conf/import
# /lib
/lib
# /log/
/log/*.log
/log/*.leaks
......
......@@ -7,10 +7,17 @@ message( STATUS "Detecting local MYSQL" )
find_path( MYSQL_LOCAL_INCLUDE_DIRS "mysql.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library( MYSQL_LOCAL_LIBRARIES
NAMES libmysql
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/Win32"
NO_DEFAULT_PATH )
else()
find_library( MYSQL_LOCAL_LIBRARIES
NAMES libmysql
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/x64"
NO_DEFAULT_PATH )
endif()
mark_as_advanced( MYSQL_LOCAL_LIBRARIES )
mark_as_advanced( MYSQL_LOCAL_INCLUDE_DIRS )
......
......@@ -7,10 +7,17 @@ message( STATUS "Detecting local PCRE" )
find_path( PCRE_LOCAL_INCLUDE_DIRS "pcre.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library( PCRE_LOCAL_LIBRARIES
NAMES pcre
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NAMES pcre8
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/Win32"
NO_DEFAULT_PATH )
else()
find_library( PCRE_LOCAL_LIBRARIES
NAMES pcre8
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/x64"
NO_DEFAULT_PATH )
endif()
mark_as_advanced( PCRE_LOCAL_LIBRARIES )
mark_as_advanced( PCRE_LOCAL_INCLUDE_DIRS )
......
......@@ -7,10 +7,17 @@ message( STATUS "Detecting local ZLIB" )
find_path( ZLIB_LOCAL_INCLUDE_DIRS "zlib.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library( ZLIB_LOCAL_LIBRARIES
NAMES zdll
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NAMES zlib
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/Win32"
NO_DEFAULT_PATH )
else()
find_library( ZLIB_LOCAL_LIBRARIES
NAMES zlib
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib/x64"
NO_DEFAULT_PATH )
endif()
mark_as_advanced( ZLIB_LOCAL_LIBRARIES )
mark_as_advanced( ZLIB_LOCAL_INCLUDE_DIRS )
......
......@@ -145,7 +145,7 @@ message( STATUS "Detecting threads library" )
set( CMAKE_THREAD_PREFER_PTHREAD 1 )
find_package(Threads REQUIRED)
if( CMAKE_THREAD_LIBS_INIT )
message( STATUS "Adding global library: ${FUNCTION_FLOOR_LIBRARIES}" )
message( STATUS "Adding global library: ${CMAKE_THREAD_LIBS_INIT}" )
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
endif()
message( STATUS "Detecting threads library - done" )
......@@ -164,6 +164,7 @@ endif()
#
# math library (FreeBSD/Linux/Solaris)
#
if( NOT WIN32 )
message( STATUS "Detecting math library (m)" )
CHECK_INCLUDE_FILE( math.h HAVE_MATH_H )
if( NOT HAVE_MATH_H )
......@@ -176,6 +177,7 @@ if( FUNCTION_FLOOR_LIBRARIES )
set_property( CACHE GLOBAL_LIBRARIES PROPERTY VALUE ${GLOBAL_LIBRARIES} ${FUNCTION_FLOOR_LIBRARIES} )
endif()
message( STATUS "Detecting math library (m) - done" )
endif()
#
......@@ -469,10 +471,7 @@ set( DEVELOPMENT_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/configure"
"${CMAKE_CURRENT_SOURCE_DIR}/configure.in"
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena-9.sln"
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena-10.sln"
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena-12.sln"
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena-13.sln"
"${CMAKE_CURRENT_SOURCE_DIR}/rAthena.sln"
)
set( DEVELOPMENT_DIRECTORIES
"3rdparty"
......@@ -480,8 +479,6 @@ set( DEVELOPMENT_DIRECTORIES
"conf/msg_conf/import-tmpl"
"db/import-tmpl"
"src"
"vcproj-9"
"vcproj-10"
)
set( RUNTIME_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/athena-start"
......
......@@ -34,6 +34,18 @@ message( STATUS "Creating svnversion.h - done" )
#####################################################################
# setup
#
if( WIN32 )
set( PROJECT_LIBS Ws2_32.lib )
if( MSVC )
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
endif()
set( COMMON_ADDITIONALL_CPP "${COMMON_SOURCE_DIR}/winapi.cpp" )
set( COMMON_ADDITIONALL_HPP "${COMMON_SOURCE_DIR}/winapi.hpp" )
endif()
set( COMMON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
CACHE PATH "common source directory" )
#message( STATUS "DEBUG COMMON_SOURCE_DIR=${COMMON_SOURCE_DIR}" )
......@@ -52,6 +64,7 @@ set( COMMON_MINI_HEADERS
"${COMMON_SOURCE_DIR}/showmsg.hpp"
"${COMMON_SOURCE_DIR}/strlib.hpp"
${LIBCONFIG_HEADERS} # needed by showmsg.hpp
${COMMON_ADDITIONALL_HPP} # needed by Windows
CACHE INTERNAL "" )
set( COMMON_MINI_SOURCES
"${COMMON_SOURCE_DIR}/core.cpp"
......@@ -59,6 +72,7 @@ set( COMMON_MINI_SOURCES
"${COMMON_SOURCE_DIR}/showmsg.cpp"
"${COMMON_SOURCE_DIR}/strlib.cpp"
${LIBCONFIG_SOURCES} # needed by showmsg.cpp
${COMMON_ADDITIONALL_CPP} # needed by Windows
CACHE INTERNAL "" )
set( COMMON_MINI_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS} CACHE INTERNAL "" )
set( COMMON_MINI_DEFINITIONS "-DMINICORE ${LIBCONFIG_DEFINITIONS}" CACHE INTERNAL "" )
......@@ -91,6 +105,7 @@ set( COMMON_BASE_HEADERS
"${COMMON_SOURCE_DIR}/cli.hpp"
"${COMMON_SOURCE_DIR}/utilities.hpp"
${LIBCONFIG_HEADERS} # needed by conf.hpp/showmsg.hpp
${COMMON_ADDITIONALL_HPP} # needed by Windows
CACHE INTERNAL "common_base headers" )
set( COMMON_BASE_SOURCES
"${COMMON_SOURCE_DIR}/conf.cpp"
......@@ -113,6 +128,7 @@ set( COMMON_BASE_SOURCES
"${COMMON_SOURCE_DIR}/cli.cpp"
"${COMMON_SOURCE_DIR}/utilities.cpp"
${LIBCONFIG_SOURCES} # needed by conf.cpp/showmsg.cpp
${COMMON_ADDITIONALL_CPP} # needed by Windows
CACHE INTERNAL "common_base sources" )
set( COMMON_BASE_INCLUDE_DIRS
${LIBCONFIG_INCLUDE_DIRS}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment