summaryrefslogtreecommitdiffhomepage
path: root/external/CMakeLists.txt
blob: 45e5728b10c890362ad9ad928cce0f41dbd6e60d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
project(floormat-external)

set(FLOORMAT_SUBMODULE-DEPENDENCIES ON CACHE BOOL
    "Use dependencies included in the source directory (needs git submodule update --init).")

foreach(_module corrade magnum magnum-integration magnum-plugins)
    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/modules")
endforeach()

if(MSVC)
    add_link_options(-WX:NO)
    set_property(DIRECTORY APPEND PROPERTY STATIC_LIBRARY_OPTIONS
        -IGNORE:4006 #warning LNK4006: main already defined in x.cpp.obj; second definition ignored
    )
    add_compile_options(
        -wd4244 # warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
        -wd4312 # warning C4312: 'reinterpret_cast': conversion from 'GLenum' to 'void *' of greater size
        -wd4251 # warning C4251: 't::f': class 'x' needs to have dll-interface to be used by clients of class 'y'
        -wd4456 # warning C4456: declaration of 'x' hides previous local declaration
        -wd4457 # #warning C4457: declaration of 'name' hides function parameter
        #-wd4530 # warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
        -wd4244 # warning C4244: 'initializing': conversion from 'unsigned int' to '_Ty', possible loss of data
        -wd4005 # warning C4005: '_USE_MATH_DEFINES': macro redefinition
    )
else()
    add_compile_options(
        -Wno-error
        -Wno-undef
    )
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
endif()

