1 cmake_minimum_required(VERSION 3.1)
3 project(zinnia VERSION 0.1
5 set(CMAKE_CXX_STANDARD 17)
7 # ## Thanks to yipdw/ninjawedding for this snippet: https://gitlab.peach-bun.com/snippets/103
8 # If ld.gold is available, use it -- it's faster. Also enable incremental
9 # linking for debug and release.
11 # TODO: It's probably a good idea to enable -z relro for non-development
12 # builds. That's more CMake archaeology, though, and I'm not really in the
14 # option(USE_LD_GOLD "Use GNU gold linker" ON)
15 # execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
17 # execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
18 # if("${LD_VERSION}" MATCHES "GNU gold")
19 # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,-z,norelro -Wl,--incremental")
21 # message(WARNING "GNU gold linker isn't available, using the default system linker.")
26 find_package(PkgConfig REQUIRED)
27 find_package(OpenGL REQUIRED)
28 pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
29 pkg_search_module(GLFW REQUIRED glfw3)
31 include_directories(deps/imgui deps/imgui/examples/opengl3_example)
32 file(GLOB IMGUI_SOURCE
34 deps/imgui/imgui_draw.cpp
35 deps/imgui/imgui_demo.cpp
36 deps/imgui/examples/opengl3_example/imgui_impl_glfw_gl3.cpp)
38 include_directories(deps/cpptoml/include)
39 include_directories(deps/inotify)
40 include_directories(deps/handmademath)
41 add_subdirectory(deps/gl3w gl3w)
43 include_directories(${PROJECT_SOURCE_DIR})
44 add_executable(zinnia src/main.cpp src/geom.cpp src/gui/gui.cpp src/project.cpp
48 target_link_libraries(zinnia stdc++fs)
50 target_link_libraries(zinnia gl3w)
51 target_link_libraries(zinnia ${OPENGL_LIBRARIES})
52 target_link_libraries(zinnia ${GLFW_LIBRARIES})
53 target_link_libraries(zinnia ${GTK3_LIBRARIES})