Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterkatze committed Jun 15, 2024
1 parent 011a5a9 commit 02b3d55
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 41 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,18 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/sdk")
list(APPEND CMAKE_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/sdk/libraries/${ARCH_TYPE}")
#list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sdk/cmake")

set(SDL2_DIR "${CMAKE_SOURCE_DIR}/sdk/cmake")
# TODO move
if(MSVC)
set(SDL2_DIR "${CMAKE_SOURCE_DIR}/sdk/cmake")
endif()

find_package(SDL2 REQUIRED CONFIG)

#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package(OpenAL REQUIRED)
#set(CMAKE_FIND_DEBUG_MODE FALSE)
find_package(mimalloc)

if(NOT TARGET mimalloc::mimalloc)
add_library(mimalloc::mimalloc ALIAS mimalloc)
endif()

if (NOT WIN32)
find_package(SDL2 2.0.18 REQUIRED)
Expand All @@ -280,7 +286,7 @@ if (NOT WIN32)
find_package(Vorbis REQUIRED)
find_package(Theora REQUIRED)
find_package(LZO REQUIRED)
find_package(mimalloc NAMES mimalloc2 mimalloc2.0 mimalloc)

endif()

option(XRAY_USE_LUAJIT "Use LuaJIT" ON)
Expand Down
1 change: 1 addition & 0 deletions Externals/BugTrap-proj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ target_link_libraries(bugtrap_bugtrap
shlwapi.lib
version.lib
wininet.lib
vfw32.lib
)

target_link_options(bugtrap_bugtrap
Expand Down
4 changes: 1 addition & 3 deletions Externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ add_subdirectory(GameSpy)
add_subdirectory(OPCODE)
add_subdirectory(ode)
add_subdirectory(imgui-proj)
add_subdirectory(DiscordGameSDK)

if (MSVC)
add_subdirectory(BugTrap-proj)
Expand All @@ -27,13 +26,12 @@ if (MSVC)

add_subdirectory(zlib-proj)

find_package(mimalloc)

find_package(DbgHelp)
find_package(FaultRep)
find_package(EAX)

add_subdirectory(OpenAutomate-proj)
add_subdirectory(DiscordGameSDK)
endif()

if (NOT TARGET xrLuabind)
Expand Down
2 changes: 1 addition & 1 deletion Externals/GameSpy
8 changes: 5 additions & 3 deletions Externals/LuaJIT-proj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.

project(xrLuaJIT C CXX ASM)

set(MAJVER 2)
set(MINVER 0)
set(RELVER 5)
set(ABIVER 5.1)
set(NODOTABIVER 51)

option(LUAJIT_BUILD_STATIC_LIB "Build as static library" ON)
option(LUAJIT_BUILD_STATIC_LIB "Build as static library" OFF)
option(LUAJIT_BUILD_APP "Build application" OFF)

if (WIN32)
Expand Down Expand Up @@ -91,7 +93,7 @@ endif()
macro(add_buildvm_target target mode)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}"
COMMAND $<TARGET_FILE:buildvm> ARGS -m ${mode} -o ${CMAKE_CURRENT_BINARY_DIR}/${target} ${ARGN}
COMMAND "${BUILDVM_FILE}" ARGS -m ${mode} -o ${CMAKE_CURRENT_BINARY_DIR}/${target} ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS buildvm ${ARGN}
)
Expand All @@ -103,7 +105,7 @@ if (WIN32)
else()
add_buildvm_target(lj_vm.S ${LJVM_MODE})
set(LJ_VM_SRC "${CMAKE_CURRENT_BINARY_DIR}/lj_vm.S")
set_source_files_properties("${LJ_VM_SRC}" PROPERTIES LANGUAGE CXX)
#set_source_files_properties("${LJ_VM_SRC}" PROPERTIES LANGUAGE CXX)
endif()

add_buildvm_target("lj_bcdef.h" "bcdef" ${LJLIB_C})
Expand Down
2 changes: 2 additions & 0 deletions cmake/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ if (UNIX)
# as it uses debian core.
find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc)

mark_as_advanced(FEDORA_FOUND REDHAT_FOUND CENTOS_FOUND DEBIAN_FOUND)

# --------------------------------------------------
# Uninstall target
# --------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions cmake/FindEAX.cmake → cmake/windows/FindEAX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ find_path(EAX_INCLUDE_DIR

find_library(EAX_LIBRARY
NAMES eax
#PATHS "${CMAKE_SOURCE_DIR}/sdk/libraries"
PATHS "${CMAKE_SOURCE_DIR}/sdk/binaries"
NO_DEFAULT_PATH
)
Expand All @@ -15,7 +14,7 @@ mark_as_advanced(
EAX_INCLUDE_DIR
EAX_LIBRARY
)
#DXSDK::D3D9

