From e4a8896fdc98d29bc0af16bda19599e53f259d1c Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 28 Dec 2010 13:32:54 +0000 Subject: [PATCH] MSVC improvements from Olaf Flebbe. --- CMakeLists.txt | 18 +++++++++++++++--- simgear/simgear_config_cmake.h.in | 1 + simgear/threads/CMakeLists.txt | 8 ++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20c254e3..6db321af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,18 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF) option(SIMGEAR_HEADLESS "Set to ON to build SimGear with GUI/graphics support" OFF) option(JPEG_FACTORY "Enable JPEG-factory support" OFF) +option(MSVC_3RDPARTY_DIR "Location where the third-party dependencies are extracted" NOT_FOUND) + +if (MSVC_3RDPARTY_DIR) + message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_DIR}") + set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/lib) + set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/include) + set (BOOST_ROOT ${MSVC_3RDPARTY_DIR}/boost_1_44_0) + set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/include) + set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/lib) + set (OSGDIR ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph) +endif (MSVC_3RDPARTY_DIR) -# check required dependencies find_package(Boost REQUIRED) find_package(ZLIB REQUIRED) find_package(Threads REQUIRED) @@ -42,6 +52,7 @@ endif() find_path (HAVE_SYS_TIME_H sys/time.h ) find_path (HAVE_SYS_TIMEB_H sys/timeb.h ) find_path (HAVE_UNISTD_H unistd.h ) +find_path (HAVE_WINDOWS_H windows.h) check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) check_function_exists(ftime HAVE_FTIME) @@ -50,7 +61,8 @@ check_function_exists(rint HAVE_RINT) # isnan might not be real symbol, so can't check using function_exists check_cxx_source_compiles( - "#include void f() { isnan(0.0);} " + "#include + void f() { isnan(0.0);} " HAVE_ISNAN) if(CMAKE_COMPILER_IS_GNUCXX) @@ -65,7 +77,7 @@ if(WIN32) # SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}") # endforeach(warning) - set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS") + set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS") endif(MSVC) # assumed on Windows diff --git a/simgear/simgear_config_cmake.h.in b/simgear/simgear_config_cmake.h.in index 1e46d1e9..2bc95fb3 100644 --- a/simgear/simgear_config_cmake.h.in +++ b/simgear/simgear_config_cmake.h.in @@ -10,6 +10,7 @@ #cmakedefine HAVE_RINT #cmakedefine HAVE_TIMEGM #cmakedefine HAVE_ISNAN +#cmakedefine HAVE_WINDOWS_H // set if building headless (no OSG or OpenGL libs) #cmakedefine NO_OPENSCENEGRAPH_INTERFACE diff --git a/simgear/threads/CMakeLists.txt b/simgear/threads/CMakeLists.txt index 91fcdf24..9eb4d540 100644 --- a/simgear/threads/CMakeLists.txt +++ b/simgear/threads/CMakeLists.txt @@ -5,6 +5,10 @@ set(HEADERS SGQueue.hxx SGThread.hxx) -set(SOURCES SGThread.cxx) -simgear_component(threads threads "${SOURCES}" "${HEADERS}") \ No newline at end of file +if (MSVC) + install (FILES ${HEADERS} DESTINATION include/simgear/threads) +else (MSVC) + set(SOURCES SGThread.cxx) + simgear_component(threads threads "${SOURCES}" "${HEADERS}") +endif(MSVC) -- 2.39.5