if(FLOORMAT_SUBMODULE-DEPENDENCIES)
    add_definitions(
        -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS
        -DIMGUI_DISABLE_OBSOLETE_KEYIO
        -DJSON_HAS_THREE_WAY_COMPARISON=1
    )
    sets(STRING
         SDL_ASSERTIONS                         release
         SDL_INSTALL_CMAKEDIR                   "share/cmake/SDL2"
         NLOHMANN_JSON_CONFIG_INSTALL_DIR       "share/cmake/nlohmann_json"
    )
    sets(BOOL

         FMT_SYSTEM_HEADERS                     ON

         JSON_Diagnostics                       ON
         JSON_Install                           ON
         JSON_MultipleHeaders                   ON
         JSON_SystemInclude                     ON

         CORRADE_BUILD_STATIC                   OFF
         CORRADE_BUILD_TESTS                    OFF
         CORRADE_BUILD_DEPRECATED               OFF
         CORRADE_MSVC_COMPATIBILITY             OFF
         CORRADE_UTILITY_USE_ANSI_COLORS        ON
         CORRADE_WITH_TESTSUITE                 ON

         MAGNUM_BUILD_STATIC                    OFF
         MAGNUM_BUILD_TESTS                     OFF
         MAGNUM_BUILD_DEPRECATED                ON

         MAGNUM_WITH_ANYIMAGECONVERTER          ON
         MAGNUM_WITH_ANYIMAGEIMPORTER           ON
         MAGNUM_WITH_DISTANCEFIELDCONVERTER     ON
         MAGNUM_WITH_FONTCONVERTER              ON
         MAGNUM_WITH_GL_INFO                    ON
         MAGNUM_WITH_IMAGECONVERTER             ON
         MAGNUM_WITH_MAGNUMFONT                 ON
         MAGNUM_WITH_MAGNUMFONTCONVERTER        ON
         MAGNUM_WITH_OBJIMPORTER                ON
         MAGNUM_WITH_OPENGLTESTER               ON
         MAGNUM_WITH_PNGIMPORTER                OFF
         MAGNUM_WITH_SDL2APPLICATION            ON
         MAGNUM_WITH_SHADERCONVERTER            ON
         MAGNUM_WITH_SHADERS                    ON
         MAGNUM_WITH_SHADERTOOLS                ON
         MAGNUM_WITH_TGAIMAGECONVERTER          ON
         MAGNUM_WITH_TGAIMPORTER                ON
         MAGNUM_WITH_WEBPIMPORTER               OFF
         MAGNUM_WITH_WINDOWLESSWGLAPPLICATION   ON

         MAGNUM_WITH_DDSIMPORTER                ON
         MAGNUM_WITH_GLTFIMPORTER               ON
         MAGNUM_WITH_ICOIMPORTER                ON
         MAGNUM_WITH_PRIMITIVEIMPORTER          ON
         MAGNUM_WITH_STBIMAGECONVERTER          ON
         MAGNUM_WITH_STBIMAGEIMPORTER           ON
         MAGNUM_WITH_STBTRUETYPEFONT            ON
         MAGNUM_WITH_TINYGLTFIMPORTER           OFF

         MAGNUM_WITH_BULLET                     OFF
         MAGNUM_WITH_DART                       OFF
         MAGNUM_WITH_EIGEN                      OFF
         MAGNUM_WITH_GLM                        OFF
         MAGNUM_WITH_IMGUI                      ON
    )
    sets(BOOL
         SDL2_DISABLE_INSTALL                   OFF
         SDL2_DISABLE_SDL2MAIN                  ON

         SDL_3DNOW                              OFF
         SDL_ALTIVEC                            OFF
         #SDL_ASSEMBLY                          OFF
         SDL_ATOMIC                             OFF
         SDL_AUDIO                              OFF
         SDL_CPUINFO                            OFF
         SDL_DIRECTX                            OFF
         SDL_DISKAUDIO                          OFF
         SDL_DUMMYAUDIO                         OFF
         SDL_DUMMYVIDEO                         OFF
         SDL_FILE                               OFF
         SDL_FILESYSTEM                         OFF
         SDL_HAPTIC                             OFF
         SDL_HIDAPI                             OFF
         SDL_HIDAPI_JOYSTICK                    OFF
         SDL_JOYSTICK                           OFF
         SDL_LIBC                               ON
         SDL_LOADSO                             ON
         SDL_LOCALE                             OFF
         SDL_MISC                               OFF
         #SDL_MMX                                OFF
         SDL_OPENGL                             ON
         SDL_OPENGLES                           OFF
         SDL_POWER                              OFF
         SDL_RENDER                             OFF
         SDL_RENDER_D3D                         OFF
         SDL_SENSOR                             OFF
         #SDL_SSE                               OFF
         #SDL_SSE2                              OFF
         #SDL_SSE3                              OFF
         #SDL_SSEMATH                           OFF
         SDL_SYSTEM_ICONV                       OFF
         SDL_TEST                               OFF
         SDL_THREADS                            ON
         SDL_TIMERS                             OFF
         SDL_VIDEO                              ON
         SDL_VIRTUAL_JOYSTICK                   OFF
         SDL_VULKAN                             OFF
         SDL_WASAPI                             OFF
         SDL_XINPUT                             OFF
    )
    if(NOT WIN32)
        set(MAGNUM_WITH_WINDOWLESSWGLAPPLICATION OFF)
    endif()
endif()

fm_run_hook(fm-userconfig-external-pre)

if(FLOORMAT_SUBMODULE-DEPENDENCIES)
    sets(PATH IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
    add_subdirectory(json)
    add_subdirectory(sdl2)
    add_subdirectory(corrade)
    add_subdirectory(magnum)
    add_subdirectory(magnum-plugins)
    add_subdirectory(magnum-integration)
    add_subdirectory(fmt)
endif()

if(FLOORMAT_SUBMODULE-DEPENDENCIES)
    if(MSVC)
        target_compile_options(CorradeTestSuiteObjects PRIVATE -EHsc)
    endif()
endif()

fm_run_hook(fm-userconfig-external)

find_package(SDL2 QUIET REQUIRED)
find_package(Corrade QUIET REQUIRED)
find_package(ImGui QUIET REQUIRED)
find_package(Magnum QUIET REQUIRED)
find_package(MagnumPlugins QUIET REQUIRED)
find_package(MagnumIntegration QUIET REQUIRED ImGui)

if(NOT FLOORMAT_SUBMODULE-DEPENDENCIES)
    find_package(fmt QUIET REQUIRED)
endif()

fm_run_hook(fm-userconfig-external-post)