Skip to content

Commit 02b3d55

Browse files
committed
Fix linux build
1 parent 011a5a9 commit 02b3d55

20 files changed

+46
-41
lines changed

CMakeLists.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,18 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/sdk")
252252
list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/sdk/libraries/${ARCH_TYPE}")
253253
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sdk/cmake")
254254

255-
set(SDL2_DIR "${CMAKE_SOURCE_DIR}/sdk/cmake")
255+
# TODO move
256+
if(MSVC)
257+
set(SDL2_DIR "${CMAKE_SOURCE_DIR}/sdk/cmake")
258+
endif()
259+
256260
find_package(SDL2 REQUIRED CONFIG)
257261

258-
#set(CMAKE_FIND_DEBUG_MODE TRUE)
259-
find_package(OpenAL REQUIRED)
260-
#set(CMAKE_FIND_DEBUG_MODE FALSE)
262+
find_package(mimalloc)
263+
264+
if(NOT TARGET mimalloc::mimalloc)
265+
add_library(mimalloc::mimalloc ALIAS mimalloc)
266+
endif()
261267

262268
if (NOT WIN32)
263269
find_package(SDL2 2.0.18 REQUIRED)
@@ -280,7 +286,7 @@ if (NOT WIN32)
280286
find_package(Vorbis REQUIRED)
281287
find_package(Theora REQUIRED)
282288
find_package(LZO REQUIRED)
283-
find_package(mimalloc NAMES mimalloc2 mimalloc2.0 mimalloc)
289+
284290
endif()
285291

286292
option(XRAY_USE_LUAJIT "Use LuaJIT" ON)

Externals/BugTrap-proj/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ target_link_libraries(bugtrap_bugtrap
2828
shlwapi.lib
2929
version.lib
3030
wininet.lib
31+
vfw32.lib
3132
)
3233

3334
target_link_options(bugtrap_bugtrap

Externals/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ add_subdirectory(GameSpy)
1010
add_subdirectory(OPCODE)
1111
add_subdirectory(ode)
1212
add_subdirectory(imgui-proj)
13-
add_subdirectory(DiscordGameSDK)
1413

1514
if (MSVC)
1615
add_subdirectory(BugTrap-proj)
@@ -27,13 +26,12 @@ if (MSVC)
2726

2827
add_subdirectory(zlib-proj)
2928

30-
find_package(mimalloc)
31-
3229
find_package(DbgHelp)
3330
find_package(FaultRep)
3431
find_package(EAX)
3532

3633
add_subdirectory(OpenAutomate-proj)
34+
add_subdirectory(DiscordGameSDK)
3735
endif()
3836

3937
if (NOT TARGET xrLuabind)

Externals/LuaJIT-proj/CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
# For details see the COPYRIGHT file distributed with LuaDist.
55
# Please note that the package source code is licensed under its own license.
66

7+
project(xrLuaJIT C CXX ASM)
8+
79
set(MAJVER 2)
810
set(MINVER 0)
911
set(RELVER 5)
1012
set(ABIVER 5.1)
1113
set(NODOTABIVER 51)
1214

13-
option(LUAJIT_BUILD_STATIC_LIB "Build as static library" ON)
15+
option(LUAJIT_BUILD_STATIC_LIB "Build as static library" OFF)
1416
option(LUAJIT_BUILD_APP "Build application" OFF)
1517

1618
if (WIN32)
@@ -91,7 +93,7 @@ endif()
9193
macro(add_buildvm_target target mode)
9294
add_custom_command(
9395
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}"
94-
COMMAND $<TARGET_FILE:buildvm> ARGS -m ${mode} -o ${CMAKE_CURRENT_BINARY_DIR}/${target} ${ARGN}
96+
COMMAND "${BUILDVM_FILE}" ARGS -m ${mode} -o ${CMAKE_CURRENT_BINARY_DIR}/${target} ${ARGN}
9597
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
9698
DEPENDS buildvm ${ARGN}
9799
)
@@ -103,7 +105,7 @@ if (WIN32)
103105
else()
104106
add_buildvm_target(lj_vm.S ${LJVM_MODE})
105107
set(LJ_VM_SRC "${CMAKE_CURRENT_BINARY_DIR}/lj_vm.S")
106-
set_source_files_properties("${LJ_VM_SRC}" PROPERTIES LANGUAGE CXX)
108+
#set_source_files_properties("${LJ_VM_SRC}" PROPERTIES LANGUAGE CXX)
107109
endif()
108110

109111
add_buildvm_target("lj_bcdef.h" "bcdef" ${LJLIB_C})

cmake/packaging.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ if (UNIX)
1818
# as it uses debian core.
1919
find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc)
2020

21+
mark_as_advanced(FEDORA_FOUND REDHAT_FOUND CENTOS_FOUND DEBIAN_FOUND)
22+
2123
# --------------------------------------------------
2224
# Uninstall target
2325
# --------------------------------------------------
File renamed without changes.
File renamed without changes.