add_library(EAX_EAX STATIC IMPORTED GLOBAL)
add_library(EAX::EAX ALIAS EAX_EAX)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions sdk/cmake/sdl2-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ set(SDL2TEST_LIBRARY SDL2::SDL2test)
set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib")
set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll")

message("!!! _sdl2_library=${_sdl2_library}")
message("!!! _sdl2_dll_library=${_sdl2_dll_library}")
message("!!! SDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}")

if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
if(NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 SHARED IMPORTED GLOBAL)
Expand Down
3 changes: 2 additions & 1 deletion src/Layers/xrRenderPC_GL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
find_package(OpenGL REQUIRED)

set(GLEW_USE_STATIC_LIBS TRUE)
# TODO check it
#set(GLEW_USE_STATIC_LIBS TRUE)
find_package(GLEW REQUIRED)

add_library(xrRender_GL SHARED)
Expand Down
2 changes: 2 additions & 0 deletions src/Layers/xrRenderPC_GL/rgl_shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ HRESULT CRender::shader_compile(pcstr name, IReader* fs, pcstr pFunctionName,
options.add("#version 410");
options.add("#extension GL_ARB_separate_shader_objects : enable");

options.add("#extension GL_ARB_separate_shader_objects : enable");

#ifdef DEBUG
options.add("#pragma optimize (off)");
sh_name.append(0u);
Expand Down
6 changes: 1 addition & 5 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ if (WIN32)
#add_subdirectory(xrLC_Light)
endif()

add_subdirectory(xrLCUtil)

if (NOT PROJECT_PLATFORM_E2K) # XXX: fix compilation on E2K
add_subdirectory(xrQSlim)
endif()
#add_subdirectory(xrLCUtil)

add_subdirectory(xrMiscMath)
2 changes: 1 addition & 1 deletion src/xrCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ target_link_libraries(xrCore
$<$<STREQUAL:${MEMORY_ALLOCATOR},mimalloc>:mimalloc::mimalloc>
$<$<BOOL:${JPEG_FOUND}>:JPEG::JPEG>
LZO::LZO
BugTrap::BugTrap
$<$<PLATFORM_ID:Windows>:BugTrap::BugTrap>
xrAPI
)

Expand Down
28 changes: 15 additions & 13 deletions src/xrEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (MSVC)
xr_3da
)
else()
add_library(xrEngine)
add_library(xrEngine SHARED)
endif()

target_sources_grouped(
Expand Down Expand Up @@ -358,14 +358,16 @@ target_sources_grouped(
xrTheora_Surface.h
)

target_sources_grouped(
TARGET xrEngine
NAME "Render\\Execution & 3D\\TextConsole"
FILES
Text_Console.cpp
Text_Console.h
Text_Console_WndProc.cpp
)
if(MSVC)
target_sources_grouped(
TARGET xrEngine
NAME "Render\\Execution & 3D\\TextConsole"
FILES
Text_Console.cpp
Text_Console.h
Text_Console_WndProc.cpp
)
endif()

target_sources_grouped(
TARGET xrEngine
Expand Down Expand Up @@ -447,13 +449,13 @@ target_link_libraries(xrEngine
xrScriptEngine
xrNetServer
xrImGui
${OPENAL_LIBRARY}
OpenAL::OpenAL
Ogg::Ogg
Theora::Theora
SDL2::SDL2
DiscordGameSDK::DiscordGameSDK
OpenAutomate::OpenAutomate
vfw32.lib
$<$<PLATFORM_ID:Windows>:DiscordGameSDK::DiscordGameSDK>
$<$<PLATFORM_ID:Windows>:OpenAutomate::OpenAutomate>

)

target_compile_definitions(xrEngine
Expand Down
5 changes: 2 additions & 3 deletions src/xrSound/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ target_include_directories(xrSound
PRIVATE
"${CMAKE_SOURCE_DIR}/src"
"${CMAKE_SOURCE_DIR}/src/xrEngine"
"${CMAKE_SOURCE_DIR}/sdk/include"
"${OPENAL_INCLUDE_DIR}"
#"${CMAKE_SOURCE_DIR}/sdk/include"
)

target_link_libraries(xrSound
Expand All @@ -136,7 +135,7 @@ target_link_libraries(xrSound
Ogg::Ogg
Vorbis::Vorbis
Vorbis::VorbisFile
#EAX::EAX
$<$<PLATFORM_ID:Windows>:EAX::EAX>
)

target_compile_definitions(xrSound
Expand Down
1 change: 1 addition & 0 deletions src/xrUICore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ target_compile_definitions(xrUICore

set_target_properties(xrUICore PROPERTIES
PREFIX ""
POSITION_INDEPENDENT_CODE ON
)

target_precompile_headers(xrUICore
Expand Down

0 comments on commit 02b3d55

Please sign in to comment.