Skip to content

Commit

Permalink
Corrected executable library path. Minor improvements on AppImage.
Browse files Browse the repository at this point in the history
Builds are now created in the same bin directory. This avoids code repetitions and missing links.
  • Loading branch information
RicardoEPRodrigues committed Jul 3, 2018
1 parent 445cfeb commit a88ae7c
Show file tree
Hide file tree
Showing 7 changed files with 230 additions and 149 deletions.
316 changes: 190 additions & 126 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions 3Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")

set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
if (NOT RUNTIME_OUTPUT_DIRECTORY)
set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
message(STATUS "RUNTIME_OUTPUT_DIRECTORY not defined. Defining as ${RUNTIME_OUTPUT_DIRECTORY}")
endif ()
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG "${RUNTIME_OUTPUT_DIRECTORY}/debug")
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE "${RUNTIME_OUTPUT_DIRECTORY}/release")

IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG)
set(EXECUTABLE_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY_DEBUG})
set(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/lib)
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DRELEASE)
set(EXECUTABLE_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY_RELEASE})
set(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/lib)
ENDIF ()

# External Libraries configuration
Expand Down Expand Up @@ -50,10 +55,11 @@ elseif (UNIX AND NOT APPLE)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wextra -pedantic -g3 -Og -Wuninitialized")

message(STATUS "GLEW and FreeGlut need to be installed.\nRun:\tsudo apt install freeglut3-dev libglew-dev libxmu-dev libxi-dev")

find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)

message(STATUS "GLEW and FreeGlut need to be installed.\nRun:\tsudo apt install freeglut3-dev libglew-dev libxmu-dev libxi-dev")
endif ()

include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS})
Expand Down
32 changes: 19 additions & 13 deletions 3EngineExecutable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")

set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
if (NOT RUNTIME_OUTPUT_DIRECTORY)
set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
message(STATUS "RUNTIME_OUTPUT_DIRECTORY not defined. Defining as ${RUNTIME_OUTPUT_DIRECTORY}")
endif ()
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG "${RUNTIME_OUTPUT_DIRECTORY}/debug")
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE "${RUNTIME_OUTPUT_DIRECTORY}/release")

Expand All @@ -37,8 +40,11 @@ elseif (UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wextra -pedantic -g3 -Og -Wuninitialized")
endif ()

# Project files and executables/libraries
# RPATH correct path for libs
set(CMAKE_INSTALL_RPATH "lib")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

# Project files and executables/libraries
include_directories(${CMAKE_SOURCE_DIR}/3Engine/src)

add_executable(LightScene src/LightScene/LightScene.h src/LightScene/LightScene.cpp)
Expand All @@ -53,14 +59,14 @@ target_link_libraries(Tangram3D 3Engine)
# Post build commands

add_custom_target(CopyFilesExe
COMMAND ${CMAKE_COMMAND} -E echo Copying Engine files into Executable
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/config ${EXECUTABLE_OUTPUT_PATH}/config/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/assets ${EXECUTABLE_OUTPUT_PATH}/assets/
# COMMAND ${CMAKE_COMMAND} -E echo Copying Engine files into Executable
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${3Engine_SOURCE_DIR}/config ${EXECUTABLE_OUTPUT_PATH}/config
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${3Engine_SOURCE_DIR}/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${3Engine_SOURCE_DIR}/assets ${EXECUTABLE_OUTPUT_PATH}/assets
COMMAND ${CMAKE_COMMAND} -E echo Copying Executable files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/config ${EXECUTABLE_OUTPUT_PATH}/config/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets ${EXECUTABLE_OUTPUT_PATH}/assets/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/config ${EXECUTABLE_OUTPUT_PATH}/config
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/assets ${EXECUTABLE_OUTPUT_PATH}/assets
)

add_dependencies(LightScene CopyFilesExe)
Expand All @@ -71,8 +77,8 @@ add_dependencies(Tangram3D CopyFilesExe)

if (UNIX AND NOT APPLE)
add_custom_target(AppImage
DEPENDS ALL
DEPENDS LightScene
COMMAND ${CMAKE_COMMAND} -E echo Making AppImage from path ${EXECUTABLE_OUTPUT_PATH}
COMMAND /bin/sh "${CMAKE_CURRENT_SOURCE_DIR}/../BuildTools/AppImage/build.sh" "${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/../BuildTools/AppImage/3Engine.AppDir" "${EXECUTABLE_OUTPUT_PATH}/../AppImage"
COMMAND /bin/sh "${CMAKE_CURRENT_SOURCE_DIR}/../BuildTools/AppImage/build.sh" "${EXECUTABLE_OUTPUT_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/../BuildTools/AppImage/3Engine.AppDir" "${RUNTIME_OUTPUT_DIRECTORY}/AppImage"
)
endif ()
endif ()
13 changes: 8 additions & 5 deletions 3EngineTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")

set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
if (NOT RUNTIME_OUTPUT_DIRECTORY)
set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
message(STATUS "RUNTIME_OUTPUT_DIRECTORY not defined. Defining as ${RUNTIME_OUTPUT_DIRECTORY}")
endif ()
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG "${RUNTIME_OUTPUT_DIRECTORY}/debug")
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE "${RUNTIME_OUTPUT_DIRECTORY}/release")

Expand Down Expand Up @@ -53,10 +56,10 @@ target_link_libraries(3EngineTests 3Engine)
# Post build commands

add_custom_target(CopyFilesTests
COMMAND ${CMAKE_COMMAND} -E echo Copying Engine files into Executable
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/config ${EXECUTABLE_OUTPUT_PATH}/config/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/assets ${EXECUTABLE_OUTPUT_PATH}/assets/
# COMMAND ${CMAKE_COMMAND} -E echo Copying Engine files into Executable
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/config ${EXECUTABLE_OUTPUT_PATH}/config/
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders/
# COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../3Engine/assets ${EXECUTABLE_OUTPUT_PATH}/assets/
COMMAND ${CMAKE_COMMAND} -E echo Copying Executable files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/config ${EXECUTABLE_OUTPUT_PATH}/config/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${EXECUTABLE_OUTPUT_PATH}/shaders/
Expand Down
2 changes: 1 addition & 1 deletion BuildTools/AppImage/3Engine.AppDir/3Engine.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=3Engine
Exec=3EngineExecutable %F
Exec=LightScene %F
Icon=3Engine
Type=Application
Terminal=true
Expand Down
2 changes: 1 addition & 1 deletion BuildTools/AppImage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mkdir -p ${destPath}
cd ${destPath}

echo "Copying AppDir Folder"
cp -R ${appDirPath} .
cp -R ${appDirPath} ${destPath}
if [ $? -ne 0 ]; then
echo "Failed Copying AppDir Folder. Exiting..."
exit 1
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(3EngineGlobal)

# Project files and executables/libraries

set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

add_subdirectory(3Engine)

add_subdirectory(3EngineExecutable)
Expand Down

0 comments on commit a88ae7c

Please sign in to comment.