From afbf63d5d5b94ce253ebde19743b0c9e00687f9a Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Mon, 12 Mar 2012 05:07:35 +0000 Subject: [PATCH] .def and .rc file were appended to source list AFTER target was defined, so moved them up in the file now setting target machine for linker, or we get in trouble at least with static libs on x64 git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1118 7f0cb862-5218-0410-a997-914c9d46530a --- CMakeLists.txt | 37 ++++++++++++++++++++++++++----------- src/freeglutdll.def | 6 +++--- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6cb523..2fe01f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ IF(NOT ANDROID) src/fg_geometry.c src/fg_menu.c src/fg_teapot.c -) + ) ENDIF() IF(WIN32) @@ -57,7 +57,15 @@ IF(WIN32) src/mswin/fg_state_mswin.c src/mswin/fg_structure_mswin.c src/mswin/fg_window_mswin.c -) + freeglut.rc + ) + IF (NOT CMAKE_CL_64) + # .def file only for 32bit Windows builds + LIST(APPEND FREEGLUT_SRCS + src/freeglutdll.def + ) + ENDIF() + ELSEIF(ANDROID) LIST(APPEND FREEGLUT_SRCS src/egl/fg_internal_egl.h @@ -77,7 +85,7 @@ ELSEIF(ANDROID) src/android/fg_window_android.c src/android/opengles_stubs.c src/android/fg_internal_android.h -) + ) ELSE() LIST(APPEND FREEGLUT_SRCS src/x11/fg_cursor_x11.c @@ -96,9 +104,7 @@ ELSE() src/x11/fg_structure_x11.c src/x11/fg_window_x11.c src/x11/fg_xinput_x11.c -) - - + ) ENDIF() # Neatly organize all of the output files in the build directory @@ -209,15 +215,24 @@ ENDIF() IF(WIN32) LIST(APPEND LIBS winmm) IF(BUILD_SHARED_LIBS) - LIST(APPEND FREEGLUT_SRCS freeglut.rc) - IF (NOT CMAKE_CL_64) - # .def file only for 32bit Windows builds - LIST(APPEND FREEGLUT_SRCS src/Common/freeglutdll.def) - ENDIF() SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS) + IF (CMAKE_CL_64) + # 64bit build + SET_TARGET_PROPERTIES(freeglut PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") + ELSE() + # 32bit build + SET_TARGET_PROPERTIES(freeglut PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x86") + ENDIF() ENDIF() IF(BUILD_STATIC_LIBS) SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC) + IF (CMAKE_CL_64) + # 64bit build + SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") + ELSE() + # 32bit build + SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x86") + ENDIF() ENDIF() ELSE() # on UNIX we need to make sure: diff --git a/src/freeglutdll.def b/src/freeglutdll.def index ac52730..a988e9a 100644 --- a/src/freeglutdll.def +++ b/src/freeglutdll.def @@ -1,5 +1,5 @@ LIBRARY freeglut -VERSION 2.6 +VERSION 3.0 EXPORTS glutInit glutInitWindowPosition @@ -144,8 +144,8 @@ EXPORTS glutInitContextFlags glutInitContextVersion glutInitContextProfile - glutInitErrorFunc - glutInitWarningFunc + glutInitErrorFunc + glutInitWarningFunc __glutInitWithExit __glutCreateWindowWithExit __glutCreateMenuWithExit -- 1.7.10.4