Skip to content

Instantly share code, notes, and snippets.

@magicien
Created May 19, 2020 18:10
Show Gist options
  • Save magicien/bf373f18104468c182a0b2af557b980a to your computer and use it in GitHub Desktop.
Save magicien/bf373f18104468c182a0b2af557b980a to your computer and use it in GitHub Desktop.
EOSサンプル修正後の CMakeLists.txt
#CMAKE file for build
project (SimpleFramework)
cmake_minimum_required(VERSION 2.6)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) #default type is release
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
option(BUILD_WITH_SDL "Do you want to use SDL?" TRUE)
if(BUILD_WITH_SDL)
message(STATUS "We do build with SDL.")
add_definitions(-DEOS_DEMO_SDL)
endif(BUILD_WITH_SDL)
option(BUILD_WITH_DXTK "Do you want to use DirectX Toolkit?" FALSE)
if(BUILD_WITH_DXTK)
message(STATUS "We do build with DirectX Toolkit.")
add_definitions(-DDXTK)
endif(BUILD_WITH_DXTK)
include_directories ("${PROJECT_SOURCE_DIR}/Source")
#EOS SDK location
set(EOS_SDK_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../SDK/Include")
set(EOS_SDK_BIN_DIR "${PROJECT_SOURCE_DIR}/../../SDK/Bin")
if(APPLE)
set(EOS_SDK_LIBRARIES "${EOS_SDK_BIN_DIR}/libEOSSDK-Mac-Shipping.dylib") #mac
elseif(UNIX)
set(EOS_SDK_LIBRARIES "${EOS_SDK_BIN_DIR}/libEOSSDK-Linux-Shipping.so") #linux
endif(APPLE)
include_directories ("${PROJECT_SOURCE_DIR}/Source")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Core")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Graphics")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Graphics/GUI")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Input")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Utils")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Main")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Main/Windows")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/Source/Math")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/External/SDL2/Include")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/External/GLEW/include")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/External/SDL2/SDL2_ttf/include")
include_directories ("${PROJECT_SOURCE_DIR}/../Shared/External/UTF8-CPP/source")
include_directories ("${EOS_SDK_INCLUDE_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(THIRD_PARTY_DEPENDENCY_LIBS "")
#Search for dependencies
if(BUILD_WITH_SDL)
#SDL
find_package (SDL2 REQUIRED)
find_package (SDL2TTF REQUIRED)
if (NOT SDL2_FOUND OR NOT SDL2TTF_FOUND)
message (STATUS "SDL not found!")
else ()
include_directories(${SDL2_INCLUDE_DIR})
endif()
#OpenGL
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL)
#GLEW
find_path(GLEW_INCLUDE_DIR GL/glew.h
/usr/local/include
/System/Library/Frameworks/GLEW.framework/Versions/A/Headers
${OPENGL_LIBRARY_DIR}
)
find_library(GLEW_LIBRARIES GLEW
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/usr/local/Cellar/glew/2.1.0_1/lib
)
if (DEFINED GLEW_LIBRARIES)
message(STATUS "GLEW found")
set(GLEW_FOUND TRUE)
endif()
if (NOT GLEW_FOUND)
message (STATUS "GLEW not found!")
else()
include_directories(${GLEW_INCLUDE_DIR})
endif()
if(SDL2_FOUND AND SDL2TTF_FOUND AND OPENGL_FOUND AND GLEW_FOUND)
set(THIRD_PARTY_DEPENDENCY_LIBS
${GLEW_LIBRARIES}
${OPENGL_glu_LIBRARY}
${OPENGL_opengl_LIBRARY}
${SDL2_LIBRARIES}
${SDL2_LIBRARY}
${SDL2TTF_LIBRARY}
)
message (STATUS "All 3rd parties found: ${THIRD_PARTY_DEPENDENCY_LIBS}")
endif()
endif(BUILD_WITH_SDL)
if(BUILD_WITH_DXTK)
message (STATUS "Not supported yet!")
endif(BUILD_WITH_DXTK)
set(SOURCES
../Shared/Source/pch.cpp
../Shared/Source/Core/AccountHelpers.cpp
../Shared/Source/Core/Authentication.cpp
../Shared/Source/Core/Friends.cpp
../Shared/Source/Core/EosUI.cpp
../Shared/Source/Core/Metrics.cpp
../Shared/Source/Core/Platform.cpp
../Shared/Source/Core/Player.cpp
../Shared/Source/Core/Users.cpp
../Shared/Source/Graphics/GUI/AuthDialogs.cpp
../Shared/Source/Graphics/GUI/ConsoleDialog.cpp
../Shared/Source/Graphics/GUI/ExitDialog.cpp
../Shared/Source/Graphics/GUI/FriendsDialog.cpp
../Shared/Source/Graphics/GUI/Button.cpp
../Shared/Source/Graphics/GUI/Checkbox.cpp
../Shared/Source/Graphics/GUI/FriendInfo.cpp
../Shared/Source/Graphics/GUI/FriendList.cpp
../Shared/Source/Graphics/GUI/Scroller.cpp
../Shared/Source/Graphics/GUI/Sprite.cpp
../Shared/Source/Graphics/GUI/TextField.cpp
../Shared/Source/Graphics/GUI/TextLabel.cpp
../Shared/Source/Graphics/GUI/TextureManager.cpp
../Shared/Source/Graphics/GUI/Texture.cpp
../Shared/Source/Graphics/GUI/AnimatedTexture.cpp
../Shared/Source/Graphics/GUI/TextView.cpp
../Shared/Source/Graphics/GUI/Widget.cpp
../Shared/Source/Graphics/GUI/Dialog.cpp
../Shared/Source/Graphics/GUI/Font.cpp
../Shared/Source/Graphics/GUI/SDLTTF.cpp
../Shared/Source/Graphics/Console.cpp
../Shared/Source/Graphics/VectorRender.cpp
../Shared/Source/Graphics/Model.cpp
../Shared/Source/Graphics/SDLSpriteBatch.cpp
../Shared/Source/Input/Input.cpp
../Shared/Source/Input/SDLInput.cpp
../Shared/Source/Main/Main.cpp
../Shared/Source/Main/SDL/SDLMain.cpp
../Shared/Source/Main/Windows/DeviceResources.cpp
../Shared/Source/Main/Windows/WinMain.cpp
../Shared/Source/Math/Vector2.cpp
../Shared/Source/Math/Vector3.cpp
../Shared/Source/Utils/CommandLine.cpp
../Shared/Source/Utils/DebugLog.cpp
../Shared/Source/Utils/StringUtils.cpp
../Shared/Source/Utils/Utils.cpp
Source/Game.cpp
Source/Level.cpp
Source/Menu.cpp
)
add_executable(SimpleFramework ${SOURCES})
target_link_libraries(SimpleFramework ${THIRD_PARTY_DEPENDENCY_LIBS} ${EOS_SDK_LIBRARIES} )
set_property(TARGET SimpleFramework PROPERTY C_STANDARD 99)
set_property(TARGET SimpleFramework PROPERTY CXX_STANDARD 14)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment