From 3321b60f792152321d0531e530347d15614ee17e Mon Sep 17 00:00:00 2001 From: Joey de Vries Date: Tue, 31 Mar 2015 17:00:57 +0200 Subject: [PATCH] CMakeList updated + Readme Merged changes from Inner_Product s.t. makelist still works as it did before, now with proper Linux libraries. --- CMakeLists.txt | 56 +++++++++++++++++++++++++++----------------------- README.md | 10 ++++++++- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c649a..95d53f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,13 @@ cmake_policy(VERSION 2.8) project (LearnOpenGL) -LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib ) +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) +LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib ) list(APPEND CMAKE_CXX_FLAGS "-std=c++11") @@ -14,11 +18,11 @@ list(APPEND CMAKE_CXX_FLAGS "-std=c++11") # ADD_CUSTOM_TARGET(release ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=Release ${PROJECT_SOURCE_DIR}) if(WIN32) -set(LIBS glfw3 opengl32 glew32s SOIL assimp) + set(LIBS glfw3 opengl32 glew32s SOIL assimp) elseif (UNIX) -set(LIBS gl X11 rt dl) + set(LIBS GL X11 glfw GLEW SOIL assimp rt dl) else() -set(LIBS ) + set(LIBS ) endif() IF(APPLE) @@ -83,28 +87,28 @@ foreach(CHAPTER ${CHAPTERS}) "src/${CHAPTER}/${DEMO}/*.h" "src/${CHAPTER}/${DEMO}/*.cpp" ) - add_executable(${DEMO} ${SOURCE}) - target_link_libraries(${DEMO} ${LIBS}) - set_target_properties(${DEMO} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CHAPTER}" - ) - # copy shader files to build directory - file(GLOB SHADERS - "src/${CHAPTER}/${DEMO}/*.vs" - "src/${CHAPTER}/${DEMO}/*.frag" - "src/${CHAPTER}/${DEMO}/*.gs" - ) - foreach(SHADER ${SHADERS}) - # configure_file(${SHADER} "test") - add_custom_command(TARGET ${DEMO} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E - copy ${SHADER} $) - endforeach(SHADER) - # if compiling for visual studio, also use configure file for each project (specifically to setup working directory) - if(MSVC) - configure_file(${CMAKE_SOURCE_DIR}/configuration/visualstudio.vcxproj.user.in ${CMAKE_CURRENT_BINARY_DIR}/${DEMO}.vcxproj.user @ONLY) - endif(MSVC) + add_executable(${DEMO} ${SOURCE}) + target_link_libraries(${DEMO} ${LIBS}) + set_target_properties(${DEMO} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CHAPTER}" + ) + # copy shader files to build directory + file(GLOB SHADERS + "src/${CHAPTER}/${DEMO}/*.vs" + "src/${CHAPTER}/${DEMO}/*.frag" + "src/${CHAPTER}/${DEMO}/*.gs" + ) + foreach(SHADER ${SHADERS}) + # configure_file(${SHADER} "test") + add_custom_command(TARGET ${DEMO} PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy ${SHADER} $) + endforeach(SHADER) + # if compiling for visual studio, also use configure file for each project (specifically to setup working directory) + if(MSVC) + configure_file(${CMAKE_SOURCE_DIR}/configuration/visualstudio.vcxproj.user.in ${CMAKE_CURRENT_BINARY_DIR}/${DEMO}.vcxproj.user @ONLY) + endif(MSVC) endforeach(DEMO) endforeach(CHAPTER) diff --git a/README.md b/README.md index b6a7945..26e1d4f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # learnopengl.com code repository Contains code samples for all tutorials of [http://learnopengl.com](http://learnopengl.com). -For more info see http://learnopengl.com/#!Code-repository +The CMakeLists.txt is not yet finished for Linux/OS X; for more info see http://learnopengl.com/#!Code-repository +## Windows building +All relevant libraries are found in /libs and all DLLs found in /dlls (pre-)compiled for Windows. +The CMake script knows where to find the libraries so just run CMake script and generate project of choice. +Note that you still have to manually copy the required .DLL files from the /dlls folder to your binary folder for the binaries to run. + +## Linux building +First get the required packages: +Use root (sudo) and type `apt-get install libsoil-dev libglm-dev libassimp-dev libglew-dev libglfw-dev` \ No newline at end of file