Skip to content

Commit

Permalink
Merge branch 'feature-windows-build-compatibility' of https://github.…
Browse files Browse the repository at this point in the history
  • Loading branch information
andreduvoisin committed Mar 24, 2019
2 parents 93cf41d + 923a4c8 commit 6ed1c5e
Show file tree
Hide file tree
Showing 29 changed files with 782 additions and 593 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Expand Up @@ -6,11 +6,16 @@
# Build Folder
build/

# Install Folder
install/

# Visual Studio
.vs

# VS Code
.vscode
.vscode/*
!.vscode/tasks.json
!.vscode/launch.json

# Intellij Idea
.idea
Expand Down Expand Up @@ -46,4 +51,5 @@ extern/glm-*.zip

# FBX SDK
extern/*_fbxsdk_*/
extern/*_fbxsdk_*.exe
extern/*_fbxsdk_*.pkg.tgz
30 changes: 30 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Composite Engine (Windows)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/install/CompositeEngine.exe",
"cwd": "${workspaceFolder}/install",
"externalConsole": false,
"stopAtEntry": false,
"preLaunchTask": "Build Composite Engine"
},
{
"name": "Launch Composite Engine (Mac)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/CompositeEngine.app/Contents/MacOS/CompositeEngine",
"cwd": "${workspaceFolder}/install/CompositeEngine.app/Contents/MacOS",
"MIMode": "lldb",
"miDebuggerPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi",
"externalConsole": false,
"stopAtEntry": false,
"preLaunchTask": "Build Composite Engine"
}
]
}
73 changes: 73 additions & 0 deletions .vscode/tasks.json
@@ -0,0 +1,73 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Create Build Folder",
"type": "shell",
"command": "cmake",
"args": [
"-E",
"make_directory",
"build"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
{
"label": "Create Install Folder",
"type": "shell",
"command": "cmake",
"args": [
"-E",
"make_directory",
"install"
],
"options": {
"cwd": "${workspaceFolder}"
}
},
{
"label": "Generate Composite Engine",
"type": "shell",
"command": "cmake",
"args": [
"-G",
"Ninja",
"-DCMAKE_BUILD_TYPE=\"Debug\"",
"-DCMAKE_INSTALL_PREFIX=\"${workspaceFolder}/install\"",
".."
],
"options": {
"cwd": "${workspaceFolder}/build"
},
"dependsOn": [
"Create Build Folder",
"Create Install Folder"
]
},
{
"label": "Build Composite Engine",
"type": "shell",
"command": "cmake",
"args": [
"--build",
".",
"--target",
"install"
],
"options": {
"cwd": "${workspaceFolder}/build"
},
"dependsOn": [
"Generate Composite Engine"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
17 changes: 14 additions & 3 deletions CMakeLists.txt
@@ -1,7 +1,18 @@
cmake_minimum_required(VERSION 3.7.2)
cmake_minimum_required(VERSION 3.13.0)

project(CompositeEngine)

# Determine the platform.
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(OS_MACOSX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(OS_LINUX 1)
set(OS_POSIX 1)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OS_WINDOWS 1)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -17,10 +28,10 @@ file(GLOB_RECURSE ENGINE_SRC_FILES
"${ENGINE_SRC_DIR}/*.cpp"
"${UI_SRC_DIR}/cef/browser/*.cpp"
"${UI_SRC_DIR}/cef/client/*.cpp"
"${ENGINE_SRC_DIR}/*.manifest")
"${ENGINE_SRC_DIR}/CompositeEngine.manifest")
file(GLOB_RECURSE CEF_SUBPROCESS_SRC_FILES
"${CEF_SUBPROCESS_SRC_DIR}/*.cpp"
"${ENGINE_SRC_DIR}/*.manifest")
"${UI_SRC_DIR}/CompositeCefSubprocess.manifest")
file(GLOB_RECURSE ASSET_CONVERTER_SRC_FILES
"${ASSET_CONVERTER_SRC_DIR}/*.cpp"
"${ENGINE_SRC_DIR}/common/Math.cpp"
Expand Down
68 changes: 20 additions & 48 deletions CMakeSettings.json
Expand Up @@ -3,79 +3,51 @@
"configurations": [
{
"name": "x86-Debug",
"generator": "Visual Studio 15 2017",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CE_CONFIGURATION",
"value": "Debug"
},
{
"name": "CE_PLATFORM",
"value": "Win32"
}
]
"variables": []
},
{
"name": "x86-Release",
"generator": "Visual Studio 15 2017",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CE_CONFIGURATION",
"value": "Release"
},
{
"name": "CE_PLATFORM",
"value": "Win32"
}
]
"variables": []
},
{
"name": "x64-Debug",
"generator": "Visual Studio 15 2017 Win64",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CE_CONFIGURATION",
"value": "Debug"
},
{
"name": "CE_PLATFORM",
"value": "x64"
}
]
"variables": []
},
{
"name": "x64-Release",
"generator": "Visual Studio 15 2017 Win64",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CE_CONFIGURATION",
"value": "Release"
},
{
"name": "CE_PLATFORM",
"value": "x64"
}
]
"variables": []
}
]
}
25 changes: 10 additions & 15 deletions README.md
Expand Up @@ -13,14 +13,15 @@ This repository requires [Git Large File Storage (Git LFS)](https://git-lfs.gith

#### Windows

* Install VS2017.
* VS2017: https://www.visualstudio.com/downloads/
* Include "Visual C++ tools for CMake" under "Desktop development with C++".
* If necessary, add MSBuild.exe to PATH.
* C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
* Install [Visual Studio 2019](https://www.visualstudio.com/downloads/).
* Include `Desktop development with C++` and `Game development with C++`

#### Mac

* Install [CMake](https://cmake.org/download/).

* Install [Ninja](https://ninja-build.org).

* Install Xcode. Then:

```sh
Expand All @@ -31,17 +32,11 @@ xcode-select --install
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
```

* Install [Ninja](https://ninja-build.org). Ensure it's on your PATH.
#### Visual Studio Code

```sh
mkdir build
cd build
cmake \
-G "Ninja" \
-DCE_CONFIGURATION="Debug" \
-DCMAKE_BUILD_TYPE="Debug" \
..
```
* Install the [C/C++ Extension from Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).

* On Windows, open with Developer Command Prompt.

#### All Platforms

Expand Down
42 changes: 27 additions & 15 deletions asset-converter/CMakeLists.txt
@@ -1,25 +1,37 @@
include("${CMAKE_DIR}/FBXSDK.cmake")
include("${CMAKE_DIR}/GLM.cmake")
include("${CMAKE_DIR}/STB.cmake")

if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
# By default Ninja and Make builds don't create a subdirectory named after
# the configuration.
set(CE_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")

# Output binaries (executables, libraries) to the correct directory.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CE_TARGET_OUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CE_TARGET_OUT_DIR})
else()
set(CE_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
endif()

add_executable(CompositeAssetConverter ${ASSET_CONVERTER_SRC_FILES})

add_dependencies(
CompositeAssetConverter
FBXSDK
GLM
STB
)
target_link_libraries(CompositeAssetConverter PRIVATE FBXSDK GLM STB)

source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${ASSET_CONVERTER_SRC_FILES})

include_directories(${ASSET_CONVERTER_SRC_DIR})
include_directories(${ENGINE_SRC_DIR})
target_include_directories(CompositeAssetConverter PRIVATE ${ASSET_CONVERTER_SRC_DIR})
target_include_directories(CompositeAssetConverter PRIVATE ${ENGINE_SRC_DIR})

if(WIN32)
if(OS_WINDOWS)
target_compile_options(CompositeAssetConverter PRIVATE /W3 /WX)
endif()

BootstrapFBXSDK(CompositeAssetConverter "asset-converter")
BootstrapGLM()
BootstrapSTB()
install(
TARGETS CompositeAssetConverter
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
if(OS_WINDOWS)
install(
FILES $<TARGET_PDB_FILE:CompositeAssetConverter>
DESTINATION "${CMAKE_INSTALL_PREFIX}"
OPTIONAL
)
endif()
3 changes: 0 additions & 3 deletions assets/down.bmp

This file was deleted.

3 changes: 0 additions & 3 deletions assets/left.bmp

This file was deleted.

3 changes: 0 additions & 3 deletions assets/press.bmp

This file was deleted.

3 changes: 0 additions & 3 deletions assets/right.bmp

This file was deleted.

3 changes: 0 additions & 3 deletions assets/up.bmp

This file was deleted.

0 comments on commit 6ed1c5e

Please sign in to comment.