cmake/FindEAX.cmake renamed to cmake/windows/FindEAX.cmake

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ find_path(EAX_INCLUDE_DIR
66

77
find_library(EAX_LIBRARY
88
NAMES eax
9-
#PATHS "${CMAKE_SOURCE_DIR}/sdk/libraries"
109
PATHS "${CMAKE_SOURCE_DIR}/sdk/binaries"
1110
NO_DEFAULT_PATH
1211
)
@@ -15,7 +14,7 @@ mark_as_advanced(
1514
EAX_INCLUDE_DIR
1615
EAX_LIBRARY
1716
)
18-
#DXSDK::D3D9
17+
1918
add_library(EAX_EAX STATIC IMPORTED GLOBAL)
2019
add_library(EAX::EAX ALIAS EAX_EAX)
2120

File renamed without changes.
File renamed without changes.
File renamed without changes.

sdk/cmake/sdl2-config.cmake

-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ set(SDL2TEST_LIBRARY SDL2::SDL2test)
5959
set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib")
6060
set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll")
6161

62-
message("!!! _sdl2_library=${_sdl2_library}")
63-
message("!!! _sdl2_dll_library=${_sdl2_dll_library}")
64-
message("!!! SDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}")
65-
6662
if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
6763
if(NOT TARGET SDL2::SDL2)
6864
add_library(SDL2::SDL2 SHARED IMPORTED GLOBAL)

src/Layers/xrRenderPC_GL/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
find_package(OpenGL REQUIRED)
22

3-
set(GLEW_USE_STATIC_LIBS TRUE)
3+
# TODO check it
4+
#set(GLEW_USE_STATIC_LIBS TRUE)
45
find_package(GLEW REQUIRED)
56

67
add_library(xrRender_GL SHARED)

src/Layers/xrRenderPC_GL/rgl_shaders.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ HRESULT CRender::shader_compile(pcstr name, IReader* fs, pcstr pFunctionName,
225225
options.add("#version 410");
226226
options.add("#extension GL_ARB_separate_shader_objects : enable");
227227

228+
options.add("#extension GL_ARB_separate_shader_objects : enable");
229+
228230
#ifdef DEBUG
229231
options.add("#pragma optimize (off)");
230232
sh_name.append(0u);

src/utils/CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ if (WIN32)
22
#add_subdirectory(xrLC_Light)
33
endif()
44

5-
add_subdirectory(xrLCUtil)
6-
7-
if (NOT PROJECT_PLATFORM_E2K) # XXX: fix compilation on E2K
8-
add_subdirectory(xrQSlim)
9-
endif()
5+
#add_subdirectory(xrLCUtil)
106

117
add_subdirectory(xrMiscMath)

src/xrCore/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ target_link_libraries(xrCore
462462
$<$<STREQUAL:${MEMORY_ALLOCATOR},mimalloc>:mimalloc::mimalloc>
463463
$<$<BOOL:${JPEG_FOUND}>:JPEG::JPEG>
464464
LZO::LZO
465-
BugTrap::BugTrap
465+
$<$<PLATFORM_ID:Windows>:BugTrap::BugTrap>
466466
xrAPI
467467
)
468468

src/xrEngine/CMakeLists.txt

+15-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (MSVC)
66
xr_3da
77
)
88
else()
9-
add_library(xrEngine)
9+
add_library(xrEngine SHARED)
1010
endif()
1111

1212
target_sources_grouped(
@@ -358,14 +358,16 @@ target_sources_grouped(
358358
xrTheora_Surface.h
359359
)
360360

361-
target_sources_grouped(
362-
TARGET xrEngine
363-
NAME "Render\\Execution & 3D\\TextConsole"
364-
FILES
365-
Text_Console.cpp
366-
Text_Console.h
367-
Text_Console_WndProc.cpp
368-
)
361+
if(MSVC)
362+
target_sources_grouped(
363+
TARGET xrEngine
364+
NAME "Render\\Execution & 3D\\TextConsole"
365+
FILES
366+
Text_Console.cpp
367+
Text_Console.h
368+
Text_Console_WndProc.cpp
369+
)
370+
endif()
369371

370372
target_sources_grouped(
371373
TARGET xrEngine
@@ -447,13 +449,13 @@ target_link_libraries(xrEngine
447449
xrScriptEngine
448450
xrNetServer
449451
xrImGui
450-
${OPENAL_LIBRARY}
452+
OpenAL::OpenAL
451453
Ogg::Ogg
452454
Theora::Theora
453455
SDL2::SDL2
454-
DiscordGameSDK::DiscordGameSDK
455-
OpenAutomate::OpenAutomate
456-
vfw32.lib
456+
$<$<PLATFORM_ID:Windows>:DiscordGameSDK::DiscordGameSDK>
457+
$<$<PLATFORM_ID:Windows>:OpenAutomate::OpenAutomate>
458+
457459
)
458460

459461
target_compile_definitions(xrEngine

src/xrSound/CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ target_include_directories(xrSound
121121
PRIVATE
122122
"${CMAKE_SOURCE_DIR}/src"
123123
"${CMAKE_SOURCE_DIR}/src/xrEngine"
124-
"${CMAKE_SOURCE_DIR}/sdk/include"
125-
"${OPENAL_INCLUDE_DIR}"
124+
#"${CMAKE_SOURCE_DIR}/sdk/include"
126125
)
127126

128127
target_link_libraries(xrSound
@@ -136,7 +135,7 @@ target_link_libraries(xrSound
136135
Ogg::Ogg
137136
Vorbis::Vorbis
138137
Vorbis::VorbisFile
139-
#EAX::EAX
138+
$<$<PLATFORM_ID:Windows>:EAX::EAX>
140139
)
141140

142141
target_compile_definitions(xrSound

src/xrUICore/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ target_compile_definitions(xrUICore
167167

168168
set_target_properties(xrUICore PROPERTIES
169169
PREFIX ""
170+
POSITION_INDEPENDENT_CODE ON
170171
)
171172

172173
target_precompile_headers(xrUICore

0 commit comments

Comments
 (0)