Skip to content

Instantly share code, notes, and snippets.

@DasBlub
Created February 25, 2013 22:35
Show Gist options
  • Save DasBlub/5033971 to your computer and use it in GitHub Desktop.
Save DasBlub/5033971 to your computer and use it in GitHub Desktop.
this is a partial fix for https://github.com/cmangos/mangos-wotlk/issues/94 but it does not fully work. TODO: replace the whole ExternalProject_Add stuff with a real CMakeLists.txt for ACE!
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af600f9..4517c5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,6 +143,15 @@ else()
set(LIBS_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
+# this needs to be defined before including ImportACE.cmake
+if(DEBUG)
+ message("Build in debug-mode : Yes")
+ set(CMAKE_BUILD_TYPE Debug)
+else()
+ set(CMAKE_BUILD_TYPE Release)
+ message("Build in debug-mode : No (default)")
+endif()
+
# For Unix systems set the rpath so that libraries are found
set(CMAKE_INSTALL_RPATH ${LIBS_DIR})
set(CMAKE_INSTALL_NAME_DIR ${LIBS_DIR})
@@ -266,14 +275,6 @@ if(PCH)
else()
message("Use PCH : No")
endif()
-
-if(DEBUG)
- message("Build in debug-mode : Yes")
- set(CMAKE_BUILD_TYPE Debug)
-else()
- set(CMAKE_BUILD_TYPE Release)
- message("Build in debug-mode : No (default)")
-endif()
# Handle debugmode compiles (this will require further work for proper WIN32-setups)
if(UNIX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
diff --git a/cmake/ImportACE.cmake b/cmake/ImportACE.cmake
index cba4b89..b4cd5d5 100644
--- a/cmake/ImportACE.cmake
+++ b/cmake/ImportACE.cmake
@@ -23,8 +23,13 @@
# set_target_properties(ace PROPERTIES DEPENDS ACE_Project)
if(WIN32)
+ # on windows, ACE is build using the existing VC project files, we don't have any CMake files for ACE. thus, we also have to use the library directory specified in the VC project files
+ if(PLATFORM MATCHES X86)
+ set(ACE_LIBRARIES_DIR ${CMAKE_SOURCE_DIR}/dep/lib/win32_${CMAKE_BUILD_TYPE})
+ else()
+ set(ACE_LIBRARIES_DIR ${CMAKE_SOURCE_DIR}/dep/lib/x64_${CMAKE_BUILD_TYPE})
+ endif()
set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/ACE_wrappers)
- set(ACE_LIBRARIES_DIR ${CMAKE_SOURCE_DIR}/dep/ACE_wrappers/lib)
set(ACE_LIBRARIES optimized ACE debug ACEd)
else()
set(ACE_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
@@ -40,7 +45,7 @@ if(XCODE)
endforeach(CONF)
endforeach(DIR)
endif()
-
+message(${ACE_LIBRARIES_DIR})
link_directories(
${ACE_LIBRARIES_DIR}
)
diff --git a/dep/ACE_wrappers/CMakeLists.txt b/dep/ACE_wrappers/CMakeLists.txt
index c60846f..995324e 100644
--- a/dep/ACE_wrappers/CMakeLists.txt
+++ b/dep/ACE_wrappers/CMakeLists.txt
@@ -22,6 +22,8 @@ if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ace/config.h.win ${CMAKE_CURRENT_SOURCE_DIR}/ace/config.h)
endif()
+# FIXME: do not use ExternalProject_Add for ACE but instead use real CMake files
+
if(WIN32 AND MSVC)
# VS100 uses MSBuild.exe instead of devenv.com, so force it to use devenv.com
if(VS100_FOUND)
@@ -30,6 +32,18 @@ if(WIN32 AND MSVC)
set(ACE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
endif()
+ if(MSVC_VERSION MATCHES 1500) # Visual Studio 2008
+ set(ACE_MSVC_PRJ_FILE ${CMAKE_SOURCE_DIR}/win/VC90/ACE_vc9.vcproj)
+ elseif(MSVC_VERSION MATCHES 1600) # Visual Studio 2010
+ set(ACE_MSVC_PRJ_FILE ${CMAKE_SOURCE_DIR}/win/VC100/ACE_vc10.vcxproj)
+ elseif(MSVC_VERSION MATCHES 1700) # Visual Studio 2012
+ set(ACE_MSVC_PRJ_FILE ${CMAKE_SOURCE_DIR}/win/VC110/ACE_vc110.vcxproj)
+ else()
+ message(FATAL_ERROR
+ "This script doesn't support your Visual Studio version to compile/install ACE. Only Version 8 (2005), 9 (2008) and 10 (2010) are supported!"
+ )
+ endif()
+
if(PLATFORM MATCHES X86)
set(ACE_CONFIGURATION Win32)
else()
@@ -42,18 +56,9 @@ if(WIN32 AND MSVC)
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
+ BUILD_COMMAND "${ACE_BUILD_TOOL}" "${ACE_MSVC_PRJ_FILE}" /build "${CMAKE_BUILD_TYPE}|${ACE_CONFIGURATION}"
INSTALL_COMMAND ""
)
- ExternalProject_Add_Step(ACE_Project ACE_Upgrade
- COMMAND ${ACE_BUILD_TOOL} <SOURCE_DIR>\\ace\\ace_vc8.sln /upgrade
- ALWAYS 0
- )
- ExternalProject_Add_Step(ACE_Project ACE_Build
- DEPENDEES ACE_Upgrade
- COMMAND ${ACE_BUILD_TOOL} <SOURCE_DIR>\\ace\\ace_vc8.sln /project ACE /build ${CMAKE_BUILD_TYPE}|${ACE_CONFIGURATION}
- ALWAYS 0
- )
elseif(UNIX)
ExternalProject_Add(ACE_Project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment