Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
893b14b
Update SourceDEFUN.sln
maksw2 Jul 16, 2024
79e07d7
Update SourceDEFUN.sln
maksw2 Jul 16, 2024
a350b1a
Create activities.json
Sectonid Jul 16, 2024
5040e08
fix
Sectonid Jul 16, 2024
6e5b626
Merge branch 'Sectonidse:master' into master
maksw2 Jul 16, 2024
f6c0ad2
Update and fix activities.json
Sectonid Jul 16, 2024
78c44e3
Merge branch 'Sectonidse:master' into master
maksw2 Jul 16, 2024
1b433f4
Merge pull request #10 from maksw2/master
Sectonid Jul 16, 2024
93d2535
New License!
Sectonid Jul 16, 2024
49ba4c7
i swear if that will fix
Sectonid Jul 16, 2024
c1df6df
Update compile.yml
Sectonid Jul 16, 2024
7945b38
Alright, let's try this
Sectonid Jul 16, 2024
4e2b24b
Update compile.yml
Sectonid Jul 16, 2024
c228936
revert all changes
maksw2 Jul 16, 2024
f03715a
Merge branch 'Sectonidse:master' into cmake-test
maksw2 Jul 16, 2024
cd5eb84
DX10 support- i mean DX9Ex
Sectonid Jul 16, 2024
52f48f9
Update README.md
Sectonid Jul 16, 2024
f984a5f
Temp solution
Sectonid Jul 16, 2024
d8cde96
Update compile.yml
Sectonid Jul 16, 2024
b5e1302
what
Sectonid Jul 16, 2024
5e84192
wdym |?????
Sectonid Jul 16, 2024
91a0a6e
add a prototype
maksw2 Jul 16, 2024
d5f2e34
Merge branch 'Sectonidse:master' into cmake-test
maksw2 Jul 16, 2024
8a366e7
it works?
maksw2 Jul 16, 2024
6caa629
Merge branch 'cmake-test' of https://github.com/maksw2/SourceDEFUN in…
maksw2 Jul 16, 2024
165db2b
basicly add game_shader_generic_deferred
maksw2 Jul 16, 2024
43b5bad
heck yea
maksw2 Jul 18, 2024
62dd4b5
fix
maksw2 Jul 18, 2024
69e8a9a
Update create_solution.cmd
maksw2 Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,19 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

#- name: Restore NuGet packages
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: nuget restore ${{env.SOLUTION_FILE_PATH}}
# ENABLE THIS ON FIRST TIME SETUP
#- name: Install Strawberry Perl for Shaders compilation
# run: choco install strawberryperl

- name: Install Strawberry Perl for Shaders compilation
run: choco install strawberryperl
- name: Install Shader Dependencies
run: cpan String::CRC32

#- name: Build (Legacy VS2010 Version)
# working-directory: ${{env.GITHUB_WORKSPACE}}
# # Add additional options to the MSBuild command line here (like platform or verbosity level).
# # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
# run: |
# & "C:/Program Files (x86)/MSBuild/12.0/Bin/MSBuild.exe" /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}

- name: Compile Shaders
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
cd ./materialsystem/swarmshaders/
dir ../../devtools/bin/
./buildshaders.bat deferred_shaders
run: ./materialsystem/swarmshaders/buildshaders.bat game_shader_generic_swarm deferred_shaders

- name: Build (VS2022 Version)
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ materialsystem/swarmshaders/Release_dx9/
ipch/
materialsystem/shaderlib/Debug/
materialsystem/shaderlib/Release/
*.vsidx
/.vs
/.vs/SourceDEFUN/v17/Solution.VC.db-shm
/.vs/SourceDEFUN/v17/Browse.VC.db
/build
/materialsystem/shaderlib/.vs
*.user
/materialsystem/swarmshaders/.vs
*.filters
265 changes: 8 additions & 257 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,259 +1,10 @@
# oh yes sir, the Linux support is gonna be here soon
cmake_minimum_required(VERSION 3.10)

# TODO:
# WASNT TESTED YET
# MORE CMAKE THINGIES (line 81-85)
# CHECK IF IT WILL EVEN COMPILE
# Project Name and Version
project(SourceDEFUN VERSION 1.0.0)

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)

if (APPLE)
# Secton: UNTESTED
# NOTE: You will need to pass this as a command line parameter for the Xcode generator -DCMAKE_OSX_ARCHITECTURES=i386
# Also note only Xcode 9.4.1 and earlier support i386
set(CMAKE_OSX_ARCHITECTURES i386)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")
endif()

project(SourceDEFUN)

# For some reason, checking if CMAKE_BUILD_TYPE is defined is unreliable
# So simply check if it's empty instead
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()

# Modern VS versions default to C++14 anyway, so make it consistent
# But in the future we may want so support C++20
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# This is a way to emulate groups.vgc
set(BUILD_GROUP "game" CACHE STRING "Build Group")

# For the CMake GUIs that support a combobox list
set_property(CACHE BUILD_GROUP PROPERTY STRINGS
"everything"
"game"
"shaders"
)

# Which game are we building?
set(BUILD_GAME "hl2" CACHE STRING "Build Game")

set_property(
CACHE BUILD_GAME PROPERTY STRINGS
"defunmod"
)

set(SRCDIR "${CMAKE_CURRENT_LIST_DIR}")
set(GAMEDIR "${CMAKE_CURRENT_LIST_DIR}/game")
# It's a commented code don't highlight ok? | set(THIRDPARTYDIR "${SRCDIR}/thirdparty")

# Compile options that are populated and set for each target depending on their type
set(ADDITIONAL_COMPILE_OPTIONS_EXE)
set(ADDITIONAL_COMPILE_OPTIONS_DLL)
set(ADDITIONAL_COMPILE_OPTIONS_LIB)

# Libraries that are linked to for each target depending on their type
set(ADDITIONAL_LINK_LIBRARIES_EXE)
set(ADDITIONAL_LINK_LIBRARIES_DLL)

# Linker options that are populated and set for each target depending on their type
set(ADDITIONAL_LINK_OPTIONS_EXE)
set(ADDITIONAL_LINK_OPTIONS_DLL)
set(ADDITIONAL_LINK_OPTIONS_LIB)

# Sources that are added to each target depending on their type
set(ADDITIONAL_SOURCES_EXE)
set(ADDITIONAL_SOURCES_DLL)
set(ADDITIONAL_SOURCES_LIB)

# Compile definitions that are added to each target depending on their type
set(ADDITIONAL_COMPILE_DEFINITIONS_EXE)
set(ADDITIONAL_COMPILE_DEFINITIONS_DLL)
set(ADDITIONAL_COMPILE_DEFINITIONS_LIB)

include("_cmake_scripts/pch_skip.cmake")
include("_cmake_scripts/platform_dirs.cmake")
include("_cmake_scripts/base.cmake")
include("_cmake_scripts/video_base.cmake")
include("_cmake_scripts/postbuild.cmake")

set(LIBPUBLIC "${SRCDIR}/lib/public${PLATSUBDIR}")
set(LIBCOMMON "${SRCDIR}/lib/common${PLATSUBDIR}")

link_directories(
${LIBPUBLIC}
${LIBCOMMON}
)

include_directories(
"${SRCDIR}/common"
"${SRCDIR}/public"
"${SRCDIR}/public/tier0"
"${SRCDIR}/public/tier1"
"${SRCDIR}/public/tier2" # Not sure if necessary
"${SRCDIR}/public/tier3" # Ditto
)

add_compile_definitions($<$<CONFIG:Debug>:DEBUG> $<$<CONFIG:Debug>:_DEBUG>)
add_compile_definitions($<$<CONFIG:Release>:NDEBUG>)

if (${IS_WINDOWS})
include("_cmake_scripts/windows_base.cmake")
elseif (${IS_LINUX} OR ${IS_OSX})
include("_cmake_scripts/posix_base.cmake")
endif()

include("_cmake_scripts/groups.cmake")

# Store all targets in a variable name ( See: https://stackoverflow.com/questions/37434946/how-do-i-iterate-over-all-cmake-targets-programmatically/62311397#62311397 )
function(get_all_targets var)
set(targets)
get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR})
set(${var} ${targets} PARENT_SCOPE)
endfunction()

macro(get_all_targets_recursive targets dir)
get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
foreach(subdir ${subdirectories})
get_all_targets_recursive(${targets} ${subdir})
endforeach()

get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
list(APPEND ${targets} ${current_targets})
endmacro()

get_all_targets(ALL_TARGETS)

# Set of helper functions to add defintions/options/libs for each target in a filtered way
function(add_compile_definitions_filtered target definitions)
foreach(additional_definition IN LISTS ${definitions})
set(SHOULD_EXCLUDE 0)
# Exclude the compile definition if target defines an exclude list
foreach(exclude IN LISTS "${target}_exclude_compile_definitions")
if (${additional_definition} STREQUAL ${exclude})
set(SHOULD_EXCLUDE 1)
break()
endif()
endforeach()
if (NOT ${SHOULD_EXCLUDE})
target_compile_definitions(${target} PRIVATE ${additional_definition})
endif()
endforeach()
endfunction()


