build: Seperate engine and editor
This commit is contained in:
parent
039d401b44
commit
89d568405f
@ -1,12 +1,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
|
|
||||||
# Declare project
|
# Declare project
|
||||||
project(ferx)
|
project(ferx)
|
||||||
|
|
||||||
|
# Define C++ standard
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# Define variables of directory paths
|
# Define variables of directory paths
|
||||||
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/editor/src)
|
|
||||||
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/editor/include)
|
|
||||||
set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
|
set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
|
||||||
|
|
||||||
# Add thirdparty libraries
|
# Add thirdparty libraries
|
||||||
@ -15,14 +16,6 @@ add_subdirectory(${THIRDPARTY_DIR}/glfw)
|
|||||||
add_subdirectory(${THIRDPARTY_DIR}/glm)
|
add_subdirectory(${THIRDPARTY_DIR}/glm)
|
||||||
add_subdirectory(${THIRDPARTY_DIR}/imgui)
|
add_subdirectory(${THIRDPARTY_DIR}/imgui)
|
||||||
|
|
||||||
# Define macros for the project sources
|
# Add engine and editor
|
||||||
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "${SOURCE_DIR}/*.cpp")
|
add_subdirectory(engine)
|
||||||
add_executable(${PROJECT_NAME})
|
add_subdirectory(editor)
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") # This is useful to get an ASSETS_PATH in your IDE during development but you should comment this if you compile a release version and uncomment the next line
|
|
||||||
#target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game
|
|
||||||
|
|
||||||
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES} )
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE glfw glad glm imgui)
|
|
||||||
|
3
Makefile
3
Makefile
@ -1,4 +1,5 @@
|
|||||||
BUILD_DIR = build
|
BUILD_DIR = build
|
||||||
|
EDITOR_DIR = editor
|
||||||
NAME = ferx
|
NAME = ferx
|
||||||
|
|
||||||
RM += -r
|
RM += -r
|
||||||
@ -14,7 +15,7 @@ debug:
|
|||||||
cmake --build $(BUILD_DIR) -j8
|
cmake --build $(BUILD_DIR) -j8
|
||||||
|
|
||||||
run:
|
run:
|
||||||
cd $(BUILD_DIR) && ./${NAME}
|
cd $(BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cmake --build $(BUILD_DIR) --target clean
|
cmake --build $(BUILD_DIR) --target clean
|
||||||
|
16
editor/CMakeLists.txt
Normal file
16
editor/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
project(editor)
|
||||||
|
|
||||||
|
set(NAME ferx)
|
||||||
|
set(EDITOR_SOURCE_DIR src)
|
||||||
|
set(EDITOR_INCLUDE_DIR include)
|
||||||
|
set(EDITOR_RESOURCES_DIR resources)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE EDITOR_SOURCES ${EDITOR_SOURCE_DIR}/*.cpp)
|
||||||
|
file(COPY ${EDITOR_RESOURCES_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
add_executable(${NAME} ${EDITOR_SOURCES} ${EDITOR_HEADERS})
|
||||||
|
|
||||||
|
target_sources(${NAME} PRIVATE ${EDITOR_SOURCES})
|
||||||
|
target_include_directories(${NAME} PRIVATE ${EDITOR_INCLUDE_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(${NAME} engine)
|
49
editor/resources/imgui.ini
Normal file
49
editor/resources/imgui.ini
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[Window][DockSpaceViewport_11111111]
|
||||||
|
Pos=0,19
|
||||||
|
Size=800,581
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][Debug##Default]
|
||||||
|
Pos=60,60
|
||||||
|
Size=400,400
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][Hierarchy]
|
||||||
|
Pos=602,19
|
||||||
|
Size=198,581
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000006,0
|
||||||
|
|
||||||
|
[Window][Scene]
|
||||||
|
Pos=192,19
|
||||||
|
Size=408,428
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000003,0
|
||||||
|
|
||||||
|
[Window][Project]
|
||||||
|
Pos=192,449
|
||||||
|
Size=408,151
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000004,0
|
||||||
|
|
||||||
|
[Window][Console]
|
||||||
|
Pos=192,449
|
||||||
|
Size=408,151
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000004,1
|
||||||
|
|
||||||
|
[Window][Inspector]
|
||||||
|
Pos=0,19
|
||||||
|
Size=190,581
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000001,0
|
||||||
|
|
||||||
|
[Docking][Data]
|
||||||
|
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=800,581 Split=X
|
||||||
|
DockNode ID=0x00000005 Parent=0x8B93E3BD SizeRef=600,581 Split=X
|
||||||
|
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=190,581 Selected=0xE7039252
|
||||||
|
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=408,581 Split=Y
|
||||||
|
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=608,428 CentralNode=1 Selected=0xE192E354
|
||||||
|
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=608,151 Selected=0xD04A4B96
|
||||||
|
DockNode ID=0x00000006 Parent=0x8B93E3BD SizeRef=198,581 Selected=0x29EABFBD
|
||||||
|
|
16
engine/CMakeLists.txt
Normal file
16
engine/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
project(engine)
|
||||||
|
|
||||||
|
set(ENGINE_SOURCE_DIR src)
|
||||||
|
set(ENGINE_INCLUDE_DIR include)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE ENGINE_SOURCES ${ENGINE_SOURCE_DIR}/*.cpp)
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME})
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") # This is useful to get an ASSETS_PATH in your IDE during development but you should comment this if you compile a release version and uncomment the next line
|
||||||
|
#target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game
|
||||||
|
|
||||||
|
target_sources(${PROJECT_NAME} PRIVATE ${ENGINE_SOURCES})
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE ${ENGINE_INCLUDE_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} glfw glad glm imgui)
|
0
engine/src/main.cpp
Normal file
0
engine/src/main.cpp
Normal file
Loading…
Reference in New Issue
Block a user