Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Commit

Permalink
[REFRACTOR&CMAKE] only one top level "bin"-folder + fix install
Browse files Browse the repository at this point in the history
we had the structure "bin/os/arch", now it all goes to "bin".
Every package needs a different bin, so bundling them is stupid anyway.
Furthermore this package fixes the install command.
  • Loading branch information
a-teammate committed Dec 16, 2016
1 parent 594e450 commit 4ea8955
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 74 deletions.
32 changes: 9 additions & 23 deletions CMakeLists.txt
Expand Up @@ -35,7 +35,8 @@ conan_basic_setup()
# And we split them accordingly into different require_XY() functions
include(cmake/require_thirdparty_libs.cmake)

#### Install paths ####

## Path Variables

# Error if paths aren't set well
get_filename_component(MAINDIR "${CMAKE_SOURCE_DIR}" REALPATH) # Main inexor folder
Expand All @@ -47,6 +48,9 @@ endif()
# Set the path to inexor/ explicitly to simplify some following definitions
set(SOURCE_DIR ${MAINDIR}/inexor)


## Installation

# INSTALL_LOCALLY will surpress the installation into CMAKE_INSTALL_PREFIX which is by default some global system path.
option(INSTALL_LOCALLY "Install everything relative to this folder (${MAINDIR}). Not into some global system directories." ON)

Expand All @@ -55,30 +59,12 @@ if(INSTALL_LOCALLY)
message(STATUS "Local installation chosen. No files will move outside this folder (${MAINDIR}). .. ${CMAKE_INSTALL_PREFIX}")
endif()

# Define where to move the binary by target 'install'
if(OS_LINUX)
set(EXE_DIR "bin/linux/${PROJECT_ARCH}")
elseif(OS_MACOSX)
set(EXE_DIR "bin/mac/${PROJECT_ARCH}")
elseif(OS_WINDOWS)
set(EXE_DIR "bin/windows/${PROJECT_ARCH}")
endif()

set(INSTALL_RESOURCES_DIR "bin/all")
set(EXE_DIR "bin" CACHE STRING "The directory you want to install your executables to. Use target 'install'.")
install(DIRECTORY "${CMAKE_BINARY_DIR}/bin/" DESTINATION "${EXE_DIR}" USE_SOURCE_PERMISSIONS) # Trailing '/' before the DIRECTORY is significant. Without it bin would be installed to bin/bin.

message(STATUS "Generating Project-Files to ${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "Resulting Executable goes to ${EXE_DIR}")

### Go for the subfolders.
add_subdirectory(inexor)

install(FILES ${INSTALL_SHARED_LIBS} ${INSTALL_EXES} DESTINATION ${EXE_DIR})
install(FILES ${INSTALL_SHARED_LIBS_DEBUG} CONFIGURATIONS Debug DESTINATION ${EXE_DIR})
install(FILES ${INSTALL_SHARED_LIBS_RELEASE} CONFIGURATIONS Release DESTINATION ${EXE_DIR})
install(FILES ${INSTALL_RESOURCES} DESTINATION ${INSTALL_RESOURCES_DIR})
install(DIRECTORY ${INSTALL_RESOURCES_FOLDERS} DESTINATION ${INSTALL_RESOURCES_DIR})

# shipped portable stuff on win (dirty but temporarily)
if(OS_WINDOWS)
install(DIRECTORY ${INSTALL_PORTABLE_DIR} DESTINATION "bin/windows/all")
endif()
## Go for the source subfolder.
add_subdirectory(inexor)
7 changes: 0 additions & 7 deletions cmake/functions.cmake
Expand Up @@ -237,14 +237,7 @@ function(add_app exe)
set_property(TARGET ${exe} PROPERTY FOLDER "executables")
endif()

# on visual studio we want to copy the seperate debug-info file
if(MSVC)
set(pdbfile "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${exe}.pdb")
install(FILES ${pdbfile} DESTINATION ${EXE_DIR} OPTIONAL)
endif()

target_link_libraries(${exe} ${CONAN_LIBS})
install(TARGETS ${exe} DESTINATION ${EXE_DIR})
endfunction()

# USAGE: add_lib(modulename)
Expand Down
7 changes: 7 additions & 0 deletions conanfile.txt
Expand Up @@ -24,3 +24,10 @@
SDL2:shared=False
SDL2_image:shared=False
CEF:use_sandbox=False

[imports]
bin, *.dll -> ./bin
bin, *.bin -> ./bin
bin, *.dat -> ./bin
bin, *.pak -> ./bin
lib, *.dylib* -> ./bin
11 changes: 1 addition & 10 deletions inexor.bat
@@ -1,19 +1,10 @@
@ECHO OFF
Setlocal EnableDelayedExpansion

set INEXOR_ARCH=32

IF /I "%PROCESSOR_ARCHITECTURE%" == "amd64" (
set INEXOR_ARCH=64
)
IF /I "%PROCESSOR_ARCHITEW6432%" == "amd64" (
set INEXOR_ARCH=64
)

:: Clear variable
set "DATA_DIRS="
:: Find all data repos in media
for /f "delims=" %%a in ('dir "./media" /on /ad /b') do @set "DATA_DIRS=!DATA_DIRS! -kmedia/%%a/"

start bin\windows\%INEXOR_ARCH%\inexor.exe "-q$HOME\My Games\Inexor" %DATA_DIRS% -glog.txt %*
start bin\inexor.exe "-q$HOME\My Games\Inexor" %DATA_DIRS% -glog.txt %*
start /B inexor_node_windows.bat
2 changes: 1 addition & 1 deletion inexor/gluegen/require_run_gluegen.cmake
Expand Up @@ -109,7 +109,7 @@ function(require_run_gluegen TARG BUILDFLAGS TEMPLATES_DIR OUT_DIR)
)
message(STATUS "gluegen will generate the following files: ${GENERATED_FILES}")

