Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.vs/
.idea/
.vs
.vscode
.idea
x64/
*.user
build
dist
installer/win64/temp/*

/run_tests.bat
88 changes: 73 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,116 @@
cmake_minimum_required(VERSION 3.13)

project(NauEditor)


if(POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif()
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()


# Compiler config
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD ON)
set(QT_VERSION 6)
set(CMAKE_CXX_STANDARD 20)

add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)

project(NauEditor)

if(NOT DEFINED ${NauEditorFolder})
# Required packages
find_package(Python REQUIRED)


# Global config
if(NOT DEFINED NauEditorFolder)
set(NauEditorFolder "NauEditor")
endif(NOT DEFINED ${NauEditorFolder})
endif()

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/output CACHE PATH "" FORCE)
message(STATUS "Use default install folder: ${CMAKE_INSTALL_PREFIX}")
else()
message(STATUS "Defined install folder: ${CMAKE_INSTALL_PREFIX}")
endif()

# In multi-configuration IDEs, only allow Debug and Release
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Build Configurations" FORCE)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Build Configurations" FORCE)
endif()

if(NOT DEFINED NAU_ROOT_DIR)
set(NAU_ROOT_DIR "$ENV{NAU_ENGINE_SOURCE_DIR}")
if (DEFINED CMAKE_BUILD_TYPE)
message(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")
else()
if (DEFINED CMAKE_CONFIGURATION_TYPES)
message(STATUS "Use multi-configuration. Allowed configurations at build time: ${CMAKE_CONFIGURATION_TYPES}")
else()
set(CMAKE_BUILD_TYPE "Debug")
message(STATUS "Use default build configuration: ${CMAKE_BUILD_TYPE}")
endif()
endif()

if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
message(FATAL_ERROR "Toolchain not selected! Please define -DCMAKE_TOOLCHAIN_FILE")
else()
cmake_path(SET CMAKE_TOOLCHAIN_FILE NORMALIZE "${CMAKE_TOOLCHAIN_FILE}")
message(STATUS "Toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()

if (NOT DEFINED NAU_ROOT_DIR)
set(NAU_ROOT_DIR "$ENV{NAU_ENGINE_SOURCE_DIR}")
endif()
cmake_path(SET NAU_ROOT_DIR NORMALIZE "${NAU_ROOT_DIR}")
if (EXISTS "${NAU_ROOT_DIR}")
message(STATUS "Found Nau Engine SDK: ${NAU_ROOT_DIR}")
else()
message(FATAL_ERROR "Unable to find SDK!")
endif()
set(NauEngineFolder "${NAU_ROOT_DIR}")

set(NAU_CORE_TESTS OFF)
# Shaders are assembled in samples, so we temporarily include them in the assembly.
# TODO: Remove them from the assembly when shader generation is transferred to engine modules
set(NAU_CORE_SAMPLES ON)
set(NAU_CORE_TOOLS ON)
if (NOT DEFINED NAU_BUILD_SAMPLES)
set(NAU_BUILD_SAMPLES TRUE)
endif()
message(STATUS "Samples build: ${NAU_BUILD_SAMPLES}")

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/$<CONFIG>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)

set(CMAKE_MODULE_PATH
"${NAU_ROOT_DIR}/cmake"
"${NauEngineFolder}"
"${CMAKE_SOURCE_DIR}/cmake/defaults"
"${CMAKE_SOURCE_DIR}/cmake/macros"
)

add_subdirectory("${NAU_ROOT_DIR}" "NauEngine")

include(defaults/UsdPackages)
# Nau options
option(NAU_CORE_TESTS "Build core tests projects" OFF)
# Shaders are assembled in samples, so we temporarily include them in the assembly.
# TODO: Remove them from the assembly when shader generation is transferred to engine modules
option(NAU_CORE_TOOLS "Build core tools projects" ON)
option(NAU_CORE_SAMPLES "Build core samples projects" ON)
option(NAU_RTTI "Enable rtti support" OFF)
option(NAU_EXCEPTIONS "Enable exception support" OFF)

# Global options
option(BUILD_SHARED_LIBS "Build shared libs" OFF)


include(NauEngineSDK)
include(UsdPackages)
include(NauCommon)
include(NauModule)
include(NauGenFunctions)
include(platformSpec/NauPlatformSetup)
include(Packages)

if (NAU_BUILD_SAMPLES)
nau_add_samples()
endif()

add_subdirectory(editor)
add_subdirectory(installer)
add_subdirectory(translations)
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"CMAKE_SYSTEM_VERSION": "10.0",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_MANIFEST_MODE": true,
"NAU_BUILD_SDK": true,
"BUILD_SHARED_LIBS": false,
"EASTL_BUILD_BENCHMARK": false,
"EASTL_BUILD_TESTS": false
Expand Down
2 changes: 1 addition & 1 deletion editor/source/editor-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ set_target_properties(NauEditorCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${
set_target_properties(NauEditorCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release/NauEditor)

if (WIN32)
set_target_properties(NauEditorCore PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=$<TARGET_FILE_DIR:NauKernel>;${PXR_ENV_PATHS};%PATH%;${PXR_DEBUGER_ENV};${PXR_DEBUGER_PLUGINPATH}")
set_target_properties(NauEditorCore PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=${NAU_ROOT_DIR};${PXR_ENV_PATHS};%PATH%;${PXR_DEBUGER_ENV};${PXR_DEBUGER_PLUGINPATH}")
endif()

if (NOT COCOS2DX_ROOT_PATH)
Expand Down
2 changes: 1 addition & 1 deletion editor/source/editor-engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ set_target_properties(NauEditorEngine PROPERTIES AUTOMOC TRUE)
set_target_properties(NauEditorEngine PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug/NauEditor)
set_target_properties(NauEditorEngine PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release/NauEditor)

target_compile_definitions(ui PRIVATE UI_ELEMENT_DEBUG)
#target_compile_definitions(ui PRIVATE UI_ELEMENT_DEBUG)

if (TARGET NauKernel_Import AND TARGET NauFramework_Import)
add_dependencies(${TargetName} NauKernel_Import NauFramework_Import)
Expand Down
10 changes: 8 additions & 2 deletions editor/source/editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/translations/editor_en.qm $<TARGET_FILE_DIR:NauEditor>/translations/editor_en.qm

#copy engine dll`s
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/bin/$<CONFIG> $<TARGET_FILE_DIR:NauEditor>
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/$<CONFIG> $<TARGET_FILE_DIR:NauEditor>

COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:NauEditor>/plugins/NauAnimationClipAsset.dll $<TARGET_FILE_DIR:NauEditor>

#copy usd dll's
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PXR_LIB_DIR}/$<CONFIG> $<TARGET_FILE_DIR:NauEditor>
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PXR_LIB_DIR} $<TARGET_FILE_DIR:NauEditor>
Expand All @@ -118,6 +117,13 @@ if (WIN32)

#copy projects templates
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/project_templates $<TARGET_FILE_DIR:NauEditor>/project_templates

#copy sdk
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/include $<TARGET_FILE_DIR:NauEditor>/NauEngineSDK/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/lib $<TARGET_FILE_DIR:NauEditor>/NauEngineSDK/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/bin $<TARGET_FILE_DIR:NauEditor>/NauEngineSDK/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NAU_ROOT_DIR}/cmake $<TARGET_FILE_DIR:NauEditor>/NauEngineSDK/cmake
COMMAND ${CMAKE_COMMAND} -E copy ${NAU_ROOT_DIR}/NauEngineSDK.cmake $<TARGET_FILE_DIR:NauEditor>/NauEngineSDK/NauEngineSDK.cmake
)

foreach(Qt6Lib ${Qt6_deploy_libs})
Expand Down
7 changes: 4 additions & 3 deletions installer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ file(READ "${CMAKE_SOURCE_DIR}/resources/editor/version.txt" Version)

find_package (Python3 COMPONENTS Interpreter)
if (Python3_FOUND)

if (WIN32)
message(NOTICE "NAU_ROOT_DIR ${NAU_ROOT_DIR}")
add_custom_target(Installer ALL
COMMAND ${Python3_EXECUTABLE} installer.py win64 "$<TARGET_FILE_DIR:NauEditor>" "${CMAKE_BINARY_DIR}/$<CONFIG>/Installer.exe" "${NAU_ROOT_DIR}" "$<CONFIG>" "${Version}"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "Generation installer:"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "NAU_ROOT_DIR = ${NAU_ROOT_DIR}"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}"
COMMAND ${Python3_EXECUTABLE} installer.py win64 "$<TARGET_FILE_DIR:NauEditor>" "${CMAKE_BINARY_DIR}/$<CONFIG>/Installer.exe" "${NAU_ROOT_DIR}" "$<CONFIG>" "${CMAKE_TOOLCHAIN_FILE}" "${Version}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/installer
VERBATIM)

Expand Down
19 changes: 11 additions & 8 deletions installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import pathlib
import os

if len(sys.argv) < 7:
print('Usage: make_installer.py platform(win64) '
'EXE_DIR(where files are taken from) OUT_FILENAME(installer file name) SOURCE(path to Engine source) CONFIG(Debug or Release) VERSION(product version)')
if len(sys.argv) < 8:
print('Usage: installer.py platform(win64) '
'EXE_DIR(where files are taken from) OUT_FILENAME(installer file name) SOURCE(path to Engine source) CONFIG(Debug or Release) TOOLCHAIN(path to toolchain) VERSION(product version)')
exit(1)

def validate_path(path) :
Expand All @@ -20,22 +20,25 @@ def validate_path(path) :
out_filename = validate_path(sys.argv[3])
nausource = validate_path(sys.argv[4])
config = sys.argv[5]
version = sys.argv[6]

print('make_installer.py platform({0}) EXE_DIR({1}) OUT_FILENAME({2}) SOURCE({3}) CONFIG({4}) VERSION({5})'.format(platform, exe_dir, out_filename, nausource, config, version), flush=True)
toolchain = validate_path(sys.argv[6])
version = sys.argv[7]

print('installer.py platform({0}) EXE_DIR({1}) OUT_FILENAME({2}) SOURCE({3}) CONFIG({4}) TOOLCHAIN({5}) VERSION({6})'.format(platform, exe_dir, out_filename, nausource, config, toolchain, version), flush=True)
'''
# TODO: check do we need this.
# For now we use prebuilded core without rebuilding it twice.
platform_build_script = validate_path(os.path.join(os.getcwd(),
platform, 'build.py'))

if pathlib.Path(platform_build_script).exists():
print('Building SDK for platform "{0}"'.format(platform), flush=True)
ret = subprocess.call(["python", platform_build_script, nausource, exe_dir, config])
ret = subprocess.call(["python", platform_build_script, nausource, exe_dir, config, toolchain])
if ret != 0:
print('Failed to build SDK')
exit(ret)
else:
print('For platform "{0}" SDK build tool was not implemented, skipping SDK build'.format(platform), flush=True)

'''
platform_specified_script = validate_path(os.path.join(os.getcwd(),
platform, 'make_installer.py'))

Expand Down
Loading