1 Star 0 Fork 69

chengang1979/osgVerse

forked from 王锐/osgVerse 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 5.11 KB
一键复制 编辑 原始数据 按行查看 历史
王锐 提交于 2022-04-25 10:54 . Add bin_dir/3rdparty to include dirs
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
PROJECT(osgVerse)
SET(CMAKE_DEBUG_POSTFIX "d")
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR};${CMAKE_MODULE_PATH}")
IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4251 -wd4275 -nologo")
ENDIF(MSVC)
MACRO(NEW_EXECUTABLE EXECUTABLE_NAME)
ADD_EXECUTABLE(${EXECUTABLE_NAME} ${EXECUTABLE_FILES})
SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
SET_TARGET_PROPERTIES(${EXECUTABLE_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
INSTALL(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
TARGET_INCLUDE_DIRECTORIES(${EXECUTABLE_NAME} PUBLIC ${EXTERNAL_INCLUDES})
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${EXTERNAL_LIBRARIES})
ENDMACRO(NEW_EXECUTABLE)
MACRO(NEW_LIBRARY LIBRARY_NAME LIBRARY_TYPE)
ADD_LIBRARY(${LIBRARY_NAME} ${LIBRARY_TYPE} ${LIBRARY_FILES})
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
INSTALL(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PUBLIC ${EXTERNAL_INCLUDES})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${EXTERNAL_LIBRARIES})
ENDMACRO(NEW_LIBRARY)
MACRO(USE_STATIC_RUNTIME)
IF(MSVC)
FOREACH(FLAG_VAR
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
IF(${FLAG_VAR} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${FLAG_VAR} "${${FLAG_VAR}}")
ENDIF(${FLAG_VAR} MATCHES "/MD")
ENDFOREACH(FLAG_VAR)
ENDIF(MSVC)
ENDMACRO(USE_STATIC_RUNTIME)
IF(NOT WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
ENDIF(NOT WIN32)
IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
ENDIF(MSVC)
#########################################
FIND_PATH(OSG_INCLUDE_DIR osg/Referenced
PATHS
$ENV{OSG_ROOT}/include
$ENV{OSG_DIR}/include
/usr/include
/usr/local/include
)
FIND_PATH(OSG_BUILD_INCLUDE_DIR osg/Config
PATHS
$ENV{OSG_ROOT}/include
$ENV{OSG_DIR}/include
/usr/include
/usr/local/include
)
FIND_PATH(OSG_LIB_DIR libosg.so osg.lib
PATHS
$ENV{OSG_ROOT}/lib
$ENV{OSG_DIR}/lib
/usr/lib
/usr/local/lib
)
MACRO(LINK_OSG_LIBRARY PROJECT_NAME)
FOREACH(OSG_LIB_NAME ${ARGN})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${OSG_LIB_NAME}d optimized ${OSG_LIB_NAME})
ENDFOREACH()
ENDMACRO(LINK_OSG_LIBRARY)
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(OpenMP)
IF(OSG_BUILD_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${OSG_BUILD_INCLUDE_DIR})
ENDIF(OSG_BUILD_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${OSG_INCLUDE_DIR} . 3rdparty
"${CMAKE_BINARY_DIR}/3rdparty")
LINK_DIRECTORIES(${OSG_LIB_DIR} .)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
#########################################
ADD_SUBDIRECTORY(3rdparty)
ADD_SUBDIRECTORY(readerwriter)
ADD_SUBDIRECTORY(pipeline)
ADD_SUBDIRECTORY(animation)
ADD_SUBDIRECTORY(modeling)
ADD_SUBDIRECTORY(ui)
ADD_SUBDIRECTORY(applications)
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(tests)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/chengang1979/osgverse.git
[email protected]:chengang1979/osgverse.git
chengang1979
osgverse
osgVerse
master

搜索帮助