install(FILES ${gluegen_out_proto} DESTINATION ${INSTALL_RESOURCES_DIR} RENAME ${proto_general_name}) # install .proto to bin/all
install(FILES ${gluegen_out_proto} DESTINATION ${EXE_DIR} RENAME ${proto_general_name}) # install .proto to bin/all
message(STATUS "Proto file install destination: ${INSTALL_RESOURCES_DIR}/${proto_general_name}")
endfunction()

Expand Down
1 change: 0 additions & 1 deletion inexor/ui/CefSubsystem.cpp
Expand Up @@ -50,7 +50,6 @@ void CefSubsystem::initialize(int argc, char **argv)
const CefMainArgs args(argc, argv);
#endif
std::string executable_path = ExecutablePathWithoutBinary(argv[0]);
spdlog::get("global")->info("Detected executable path: {}", executable_path);
InexorSettings settings(executable_path);
if (!CefInitialize(args, settings, cef_app.get(), NULL)) {
spdlog::get("global")->error("FATAL: Initialization of CEF subprocess failed!");
Expand Down
9 changes: 4 additions & 5 deletions inexor/ui/InexorSettings.hpp
Expand Up @@ -39,12 +39,11 @@ class InexorSettings : public CefSettings

char base_path[FILENAME_MAX];
GetCurrentDir(base_path, sizeof(base_path));
CefString(&resources_dir_path).FromString(std::string(base_path) + "/bin/all");
CefString(&locales_dir_path).FromString(std::string(base_path) + "/bin/all/locales");
CefString(&log_file).FromString(std::string(base_path) + "/inexorcef.log");
CefString(&resources_dir_path).FromString(executable_path);
CefString(&locales_dir_path).FromString(executable_path + "/locales");
CefString(&log_file).FromString(std::string(base_path) + "inexorcef.log"); // TODO: make adaptable.
spdlog::get("global")->info("init: cef: setting subprocess executable_path: {}", executable_path);
spdlog::get("global")->info("init: cef: base path: {}", base_path);
CefString(&browser_subprocess_path).FromString(std::string(executable_path) + "/cef_subprocess");
CefString(&browser_subprocess_path).FromString(executable_path + "/cef_subprocess");
}

};
Expand Down
20 changes: 3 additions & 17 deletions inexor_unix
@@ -1,24 +1,10 @@
#!/bin/bash
tolower() {
tr '[:upper:]' '[:lower:]'
}

arch="`uname -m | tolower`"
# Rename the arch to bare style
if [ "${arch}" = "x86_64" ]
then
arch="64"
else
arch="32"
fi

dir="`dirname "$0"`"
os="`uname | tolower`"
bin="${dir}/bin/${os}/${arch}"
exe="${bin}/inexor"
exe="${dir}/bin/inexor"

ln -sf /lib/${arch}-linux-gnu/libudev.so.1 ${bin}/libudev.so.0
export LD_LIBRARY_PATH="$bin:$LD_LIBRARY_PATH"
# Maybe we need to set them to the conan lib dirs:
export LD_LIBRARY_PATH="${dir}/bin:$LD_LIBRARY_PATH"

source inexor_node_unix&
echo >&2 "CALLING: ${exe}"
Expand Down
11 changes: 1 addition & 10 deletions server.bat
@@ -1,12 +1,3 @@
@ECHO OFF

set INEXOR_ARCH=win32

IF /I "%PROCESSOR_ARCHITECTURE%" == "amd64" (
set INEXOR_ARCH=win64
)
IF /I "%PROCESSOR_ARCHITEW6432%" == "amd64" (
set INEXOR_ARCH=win64
)

start bin\windows\%INEXOR_ARCH%\inexor.exe "-q$HOME\My Games\Inexor" -gserver-log.txt -d %*
start bin\server.exe "-q$HOME\My Games\Inexor" -gserver-log.txt -d %*

0 comments on commit 4ea8955

Please sign in to comment.