Skip to content

Commit

Permalink
Engineering: One single solution for all projects (Github gongminmin#187
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gongminmin committed Dec 31, 2018
1 parent 9309aba commit 69e44b3
Show file tree
Hide file tree
Showing 92 changed files with 323 additions and 437 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
COMPILER: vc141
BUILD_DIR: vc141
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
COMPILER: vc140
BUILD_DIR: vc140
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
COMPILER: mingw
BUILD_DIR: mingw
MINGW_PATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin

configuration:
- Release

cache:
- Build/%BUILD_DIR%/External
- External
- KlayGE/media
- KlayGE/Samples/media
Expand All @@ -34,4 +38,4 @@ before_build:
build_script:
# Reset the repo to restore changes in External
- git reset --hard
- python BuildAll.py %COMPILER% %PLATFORM% %CONFIGURATION%
- python Build.py %COMPILER% %PLATFORM% %CONFIGURATION%
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
*.png
*.3ds
*.glb
*.ilk
*.iobj
*.ipdb
*.manifest
*.pdb
*.ilk
*.pri
KlayGE.log
__pycache__
CfgBuild.py
Expand Down Expand Up @@ -48,8 +50,6 @@ KlayGE/bin/*/*.dylib
KlayGE/bin/*/*.exe
KlayGE/bin/*/*.exe.config
KlayGE/bin/*/*.gta.testdurations
KlayGE/bin/*/*.manifest
KlayGE/bin/*/*.pri
KlayGE/bin/*/*.py
KlayGE/bin/*/*Py.zip
KlayGE/bin/*/GL*CompatibilityReport.html
Expand Down
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ git:

cache:
directories:
- Build/${BUILD_DIR}/External
- External
- KlayGE/media
- KlayGE/Samples/media
Expand All @@ -32,7 +33,7 @@ matrix:
- libopenal-dev
update:
- true
env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" COMPILER="gcc"
env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" COMPILER="gcc" BUILD_DIR="$COMPILER"

- os: linux
dist: xenial
Expand All @@ -51,7 +52,7 @@ matrix:
- libopenal-dev
update:
- true
env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" COMPILER="gcc"
env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" COMPILER="gcc" BUILD_DIR="$COMPILER"

- os: linux
dist: trusty
Expand All @@ -70,7 +71,7 @@ matrix:
- libopenal-dev
update:
- true
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang"
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang" BUILD_DIR="$COMPILER"

- os: linux
dist: xenial
Expand All @@ -91,7 +92,7 @@ matrix:
- libopenal-dev
update:
- true
env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" COMPILER="clang"
env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" COMPILER="clang" BUILD_DIR="$COMPILER"

- os: osx
osx_image: xcode9.4
Expand All @@ -103,7 +104,7 @@ matrix:
- wine
update:
- true
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang"
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang" BUILD_DIR="$COMPILER"

- os: osx
osx_image: xcode10.1
Expand All @@ -115,7 +116,7 @@ matrix:
- wine
update:
- true
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang" MACOSX_DEPLOYMENT_TARGET="10.14"
env: MATRIX_EVAL="CC=clang && CXX=clang++" COMPILER="clang" MACOSX_DEPLOYMENT_TARGET="10.14" BUILD_DIR="$COMPILER"

before_install:
- eval "${MATRIX_EVAL}"
Expand All @@ -128,4 +129,4 @@ before_install:
script:
# Reset the repo to restore changes in External
- git reset --hard
- python BuildAll.py $COMPILER x64 Release
- python Build.py $COMPILER x64 Release
33 changes: 28 additions & 5 deletions BLibUtil.py → Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,13 @@ def DisplayInfo(self):
sys.stdout.flush()

def GetBuildDir(self, arch, config = None):
build_dir_name = "%s_%s%d_%s_%s" % (self.project_type, self.compiler_name, self.compiler_version, self.target_platform, arch)
if not (config is None):
build_dir_name += "-" + config
env = os.environ
if "BUILD_DIR" in env:
build_dir_name = env["BUILD_DIR"]
else:
build_dir_name = "%s_%s%d_%s_%s" % (self.project_type, self.compiler_name, self.compiler_version, self.target_platform, arch)
if not (config is None):
build_dir_name += "-" + config
return build_dir_name

class BatchCommand:
Expand Down Expand Up @@ -605,7 +609,7 @@ def BuildAProject(name, build_path, build_info, compiler_info, additional_option
if build_info.compiler_name != "vc":
additional_options += " -DKLAYGE_ARCH_NAME:STRING=\"%s\"" % compiler_info.arch
if "android" == build_info.target_platform:
additional_options += " -DCMAKE_TOOLCHAIN_FILE=\"%s/CMake/android.toolchain.cmake\"" % curdir
additional_options += " -DCMAKE_TOOLCHAIN_FILE=\"%s/Build/CMake/Modules/android.toolchain.cmake\"" % curdir
additional_options += " -DANDROID_NATIVE_API_LEVEL=%d" % build_info.target_api_level
if "win" == build_info.host_platform:
android_ndk_path = os.environ["ANDROID_NDK"]
Expand All @@ -620,7 +624,7 @@ def BuildAProject(name, build_path, build_info, compiler_info, additional_option
else:
LogError("Unsupported Darwin architecture.\n")
elif "ios" == build_info.target_platform:
additional_options += " -DCMAKE_TOOLCHAIN_FILE=\"%s/CMake/iOS.cmake\"" % curdir
additional_options += " -DCMAKE_TOOLCHAIN_FILE=\"%s/Build/CMake/Modules/iOS.cmake\"" % curdir
if "arm" == compiler_info.arch:
additional_options += " -DIOS_PLATFORM=OS"
elif "x86" == compiler_info.arch:
Expand Down Expand Up @@ -769,3 +773,22 @@ def BuildAProject(name, build_path, build_info, compiler_info, additional_option

print("")
sys.stdout.flush()

if __name__ == "__main__":
build_info = BuildInfo.FromArgv(sys.argv)

additional_options = " -DKLAYGE_SHADER_PLATFORM_NAME:STRING=\"%s\"" % build_info.shader_platform_name
if build_info.gles_include_dir != "auto":
additional_options += " -DKLAYGE_GLES_INCLUDE_DIR:STRING=\"%s\"" % build_info.gles_include_dir
if build_info.is_windows_desktop:
if build_info.libovr_path != "auto":
additional_options += " -DKLAYGE_LibOVR_PATH:STRING=\"%s\"" % build_info.libovr_path
for compiler_info in build_info.compilers:
BuildAProject("KlayGE", ".", build_info, compiler_info, additional_options)

if (len(sys.argv) > 1) and (sys.argv[1].lower() == "clean"):
clean_dir_list = [ "assimp", "cxxopts", "libogg", "nanosvg", "rapidjson" ]
for dir in clean_dir_list:
dir_name = "External/" + dir
if os.path.isdir(dir_name):
shutil.rmtree(dir_name)
32 changes: 32 additions & 0 deletions Build/CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set(KLAYGE_CMAKE_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Modules")
list(APPEND CMAKE_MODULE_PATH "${KLAYGE_CMAKE_MODULE_DIR}")

project(KlayGE)

cmake_minimum_required(VERSION 3.9)

set(KLAYGE_MAJOR_VERSION 4)
set(KLAYGE_MINOR_VERSION 14)
set(KLAYGE_PATCH_VERSION 0)
set(KLAYGE_VERSION ${KLAYGE_MAJOR_VERSION}.${KLAYGE_MINOR_VERSION}.${KLAYGE_PATCH_VERSION})

set(KLAYGE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")

include(${KLAYGE_CMAKE_MODULE_DIR}/Common.cmake)
include(${KLAYGE_CMAKE_MODULE_DIR}/Platform.cmake)
include(${KLAYGE_CMAKE_MODULE_DIR}/Compiler.cmake)

set(KLAYGE_BIN_DIR "${KLAYGE_ROOT_DIR}/KlayGE/bin/${KLAYGE_PLATFORM_NAME}")

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

add_subdirectory(${KLAYGE_ROOT_DIR}/External/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/External EXCLUDE_FROM_ALL)
if(NOT KLAYGE_PLATFORM_WINDOWS_STORE)
add_subdirectory(${KLAYGE_ROOT_DIR}/glloader/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/glloader)
endif()
add_subdirectory(${KLAYGE_ROOT_DIR}/KFL/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/KFL)
if(KLAYGE_IS_DEV_PLATFORM)
add_subdirectory(${KLAYGE_ROOT_DIR}/DXBC2GLSL/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/DXBC2GLSL)
endif()
add_subdirectory(${KLAYGE_ROOT_DIR}/kfont/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/kfont)
add_subdirectory(${KLAYGE_ROOT_DIR}/KlayGE/Build/CMake ${CMAKE_CURRENT_BINARY_DIR}/KlayGE)
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions CMake/Compiler.cmake → Build/CMake/Modules/Compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ IF(MSVC)
SET(USER_NAME $ENV{USERNAME})

CONFIGURE_FILE(
${KLAYGE_ROOT_DIR}/CMake/VisualStudio2010UserFile.vcxproj.user.in
${KLAYGE_CMAKE_MODULE_DIR}/VisualStudio2010UserFile.vcxproj.user.in
${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}.vcxproj.user
@ONLY
)
Expand All @@ -256,7 +256,7 @@ IF(KLAYGE_PLATFORM_DARWIN OR KLAYGE_PLATFORM_IOS)
SET(USER_NAME $ENV{USER})

CONFIGURE_FILE(
${KLAYGE_ROOT_DIR}/CMake/xcode.xcscheme.in
${KLAYGE_CMAKE_MODULE_DIR}/xcode.xcscheme.in
${PROJECT_BINARY_DIR}/${PROJECTNAME}.xcodeproj/xcuserdata/${USER_NAME}.xcuserdatad/xcschemes/${TARGETNAME}.xcscheme
@ONLY
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 0 additions & 21 deletions BuildAll.py

This file was deleted.

13 changes: 0 additions & 13 deletions BuildDXBC2GLSL.py

This file was deleted.

20 changes: 0 additions & 20 deletions BuildExternal.py

This file was deleted.

16 changes: 0 additions & 16 deletions BuildGlloader.py

This file was deleted.

12 changes: 0 additions & 12 deletions BuildKFL.py

This file was deleted.

12 changes: 0 additions & 12 deletions BuildKFont.py

This file was deleted.

19 changes: 0 additions & 19 deletions BuildKlayGE.py

This file was deleted.

20 changes: 2 additions & 18 deletions DXBC2GLSL/Build/CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
PROJECT(DXBC2GLSL)
SET(DXBC2GLSL_PROJECT_DIR "${KLAYGE_ROOT_DIR}/DXBC2GLSL")

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)

SET(DXBC2GLSL_MAJOR_VERSION 0)
SET(DXBC2GLSL_MINOR_VERSION 1)
SET(DXBC2GLSL_PATCH_VERSION 0)
SET(DXBC2GLSL_VERSION ${DXBC2GLSL_MAJOR_VERSION}.${DXBC2GLSL_MINOR_VERSION}.${DXBC2GLSL_PATCH_VERSION})

SET(DXBC2GLSL_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
SET(KLAYGE_ROOT_DIR "${DXBC2GLSL_PROJECT_DIR}/..")

INCLUDE(${KLAYGE_ROOT_DIR}/CMake/Common.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/CMake/Platform.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/CMake/Compiler.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/CMake/ConfigBoost.cmake)

SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
INCLUDE(${KLAYGE_CMAKE_MODULE_DIR}/ConfigBoost.cmake)

SET(DXBC2GLSL_OUTPUT_DIR "${DXBC2GLSL_PROJECT_DIR}/lib/${KLAYGE_PLATFORM_NAME}")
SET(KLAYGE_BIN_DIR "${KLAYGE_ROOT_DIR}/KlayGE/bin/${KLAYGE_PLATFORM_NAME}")

INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${DXBC2GLSL_PROJECT_DIR}/../External/DXSDK/Include)
Expand Down
1 change: 1 addition & 0 deletions DXBC2GLSL/Build/CMake/DXBC2GLSLCmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES
PROJECT_LABEL ${EXE_NAME}
DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}
OUTPUT_NAME ${EXE_NAME}
FOLDER "DXBC2GLSL"
)

TARGET_LINK_LIBRARIES(${EXE_NAME}
Expand Down
5 changes: 3 additions & 2 deletions DXBC2GLSL/Build/CMake/DXBC2GLSLLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES
PROJECT_LABEL ${LIB_NAME}
DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}
OUTPUT_NAME ${LIB_OUTPUT_NAME}
FOLDER "DXBC2GLSL"
)

#ADD_PRECOMPILED_HEADER(${LIB_NAME} "DXBC2GLSL/DXBC2GLSL.hpp" "${DXBC2GLSL_PROJECT_DIR}/Include" "${DXBC2GLSL_PROJECT_DIR}/Src/DXBC2GLSL.cpp")

TARGET_LINK_LIBRARIES(${LIB_NAME})

add_dependencies(${LIB_NAME} KFL)
Loading

0 comments on commit 69e44b3

Please sign in to comment.