found both SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
and SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) were used, removed the second (deprecated) commands This results in shared libraries being build in /bin on windows, but not other platforms, obviating the need to copy dlls to /bin. Documented this the copy of fractals.dat should now work on all platforms (hopefully) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1123 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
41283a36c5
commit
ed02f5da91
@ -1,8 +1,15 @@
|
|||||||
PROJECT(freeglut)
|
PROJECT(freeglut)
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
# NOTE: On Windows and Cygwin, the dll's are placed in the
|
||||||
|
# CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import
|
||||||
|
# libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other
|
||||||
|
# platforms, such as Linux, the shared libraries are put in
|
||||||
|
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
|
||||||
|
# Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
|
||||||
|
# platforms (unless
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||||
|
|
||||||
|
|
||||||
SET(FREEGLUT_HEADERS
|
SET(FREEGLUT_HEADERS
|
||||||
@ -111,12 +118,9 @@ ELSE()
|
|||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Neatly organize all of the output files in the build directory
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
|
||||||
|
|
||||||
# BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
|
# BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
|
||||||
# re-declare it here so it will show up in the GUI.
|
# re-declare it here so it will show up in the GUI.
|
||||||
|
# by default, we want to build both
|
||||||
OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
|
OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
|
||||||
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
|
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
|
||||||
|
|
||||||
@ -207,7 +211,6 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
|||||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
|
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
|
||||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
# by default, at least on UNIX, we want to build both
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
IF(BUILD_SHARED_LIBS)
|
||||||
ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
|
ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@ -311,31 +314,20 @@ ADD_DEMO(subwin progs/demos/subwin/subwin.c)
|
|||||||
ADD_DEMO(timer progs/demos/timer/timer.c)
|
ADD_DEMO(timer progs/demos/timer/timer.c)
|
||||||
|
|
||||||
# finally, if any demos are built, copy needed files to output directory
|
# finally, if any demos are built, copy needed files to output directory
|
||||||
# (currently, 1) dll, and 2) input for Fractals demo)
|
# (currently, thats just the input file for the Fractals demo)
|
||||||
IF(FREEGLUT_BUILD_DEMOS)
|
IF(FREEGLUT_BUILD_DEMOS)
|
||||||
# 1) copy dll. Make it an action to occur after freeglut dll is
|
# 1) copy fractals.dat from freeglut/progs/demos/Fractals
|
||||||
# built, otherwise we'd have to hijack one of the demos above to do
|
IF(BUILD_SHARED_LIBS)
|
||||||
# it. Not sure whats cleaner really... MSVC only for now...
|
SET(Frac_target Fractals)
|
||||||
GET_TARGET_PROPERTY(DEMO_OUTPUT_DIRECTORY CallbackMaker RUNTIME_OUTPUT_DIRECTORY)
|
ELSE()
|
||||||
GET_TARGET_PROPERTY(LIB_OUTPUT_DIRECTORY freeglut LIBRARY_OUTPUT_DIRECTORY)
|
SET(Frac_target Fractals_static)
|
||||||
if(MSVC AND BUILD_SHARED_LIBS)
|
|
||||||
# $(Configuration) gets replaced by MSBuild (not by CMake) with
|
|
||||||
# Debug, Release or whatever the current build is.
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
TARGET freeglut
|
|
||||||
POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
|
||||||
${LIB_OUTPUT_DIRECTORY}/$(Configuration)/freeglut${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
${DEMO_OUTPUT_DIRECTORY}/$(Configuration)
|
|
||||||
)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
GET_TARGET_PROPERTY(DEMO_OUTPUT_DIRECTORY ${Frac_target} RUNTIME_OUTPUT_DIRECTORY)
|
||||||
# 2) copy fractals.dat from freeglut/progs/demos/Fractals
|
|
||||||
ADD_CUSTOM_COMMAND(
|
ADD_CUSTOM_COMMAND(
|
||||||
TARGET freeglut
|
TARGET ${Frac_target}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
${PROJECT_SOURCE_DIR}/progs/demos/Fractals/fractals.dat
|
${PROJECT_SOURCE_DIR}/progs/demos/Fractals/fractals.dat
|
||||||
${DEMO_OUTPUT_DIRECTORY}/$(Configuration)
|
${DEMO_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
Reference in New Issue
Block a user