function(add_compile_options_filtered target options)
foreach(additional_option IN LISTS ${options})
set(SHOULD_EXCLUDE 0)
# Exclude the compile options if target defines an exclude list
foreach(exclude IN LISTS "${target}_exclude_compile_options")
if (${additional_option} STREQUAL ${exclude})
set(SHOULD_EXCLUDE 1)
break()
endif()
endforeach()
if (NOT ${SHOULD_EXCLUDE})
target_compile_options(${target} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:${additional_option}>")
endif()
endforeach()
endfunction()

function(add_sources_filtered target sources)
foreach(additional_source IN LISTS ${sources})
set(SHOULD_EXCLUDE 0)
# Exclude the source if target defines an exclude list
foreach(exclude IN LISTS "${target}_exclude_source")
if (${additional_source} STREQUAL ${exclude})
set(SHOULD_EXCLUDE 1)
break()
endif()
endforeach()
if (NOT ${SHOULD_EXCLUDE})
target_sources(${target} PRIVATE ${additional_source})
endif()
endforeach()
endfunction()

function(add_libraries_filtered target libraries)
foreach(additional_lib IN LISTS ${libraries})
set(SHOULD_EXCLUDE 0)
# Exclude the lib if target defines an exclude list
foreach(exclude IN LISTS "${target}_exclude_lib")
if (${additional_lib} STREQUAL ${exclude})
set(SHOULD_EXCLUDE 1)
break()
endif()
endforeach()
if (NOT ${SHOULD_EXCLUDE})
get_target_property(libraries ${target} LINK_LIBRARIES)
# Don't bother adding it if the target already links it manually
foreach(lib IN LISTS libraries)
if (${additional_lib} STREQUAL ${lib})
set(SHOULD_EXCLUDE 1)
break()
endif()
endforeach()
endif()
if (NOT ${SHOULD_EXCLUDE})
target_link_libraries(${target} PRIVATE ${additional_lib})
endif()
endforeach()
endfunction()

# Iterates over all the targets and add necessary definitions/options/libs
# This is an incredible hack, but it allows for targets to specify exclude lists
# This allows us to emulate -$File and such from VPC
foreach(target ${ALL_TARGETS})
# Define an empty exclude list if one isn't defined
if (NOT DEFINED "${target}_exclude_compile_options")
set("${target}_exclude_compile_options")
endif()

# Define an empty exclude list if one isn't defined
if (NOT DEFINED "${target}_exclude_lib")
set("${target}_exclude_lib")
endif()

# Define an empty exclude list if one isn't defined
if (NOT DEFINED "${target}_exclude_source")
set("${target}_exclude_source")
endif()

get_target_property(target_type ${target} TYPE)
if (${target_type} STREQUAL "EXECUTABLE")
add_compile_options_filtered(${target} ADDITIONAL_COMPILE_OPTIONS_EXE)
add_libraries_filtered(${target} ADDITIONAL_LINK_LIBRARIES_EXE)
add_sources_filtered(${target} ADDITIONAL_SOURCES_EXE)
target_link_options(${target} PRIVATE ${ADDITIONAL_LINK_OPTIONS_EXE})
target_compile_definitions(${target} PRIVATE MEMOVERRIDE_MODULE=$<TARGET_NAME_IF_EXISTS:${target}>)
add_compile_definitions_filtered(${target} ADDITIONAL_COMPILE_DEFINITIONS_EXE)

# Only applies to Linux and OSX
target_strip_symbols(${target})
elseif((${target_type} STREQUAL "SHARED_LIBRARY") OR (${target_type} STREQUAL "MODULE_LIBRARY"))
add_compile_options_filtered(${target} ADDITIONAL_COMPILE_OPTIONS_DLL)
add_libraries_filtered(${target} ADDITIONAL_LINK_LIBRARIES_DLL)
add_sources_filtered(${target} ADDITIONAL_SOURCES_DLL)
target_link_options(${target} PRIVATE ${ADDITIONAL_LINK_OPTIONS_DLL})
target_compile_definitions(${target} PRIVATE MEMOVERRIDE_MODULE=$<TARGET_NAME_IF_EXISTS:${target}> DLLNAME=$<TARGET_NAME_IF_EXISTS:${target}>)
add_compile_definitions_filtered(${target} ADDITIONAL_COMPILE_DEFINITIONS_DLL)

# Only applies to Linux and OSX
target_strip_symbols(${target})
elseif(${target_type} STREQUAL "STATIC_LIBRARY")
add_compile_options_filtered(${target} ADDITIONAL_COMPILE_OPTIONS_LIB)
add_sources_filtered(${target} ADDITIONAL_SOURCES_LIB)
target_link_options(${target} PRIVATE ${ADDITIONAL_LINK_OPTIONS_LIB})
target_compile_definitions(${target} PRIVATE LIBNAME=$<TARGET_NAME_IF_EXISTS:${target}>)
add_compile_definitions_filtered(${target} ADDITIONAL_COMPILE_DEFINITIONS_LIB)
endif()

endforeach()
# Add subdirectories as projects
add_subdirectory(game/client)
add_subdirectory(game/server)
add_subdirectory(materialsystem/swarmshaders)
add_subdirectory(materialsystem/shaderlib)
Loading