This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplified cmake, fixed visual studio entry point, imgui demo
- Loading branch information
1 parent
dae2fc6
commit 39b88d4
Showing
16 changed files
with
142 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# verify submodules | ||
IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/glfw/CMakeLists.txt") | ||
message(FATAL_ERROR "oops. Missing glfw. had you cloned with --recursive?") | ||
endif () | ||
IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui.h") | ||
message(FATAL_ERROR "oops. Missing imgui. had you cloned with --recursive?") | ||
endif () | ||
|
||
# configure glfw | ||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) | ||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) | ||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) | ||
set(GLFW_INSTALL OFF CACHE BOOL "GLFW lib only") | ||
add_subdirectory(glfw) | ||
|
||
# configure imgui | ||
find_package(OpenGL REQUIRED) | ||
set( | ||
IMGUI_SOURCES | ||
imgui/imgui.cpp | ||
imgui/imgui_widgets.cpp | ||
imgui/imgui_draw.cpp | ||
imgui/imgui_demo.cpp | ||
imgui/examples/imgui_impl_glfw.cpp | ||
imgui/examples/imgui_impl_opengl3.cpp | ||
) | ||
add_library(imgui ${IMGUI_SOURCES}) | ||
target_include_directories(imgui PUBLIC imgui imgui/examples ${OPENGL_INCLUDE_DIR}) | ||
target_compile_definitions(imgui PRIVATE -DIMGUI_IMPL_OPENGL_LOADER_GLAD) | ||
target_link_libraries(imgui glad glfw ${GLFW_LIBRARIES}) | ||
|
||
add_subdirectory(glad) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
include_directories(include) | ||
# generated by glad webservice (https://glad.dav1d.de/) | ||
add_library(glad src/glad.c) | ||
target_include_directories(glad PUBLIC include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
file(GLOB_RECURSE SOURCES *.cpp) | ||
add_library(core ${SOURCES}) | ||
target_include_directories(core PUBLIC .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
file(GLOB_RECURSE SOURCES *.cpp) | ||
add_library(editor ${SOURCES}) | ||
target_include_directories(editor PUBLIC .) | ||
target_link_libraries(editor core imgui) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
file(GLOB_RECURSE SOURCES *.cpp) | ||
add_library(model ${SOURCES}) | ||
target_include_directories(model PUBLIC .) | ||
target_link_libraries(model core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ const int WINDOW_HEIGHT = 720; | |
class Application { | ||
public: | ||
int runLoop(); | ||
|
||
int demoWindow(); | ||
}; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,4 @@ | ||
include(glfw) | ||
include(imgui) | ||
include(glad) | ||
|
||
find_package(OpenGL REQUIRED) | ||
|
||
include_directories( | ||
${IMGUI_INCLUDE_DIR} | ||
${GLFW_INCLUDE_DIR} | ||
${OPENGL_INCLUDE_DIR} | ||
${GLAD_INCLUDE_DIR} | ||
) | ||
|
||
file(GLOB_RECURSE SOURCES *.cpp) | ||
add_executable(showmaker WIN32 ${SOURCES}) | ||
|
||
target_link_libraries( | ||
showmaker | ||
core | ||
editor | ||
glfw ${GLFW_LIBRARIES} | ||
opengl32 | ||
glad | ||
) | ||
|
||
target_link_libraries(showmaker editor imgui) | ||
install(TARGETS showmaker RUNTIME DESTINATION ${OUTPUT_DIRECTORY}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
#include "Application.h" | ||
|
||
int main() { | ||
#ifdef WIN32 | ||
|
||
#include "Windows.h" | ||
|
||
int WinMain(HINSTANCE hInst, HINSTANCE hPreInst, LPSTR nCmdLine, int nCmdShow) | ||
#endif | ||
#ifndef WIN32 | ||
int main(int argc, char **argv) | ||
#endif | ||
|
||
{ | ||
sm::Application app; | ||
return app.demoWindow(); | ||
return app.runLoop(); | ||
} |