]> git.mxchange.org Git - flightgear.git/commitdiff
WIN32/MSVC fixes from Olaf Flebbe
authorJames Turner <zakalawe@mac.com>
Mon, 27 Dec 2010 12:44:17 +0000 (12:44 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 27 Dec 2010 12:44:17 +0000 (12:44 +0000)
CMakeLists.txt
CMakeModules/FindSimGear.cmake
src/Input/CMakeLists.txt
src/Main/CMakeLists.txt

index e9287c9f7cc4ad9cf7459afec50332cf1e8d85a2..7136b5269b7b5f483a1fd0bad9a718123ada0614 100644 (file)
@@ -59,7 +59,17 @@ else(EVENT_INPUT)
 endif(EVENT_INPUT)
 
 # check required dependencies
-find_package(Boost REQUIRED)
+if (MSVC)
+    # on MSVC, Olaf reports that the serialization library is required at
+    # link time. No one has you explained why, unfortunately.
+    set(Boost_USE_STATIC_LIBS        ON)
+    set(Boost_USE_MULTITHREADED      ON)
+    set(Boost_USE_STATIC_RUNTIME    OFF)
+    find_package(Boost REQUIRED COMPONENTS serialization)
+else (MSVC)
+    find_package(Boost REQUIRED)
+endif (MSVC)
+
 find_package(ZLIB REQUIRED)
 find_package(Threads REQUIRED)
 find_package(OpenGL REQUIRED)
@@ -130,8 +140,8 @@ if(WIN32)
     set(NOMINMAX 1)
 endif(WIN32)    
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} -D_REENTRANT")
 
 include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} 
     ${Boost_INCLUDE_DIRS} 
index b4ac321fbcc5fb2b58387753d715544cfd76400e..d6a4b7ba93b2eb2c8be3b8de36c5ee14074b2baf 100644 (file)
@@ -62,59 +62,66 @@ FIND_LIBRARY(SIMGEAR_LIBRARIES
 )
 
 macro(find_sg_component comp libs)
-       set(compLib "sg${comp}")
-       string(TOUPPER "SIMGEAR_${comp}_LIBRARY" compLibName)
-       
-       FIND_LIBRARY(${compLibName}
-         NAMES ${compLib}
-         HINTS $ENV{SIMGEAR_DIR}
-         PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
-         PATHS
-         /usr/local
-         /usr
-         /opt
-       )
-       
-       set(componentLib ${${compLibName}})
-       if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
-               #message(STATUS "found ${componentLib}")
-               list(APPEND ${libs} ${componentLib})
-       endif()
+    set(compLib "sg${comp}")
+    string(TOUPPER "SIMGEAR_${comp}_LIBRARY" compLibName)
+    
+    FIND_LIBRARY(${compLibName}
+      NAMES ${compLib}
+      HINTS $ENV{SIMGEAR_DIR}
+      PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
+      PATHS
+      /usr/local
+      /usr
+      /opt
+    )
+    
+    set(componentLib ${${compLibName}})
+    if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
+        #message(STATUS "found ${componentLib}")
+        list(APPEND ${libs} ${componentLib})
+    endif()
 endmacro()
 
-if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND") 
-       set(SIMGEAR_LIBRARIES "") # clear value
-       
+
+if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")  
+    set(SIMGEAR_LIBRARIES "") # clear value
+    
+    if(NOT MSVC)
+        # Olaf indicates that linking the threads libs causes failures
+        # on MSVC builds
+        set(thread_lib threads)
+    endif(NOT MSVC)
+    
   # note the order here affects the order Simgear libraries are
   # linked in, and hence ability to link when using a traditional
   # linker such as GNU ld on Linux
