OpenGL icon indicating copy to clipboard operation
OpenGL copied to clipboard

MacOS support (using CMake)

Open ghost opened this issue 5 years ago • 3 comments

Hi Cherno, I add a MacOS support using CMake.

Check the README.md of https://github.com/ZerenLong/OpenGL for installation instruction.

ghost avatar Feb 04 '21 11:02 ghost

Nice!

I also had to copy the assets directory. Into OpenGL-Examples/CMakeList.txt added,

add_custom_command(
        TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        ${CMAKE_CURRENT_SOURCE_DIR}/assets
        ${CMAKE_CURRENT_SOURCE_DIR}/../bin/Debug-x86_64/OpenGL-Examples/assets)

EDIT: but I noticed that updates to assets are not copied, it only copies the directory once

Then the build stopped to imgui not having CMakeLists.txt, added this to OpenGL-Core/CMakeLists.txt

set(IMGUI_INCLUDE_DIR vendor/imgui)
file(GLOB IMGUI_SOURCES ${IMGUI_INCLUDE_DIR}/*.cpp)
file(GLOB IMGUI_HEADERS ${IMGUI_INCLUDE_DIR}/*.h)
add_library(imgui STATIC ${IMGUI_SOURCES} ${IMGUI_SOURCES})

jrasanen avatar Feb 13 '21 17:02 jrasanen

Thanks @jrasanen , I hope the code compile in your machine smoothly.

I used CLion as my IDE and the IDE will create the ../bin/Debug-x86_64/OpenGL-Examples directory as written in the CMakeLists.txt . However, when I use command line CMake to build to project, there is no ../bin/Debug-x86_64/OpenGL-Examples directory created, which confused me a lot.

I finally chose to use the command line CMake to build the project since not everyone use CLion as their IDE.

ghost avatar Feb 15 '21 02:02 ghost

Hey! I actually use clion as well, got it working with the changes I mentioned above, though didn't have time to address the asset problem.

jrasanen avatar Feb 15 '21 13:02 jrasanen