-       set(comps 
-               ephemeris
-               environment
-               nasal
-    sky
-               material tgdb
-    model    
-    screen
-    bucket
-    bvh
-               util route
-               timing
-               threads
-               io
-    serial
-               sound
-    structure
-    props
-    xml
-    debug 
-               misc
-               magvar
-    math)
-       
-       foreach(component ${comps})
-               find_sg_component(${component} SIMGEAR_LIBRARIES)
-       endforeach()
+    set(comps 
+        ephemeris
+        environment
+        nasal
+        sky
+        material tgdb
+        model    
+        screen
+        bucket
+        bvh
+        util route
+        timing
+        ${thread_lib}
+        io
+        serial
+        sound
+        structure
+        props
+        xml
+        debug 
+        misc
+        magvar
+        math)
+    
+    foreach(component ${comps})
+        find_sg_component(${component} SIMGEAR_LIBRARIES)
+    endforeach()
 endif()
 
 # now we've found SimGear, check its version
@@ -132,30 +139,30 @@ check_cxx_source_runs(
     #define xstr(s) str(s)
     #define str(s) #s
      
-       #define MIN_MAJOR ${SimGear_FIND_VERSION_MAJOR}
-       #define MIN_MINOR ${SimGear_FIND_VERSION_MINOR}
-       #define MIN_MICRO ${SimGear_FIND_VERSION_PATCH}
-       
-       int main() {
-           int major, minor, micro;
-
-           /* printf(%d.%d.%d or greater, , MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
-           printf(\"found %s ... \", xstr(SIMGEAR_VERSION));
-
-           sscanf( xstr(SIMGEAR_VERSION), \"%d.%d.%d\", &major, &minor, &micro );
-
-           if ( (major < MIN_MAJOR) ||
-                (major == MIN_MAJOR && minor < MIN_MINOR) ||
-                (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
-                return -1;
-           }
-
-           return 0;
-       }
+    #define MIN_MAJOR ${SimGear_FIND_VERSION_MAJOR}
+    #define MIN_MINOR ${SimGear_FIND_VERSION_MINOR}
+    #define MIN_MICRO ${SimGear_FIND_VERSION_PATCH}
+    
+    int main() {
+        int major, minor, micro;
+
+        /* printf(%d.%d.%d or greater, , MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
+        printf(\"found %s ... \", xstr(SIMGEAR_VERSION));
+
+        sscanf( xstr(SIMGEAR_VERSION), \"%d.%d.%d\", &major, &minor, &micro );
+
+        if ( (major < MIN_MAJOR) ||
+             (major == MIN_MAJOR && minor < MIN_MINOR) ||
+             (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
+         return -1;
+        }
+
+        return 0;
+    }
     "
     SIMGEAR_VERSION_OK)
 
 include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(SimGear DEFAULT_MSG 
-        SIMGEAR_LIBRARIES SIMGEAR_INCLUDE_DIR SIMGEAR_VERSION_OK)
+     SIMGEAR_LIBRARIES SIMGEAR_INCLUDE_DIR SIMGEAR_VERSION_OK)
 
index fcf154871d99021d6e679b2982482856a890d58e..e0d6abd30ca1065516d7ad69bec3f301bab9c545 100644 (file)
@@ -28,7 +28,12 @@ set(FGJS_SOURCES
        
 add_executable(fgjs ${FGJS_SOURCES})
 
+if(WIN32)
+   set(SOCKETS_LIBRARY wsock32.lib)
+endif(WIN32)
+
 target_link_libraries(fgjs 
+    ${SOCKETS_LIBRARY}
        ${SIMGEAR_LIBRARIES}
        ${PLIB_LIBRARIES}
        ${ZLIB_LIBRARY})
index ffc87c85782a03b586f2a123d17a64ea4db7023d..6eb4513c0da99371bf42d1a7be1d6ae0e0d7b561 100644 (file)
@@ -39,6 +39,7 @@ target_link_libraries(fgfs
        ${ALUT_LIBRARY} 
        ${ZLIB_LIBRARIES}
        ${PLIB_LIBRARIES}
-       ${RT_LIBRARY})
+       ${RT_LIBRARY}
+       ${Boost_SERIALIZATION_LIBRARY})
        
 install(TARGETS fgfs RUNTIME DESTINATION bin)